:root {
  --primary: #0F172A;
  --primary-light: #1E293B;
  --accent: #104289;
  --accent-hover: #104289;
  --bg: #F8FAFC;
  --card-bg: rgba(255, 255, 255, 0.9);
  --text: #334155;
  --text-light: #64748B;
  --border: #E2E8F0;
  --success: #10B981;
  --danger: #EF4444;
  --radius: 12px;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

/* Typography */
h1,
h2,
h3 {
  color: #104289;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

p {
  color: var(--text-light);
}

/* Auth Page */
.login-bg {
  background: linear-gradient(135deg, #f6f8fb 0%, #e5eef5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 1rem;
}

.login-card {
  padding: 2.5rem 2rem;
}

.logo-container {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-container img {
  max-width: 220px;
  height: auto;
  margin-bottom: 1rem;
}

.logo-container h2 {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
  letter-spacing: -0.5px;
}

.logo-container p {
  font-size: 0.875rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
  background: white;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-icon {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.btn-icon:hover {
  color: #104289;
}

/* Buttons */
.btn {
  display: inline-block;
  font-weight: 500;
  text-align: center;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-primary {
  background-color: #3ca65a;
  color: white;
}

.btn-primary:hover {
  background-color: #2c8545;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--text-light);
  color: white;
}

.btn-secondary:hover {
  background-color: var(--text);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background-color: var(--bg);
  border-color: var(--text-light);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
}

/* Alert Box */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert.hidden {
  display: none;
}

.alert-error {
  background-color: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}

/* Layout */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 290px;
  background-color: var(--primary);
  color: white;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
  color: white;
  margin: 0;
}

.nav-links {
  list-style: none;
  flex-grow: 1;
}

.nav-links li {
  margin-bottom: 0.5rem;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 0.75rem 0.75rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
  font-weight: 500;
  overflow: hidden;
}

.nav-links a svg {
  flex-shrink: 0;
}

.nav-links a span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-links a:hover,
.nav-links a.active {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.main-content {
  flex-grow: 1;
  padding: 2rem;
  overflow-y: auto;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Cards & Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
}

.stat-card h3 {
  font-size: 0.875rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-light);
  background-color: #F8FAFC;
}

tr:last-child td {
  border-bottom: none;
}

/* Quotation Form */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.terms-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.term-column {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.term-column h4 {
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ============================================
   EDIT COMPANY MODAL — Premium Design
   ============================================ */

/* Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes credentialSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
    max-height: 0;
  }

  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 400px;
  }
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Card */
.modal-card {
  position: relative;
  width: 92%;
  max-width: 440px;
  max-height: 90vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
  animation: modalSlideUp 0.3s ease;
  display: flex;
  flex-direction: column;
}

/* Header */
.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #0F172A 0%, #1a3a6e 50%, #104289 100%);
  position: relative;
  flex-shrink: 0;
}

.modal-header-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  font-size: 16px;
  flex-shrink: 0;
}

.modal-close-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Body */
.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-field {
  margin-bottom: 14px;
}

.modal-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.modal-label-icon {
  font-size: 14px;
}

.modal-body input[type="text"],
.modal-body input[type="email"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #FAFBFC;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.modal-body input[type="text"]:focus,
.modal-body input[type="email"]:focus {
  border-color: #104289;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16, 66, 137, 0.1);
}

/* Divider */
.modal-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 12px 0 10px;
}

/* Custom Checkbox */
.modal-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #FFF7ED;
  border: 1.5px solid #FED7AA;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.modal-checkbox-label:hover {
  background: #FFF3E0;
  border-color: #FDBA74;
}

.modal-checkbox-label input[type="checkbox"] {
  display: none;
}

.modal-checkbox-custom {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid #D1D5DB;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: all 0.2s;
  background: #fff;
}

.modal-checkbox-label input:checked+.modal-checkbox-custom {
  background: #EF4444;
  border-color: #EF4444;
}

.modal-checkbox-label input:checked+.modal-checkbox-custom::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.modal-checkbox-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-checkbox-text strong {
  font-size: 13px;
  color: #9A3412;
}

.modal-checkbox-text small {
  font-size: 12px;
  color: #C2410C;
  opacity: 0.8;
}

/* Credentials Result */
.modal-credentials {
  background: linear-gradient(135deg, #F0FDF4 0%, #ECFDF5 100%);
  border: 1.5px solid #86EFAC;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  animation: credentialSlideIn 0.35s ease;
}

.modal-credentials-header {
  margin-bottom: 8px;
}

.modal-credentials-badge {
  display: inline-block;
  background: #16A34A;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.modal-credentials-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.modal-credential-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-credential-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #166534;
  opacity: 0.7;
}

.modal-credential-value {
  font-size: 14px;
  font-weight: 500;
  color: #14532D;
}

.modal-credential-pw-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-credential-code {
  background: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1.5px solid #BBF7D0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #14532D;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.modal-btn-icon {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1.5px solid #BBF7D0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s;
}

.modal-btn-icon:hover {
  background: #DCFCE7;
  border-color: #4ADE80;
  transform: scale(1.05);
}

.modal-btn-send {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, #104289, #1a5bc4);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 8px;
}

.modal-btn-send:hover {
  background: linear-gradient(135deg, #0d3670, #1550b0);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 66, 137, 0.3);
}

.modal-credentials-note {
  font-size: 11px;
  color: #92400E;
  text-align: center;
  margin: 0;
  padding: 6px 0 0;
  opacity: 0.9;
}

/* Action Buttons */
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.modal-btn-cancel {
  flex: 1;
  padding: 11px 20px;
  background: #F1F5F9;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn-cancel:hover {
  background: #E2E8F0;
  border-color: #CBD5E1;
}

.modal-btn-save {
  flex: 1.5;
  padding: 11px 20px;
  background: linear-gradient(135deg, #3ca65a, #2d9049);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(60, 166, 90, 0.3);
}

.modal-btn-save:hover {
  background: linear-gradient(135deg, #2d9049, #247a3c);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(60, 166, 90, 0.4);
}

.modal-btn-save:disabled {
  opacity: 0.7;
  cursor: wait;
  transform: none;
}

/* ============================================
   RESPONSIVE DESIGN (Media Queries)
   ============================================ */

/* Tablet & Smaller Screens (max-width: 1024px) */
@media (max-width: 1024px) {
  .terms-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet Portrait & Mobile Landscape (max-width: 768px) */
@media (max-width: 768px) {
  .dashboard-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100% !important;
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .sidebar-header {
    margin-bottom: 0;
    padding-bottom: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: none;
  }

  /* Mobile Collapsed State */
  .sidebar.collapsed .nav-links {
    display: none !important;
  }

  /* Mobile Expanded State */
  .sidebar:not(.collapsed) .nav-links {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 1rem;
    gap: 0.5rem;
  }

  .sidebar:not(.collapsed) .sidebar-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }

  .nav-links li {
    margin-bottom: 0;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .top-bar {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .user-info {
    width: 100%;
    justify-content: space-between;
  }
}

/* Mobile Phones (max-width: 480px) */
@media (max-width: 480px) {
  .terms-grid {
    grid-template-columns: 1fr;
  }

  .modal-card {
    width: 95%;
    max-width: 100%;
  }

  .main-content {
    padding: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* ============================================
   SIDEBAR TOGGLE (DESKTOP)
   ============================================ */
@media (min-width: 769px) {
  .sidebar {
    transition: width 0.3s ease, padding 0.3s ease;
    overflow: hidden;
    white-space: nowrap;
  }

  .sidebar.collapsed {
    width: 76px !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    display: flex !important;
  }

  .sidebar.collapsed .sidebar-titles {
    display: none !important;
  }

  .sidebar.collapsed .nav-links span {
    display: none !important;
  }

  .sidebar.collapsed .nav-links a {
    justify-content: center;
    padding: 0.75rem 0;
  }

  .sidebar.collapsed .sidebar-header {
    justify-content: center !important;
    width: 100%;
  }

  .sidebar.collapsed #menu-toggle {
    margin: 0 auto;
  }
}