:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-soft: #f7f7fb;
  --border: #e6e8f0;
  --text: #171923;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --primary: #6d5ef8;
  --primary-light: #8b7bff;
  --primary-dark: #4c39d6;
  --primary-soft: #efecff;
  --danger: #e0405a;
  --danger-soft: #fdecef;
  --success: #16a34a;
  --success-soft: #ecfdf3;
  --warn: #d97706;
  --warn-soft: #fef6e7;
  --info: #0ea5e9;
  --info-soft: #e6f6fe;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 18, 31, 0.04), 0 8px 24px -12px rgba(20, 18, 31, 0.12);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12141d;
  --surface: #1b1e2a;
  --surface-soft: #252938;
  --border: #353a4d;
  --text: #f1f2f8;
  --text-muted: #b1b7c8;
  --text-faint: #858da2;
  --primary: #9185ff;
  --primary-light: #aaa1ff;
  --primary-dark: #c1bbff;
  --primary-soft: #2d2a50;
  --danger: #ff7c91;
  --danger-soft: #442832;
  --success: #54cd8a;
  --success-soft: #1d3b31;
  --warn: #f6b956;
  --warn-soft: #45371f;
  --info: #5fc8f5;
  --info-soft: #163449;
  --shadow: 0 10px 28px -16px rgba(0, 0, 0, 0.72);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.theme-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--primary-dark);
  background: var(--surface-soft);
  border-color: var(--primary-light);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: block;
}

.theme-toggle-login {
  position: fixed;
  z-index: 5;
  top: 18px;
  right: 18px;
  box-shadow: var(--shadow);
}

/* ---------- Shell: split brand / form panels ---------- */
.portal-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}

.portal-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px;
  overflow: hidden;
  background:
    radial-gradient(70% 55% at 20% 15%, rgba(255, 255, 255, 0.16), transparent 60%),
    radial-gradient(60% 50% at 85% 90%, rgba(255, 255, 255, 0.12), transparent 55%),
    linear-gradient(155deg, #6d5ef8 0%, #5744e0 55%, #3c2bb8 100%);
  color: #fff;
}

.portal-brand::before,
.portal-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.portal-brand::before {
  width: 420px;
  height: 420px;
  top: -140px;
  right: -140px;
}

.portal-brand::after {
  width: 300px;
  height: 300px;
  bottom: -120px;
  left: -80px;
  background: rgba(255, 255, 255, 0.06);
}

.portal-brand-inner {
  position: relative;
  z-index: 1;
  max-width: 380px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 26px;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8ffccb;
  box-shadow: 0 0 0 3px rgba(143, 252, 203, 0.25);
}

.portal-brand .brand-mark {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-shadow: 0 20px 40px -16px rgba(20, 12, 70, 0.5);
  margin-bottom: 24px;
}

.portal-brand .brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.portal-brand h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  line-height: 1.25;
}

.portal-brand p {
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
  line-height: 1.65;
}

.portal-brand .brand-footer {
  position: relative;
  z-index: 1;
  margin-top: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.portal-brand .brand-footer .sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.portal-brand .brand-footer .footer-mark {
  height: 16px;
  width: auto;
  border-radius: 3px;
  display: block;
}

/* ---------- Ad / promo panel variant ---------- */

/* When an ad image is present, let it grow to fill the panel's full
   available height instead of the fixed-ratio fallback-copy layout. */
.portal-brand.has-ad-image {
  justify-content: flex-start;
}

.portal-brand.has-ad-image .portal-brand-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.ad-image-frame {
  display: block;
  width: 100%;
  max-width: 380px;
  flex: 1;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 50px -20px rgba(20, 12, 70, 0.55);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ad-image-frame:hover {
  transform: translateY(-2px);
  box-shadow: 0 28px 56px -18px rgba(20, 12, 70, 0.65);
}

.ad-image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ad-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.15s ease;
}

.ad-cta:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* ---------- Form panel ---------- */
.portal-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--surface);
}

.portal-form-inner {
  width: 100%;
  max-width: 360px;
}

.form-company-id {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 28px;
}

.form-company-id img {
  width: 76px;
  height: 76px;
  border-radius: 18px;
  object-fit: contain;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 10px;
  flex-shrink: 0;
}

.form-company-id span {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.portal-form-inner h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.portal-form-inner p.sub {
  color: var(--text-muted);
  margin: 0 0 30px;
  font-size: 13.5px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field .input-wrap {
  position: relative;
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 14.5px;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field input[type="password"] {
  padding-right: 42px;
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.toggle-visibility {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-faint);
}

.toggle-visibility:hover {
  background: var(--surface-soft);
  color: var(--text-muted);
}

.toggle-visibility svg {
  width: 18px;
  height: 18px;
}

.toggle-visibility .icon-off {
  display: none;
}

.toggle-visibility[data-visible="true"] .icon-on {
  display: none;
}

.toggle-visibility[data-visible="true"] .icon-off {
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(87, 68, 224, 0.6);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7f70ff, #4535c9);
}

.btn-block {
  width: 100%;
  margin-top: 6px;
}

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-error {
  background: var(--danger-soft);
  color: #a9243d;
}

.alert-success {
  background: var(--success-soft);
  color: #0f7a3d;
}

.portal-form-footer {
  margin-top: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.portal-form-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text-muted);
}

.portal-form-footer a:hover {
  color: var(--primary-dark);
}

.portal-form-footer a img {
  height: 16px;
  width: auto;
  display: block;
}

html[data-theme="dark"] .portal-form {
  background: var(--surface);
}

html[data-theme="dark"] .portal-brand .brand-mark,
html[data-theme="dark"] .form-company-id img {
  background: #fff;
}

@media (max-width: 860px) {
  .portal-shell {
    grid-template-columns: 1fr;
  }

  /* Ad variant: show the sign-in form first, promo panel below it */
  .portal-brand.ad-variant {
    order: 2;
  }

  .portal-form {
    order: 1;
  }

  .portal-brand {
    padding: 36px 28px;
    min-height: 220px;
    justify-content: flex-start;
  }

  .portal-brand::before {
    width: 260px;
    height: 260px;
    top: -100px;
    right: -100px;
  }

  .portal-brand::after {
    display: none;
  }

  .portal-brand-inner {
    max-width: none;
  }

  .portal-brand .brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin-bottom: 16px;
  }

  .form-company-id img {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    padding: 8px;
  }

  .portal-brand h2 {
    font-size: 21px;
  }

  .portal-brand p {
    display: none;
  }

  .portal-brand .brand-footer {
    display: none;
  }

  /* Ad panel is no longer the top band on mobile (form comes first), so
     let it size to its image instead of the compact collapsed-band height. */
  .portal-brand.ad-variant {
    min-height: 0;
    padding-bottom: 44px;
  }

  .ad-image-frame {
    width: min(320px, 100%);
    max-width: 320px;
    aspect-ratio: 4 / 5;
    flex: none;
    margin: 0 auto;
  }

  .ad-cta {
    display: none;
  }

  .portal-form {
    padding: 36px 24px 48px;
  }
}

/* ==========================================================================
   Dashboard shell
   ========================================================================== */

.dash-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% -8%, rgba(109, 94, 248, 0.13), transparent 29rem),
    radial-gradient(circle at -8% 68%, rgba(51, 170, 126, 0.08), transparent 25rem),
    var(--bg);
}

.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px max(28px, calc((100vw - 1240px) / 2));
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid rgba(230, 232, 240, 0.9);
  backdrop-filter: blur(16px);
}

html[data-theme="dark"] .dash-topbar {
  background: rgba(27, 30, 42, 0.86);
  border-bottom-color: rgba(53, 58, 77, 0.9);
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dash-brand img {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 5px;
  flex-shrink: 0;
}

.dash-brand span {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dash-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-user .who {
  text-align: right;
}

.dash-user .who .n {
  font-size: 13.5px;
  font-weight: 700;
}

.dash-user .who .r {
  font-size: 11.5px;
  color: var(--text-faint);
}

.dash-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13.5px;
  flex-shrink: 0;
}

.dash-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex-shrink: 0;
}

.dash-logout:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.dash-logout svg {
  width: 16px;
  height: 16px;
}

.dash-content {
  flex: 1;
  padding: 38px 28px 48px;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
}

.dash-welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.dash-eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary-dark);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.dash-eyebrow {
  margin-bottom: 9px;
}

.dash-eyebrow span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #20b26b;
  box-shadow: 0 0 0 4px rgba(32, 178, 107, 0.13);
}

.dash-welcome h1 {
  font-size: clamp(25px, 3vw, 32px);
  line-height: 1.15;
  font-weight: 750;
  margin: 0 0 8px;
  letter-spacing: -0.04em;
}

.dash-welcome p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.dash-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 650;
}

.dash-date svg {
  width: 15px;
  height: 15px;
  color: var(--primary);
}

/* Stat cards */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 34px;
}

.dash-stat-card {
  position: relative;
  min-height: 172px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.88);
  background-repeat: no-repeat;
  border: 1px solid rgba(230, 232, 240, 0.95);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 14px 32px -26px rgba(31, 28, 64, 0.38);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

html[data-theme="dark"] .dash-stat-card,
html[data-theme="dark"] .dash-panel {
  background-color: rgba(27, 30, 42, 0.9);
  border-color: rgba(53, 58, 77, 0.95);
}

.dash-stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: currentColor;
  opacity: 0.7;
}

.dash-stat-card::after {
  content: "";
  position: absolute;
  right: -26px;
  bottom: -34px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.06;
  pointer-events: none;
}

.dash-stat-card:hover {
  transform: translateY(-4px);
  border-color: rgba(109, 94, 248, 0.3);
  box-shadow: 0 22px 36px -24px rgba(54, 46, 125, 0.32);
}

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.dash-stat-card .icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-stat-card .icon svg {
  width: 19px;
  height: 19px;
}

.dash-stat-card.accent-primary {
  color: var(--primary-dark);
  background-image: linear-gradient(160deg, var(--primary-soft) 0%, transparent 60%);
}

.dash-stat-card.accent-primary .icon {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.dash-stat-card.accent-warn {
  color: var(--warn);
  background-image: linear-gradient(160deg, var(--warn-soft) 0%, transparent 60%);
}

.dash-stat-card.accent-warn .icon {
  background: var(--warn-soft);
  color: var(--warn);
}

.dash-stat-card.accent-success {
  color: var(--success);
  background-image: linear-gradient(160deg, var(--success-soft) 0%, transparent 60%);
}

.dash-stat-card.accent-success .icon {
  background: var(--success-soft);
  color: var(--success);
}

.dash-stat-card.accent-danger {
  color: var(--danger);
  background-image: linear-gradient(160deg, var(--danger-soft) 0%, transparent 60%);
}

.dash-stat-card.accent-danger .icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.dash-stat-card.accent-info {
  color: var(--info);
  background-image: linear-gradient(160deg, var(--info-soft) 0%, transparent 60%);
}

.dash-stat-card.accent-info .icon {
  background: var(--info-soft);
  color: var(--info);
}

.dash-stat-card .label {
  font-size: 10.5px;
  line-height: 1.35;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.065em;
}

.dash-stat-card .value {
  color: var(--text);
  font-size: clamp(23px, 2vw, 28px);
  line-height: 1;
  font-weight: 750;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.dash-stat-card .value.currency {
  font-size: clamp(19px, 1.7vw, 25px);
}

.stat-caption {
  position: relative;
  z-index: 1;
  color: var(--text-faint);
  font-size: 11.5px;
  line-height: 1.3;
}

.dash-stat-card .value .unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-faint);
  margin-right: 3px;
}

/* Shortcuts */
.dash-section {
  margin-bottom: 34px;
}

.dash-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 13px;
}

.dash-section-heading h2,
.dash-panel-header h2 {
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 4px 0 0;
}

.dash-section-heading>span {
  color: var(--text-faint);
  font-size: 12px;
}

.dash-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 0;
}

.dash-shortcut {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

html[data-theme="dark"] .dash-shortcut {
  background: var(--surface);
}

.dash-shortcut:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -18px rgba(87, 68, 224, 0.35);
}

.dash-shortcut.accent-primary:hover {
  border-color: var(--primary-light);
}

.dash-shortcut.accent-info:hover {
  border-color: var(--info);
}

.dash-shortcut.accent-success:hover {
  border-color: var(--success);
}

.dash-shortcut .icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  flex-shrink: 0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-shortcut.accent-primary .icon {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
}

.dash-shortcut.accent-info .icon {
  background: linear-gradient(135deg, #5fd3ff, var(--info));
}

.dash-shortcut.accent-success .icon {
  background: linear-gradient(135deg, #4ade80, var(--success));
}

.dash-shortcut .icon svg {
  width: 20px;
  height: 20px;
}

.dash-shortcut.accent-primary:hover .arrow {
  color: var(--primary-dark);
}

.dash-shortcut.accent-info:hover .arrow {
  color: var(--info);
}

.dash-shortcut.accent-success:hover .arrow {
  color: var(--success);
}

.dash-shortcut .text {
  flex: 1;
  min-width: 0;
}

.dash-shortcut .text .t {
  font-size: 14px;
  font-weight: 700;
}

.dash-shortcut .text .d {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

.dash-shortcut .arrow {
  color: var(--text-faint);
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s ease;
}

.dash-shortcut:hover .arrow {
  transform: translateX(3px);
  color: var(--primary-dark);
}

.dash-shortcut .arrow svg {
  width: 16px;
  height: 16px;
}

/* Chart panel */
.dash-panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(230, 232, 240, 0.95);
  border-radius: 18px;
  box-shadow: 0 14px 32px -26px rgba(31, 28, 64, 0.38);
  padding: 24px;
}

.dash-panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 26px;
}

.dash-panel-header .note {
  font-size: 12px;
  color: var(--text-faint);
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  height: 180px;
  padding: 0 4px;
}

.bar-chart .bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.bar-chart .bar-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.bar-chart .bar {
  width: 60%;
  max-width: 34px;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 6px 6px 3px 3px;
  position: relative;
  transition: opacity 0.15s ease;
}

.bar-chart .bar-col:hover .bar {
  opacity: 0.85;
}

.bar-chart .bar-col.is-current .bar {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 18px -8px rgba(87, 68, 224, 0.55);
}

.bar-chart .bar-col.is-current .bar-label {
  color: var(--primary-dark);
  font-weight: 800;
}

.bar-chart .bar-col.is-current .bar-value {
  opacity: 1;
  color: var(--primary-dark);
}

.bar-chart .bar-value {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.bar-chart .bar-col:hover .bar-value {
  opacity: 1;
}

.bar-chart .bar-label {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 600;
}

.customer-powered-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 24px 28px;
  color: var(--text-faint);
  font-size: 12.5px;
}

.customer-powered-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-weight: 650;
}

.customer-powered-footer a:hover {
  color: var(--primary-dark);
}

.customer-powered-footer img {
  width: auto;
  height: 16px;
  display: block;
}

/* ==========================================================================
   Secondary buttons, back-link (Orders / New Order screens)
   ========================================================================== */

.btn-ghost {
  background: var(--surface-soft);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

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

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.back-link:hover {
  color: var(--primary-dark);
}

.back-link svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   Page header (Orders list, New Order form, ...)
   ========================================================================== */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: clamp(22px, 2.6vw, 27px);
  line-height: 1.2;
  font-weight: 750;
  margin: 6px 0 4px;
  letter-spacing: -0.03em;
}

.page-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

.page-header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.page-header-actions .btn svg {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   Data table (Orders list)
   ========================================================================== */

.dash-table-wrap {
  overflow-x: auto;
}

table.dash-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.dash-table th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 0 16px 12px;
  border-bottom: 1px solid var(--border);
}

.dash-table td {
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}

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

.dash-table tr:hover td {
  background: var(--surface-soft);
}

.dash-table .order-ref {
  font-weight: 700;
  color: var(--text);
}

.dash-table .muted {
  color: var(--text-faint);
}

.dash-table .amount {
  font-weight: 700;
  text-align: right;
}

.dash-table th.amount-col,
.dash-table td.amount {
  text-align: right;
}

.dash-table .view-link {
  font-weight: 700;
  color: var(--primary-dark);
  white-space: nowrap;
}

.dash-table .view-link:hover {
  text-decoration: underline;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-badge.is-pending {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-badge.is-processing {
  background: var(--info-soft);
  color: var(--info);
}

.status-badge.is-completed {
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.is-cancelled {
  background: var(--danger-soft);
  color: var(--danger);
}

.dash-empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-faint);
}

.dash-empty .icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-empty .icon svg {
  width: 24px;
  height: 24px;
}

.dash-empty h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text);
}

.dash-empty p {
  margin: 0 0 18px;
  font-size: 13px;
}

/* ==========================================================================
   Form fields — extend the login form's .field/.btn system with the
   input types and layout the order form needs.
   ========================================================================== */

.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field input[type="date"]:focus,
.field input[type="number"]:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.field textarea {
  resize: vertical;
  min-height: 84px;
}

.field .hint {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 20px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.line-items-table th {
  font-size: 10.5px;
}

.line-items-table input[type="text"],
.line-items-table input[type="number"],
.line-items-table select {
  padding: 9px 11px;
  font-size: 13px;
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-family: inherit;
}

.line-items-table input:focus,
.line-items-table select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.line-items-table td {
  padding: 10px 8px;
  vertical-align: top;
}

.line-items-table td:first-child {
  padding-left: 16px;
}

.line-items-table th:first-child {
  padding-left: 16px;
}

.line-items-table .col-slno {
  width: 60px;
}

.line-items-table td.slno {
  padding-top: 19px;
  color: var(--text-faint);
  font-weight: 700;
  font-size: 13px;
}

.line-items-table .col-item {
  min-width: 220px;
}

.line-items-table .col-unit {
  width: 100px;
}

.line-items-table .col-qty {
  width: 90px;
}

.line-items-table .col-price,
.line-items-table .col-total {
  width: 130px;
}

.line-items-table td.amount.row-total {
  padding-top: 19px;
}

.line-items-table .row-remove {
  width: 36px;
  padding-right: 16px;
  padding-top: 15px;
}

.line-items-table .row-remove-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: none;
  background: var(--danger-soft);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.line-items-table .row-remove-btn svg {
  width: 14px;
  height: 14px;
}

.stock-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--text-faint);
  border: 1px solid var(--border);
}

.stock-hint::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.stock-hint.in-stock {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

.stock-hint.low-stock {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.stock-hint.out-of-stock {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}

/* ==========================================================================
   Select2 — theme it to match the app's inputs instead of its default skin
   ========================================================================== */

.select2-container--default .select2-selection--single {
  height: auto;
  padding: 8.5px 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 0;
  padding-right: 20px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--text-faint);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  top: 0;
  right: 6px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--text-faint) transparent transparent transparent;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--primary) transparent;
}

.select2-dropdown {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.select2-search--dropdown {
  padding: 8px;
  background: var(--surface);
}

.select2-search--dropdown .select2-search__field {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
}

.select2-search--dropdown .select2-search__field:focus {
  outline: none;
  border-color: var(--primary);
}

.select2-results__option {
  font-size: 13px;
  color: var(--text);
  padding: 8px 12px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background: var(--primary);
  color: #fff;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.select2-results__message {
  color: var(--text-faint);
  font-size: 12.5px;
}

.order-totals {
  margin-top: 18px;
  margin-left: auto;
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Named .total-row (not .row) so it can't collide with Bootstrap's grid
   .row class on pages that opt into Bootstrap (see bootstrap-theme.css). */
.order-totals .total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-muted);
}

.order-totals .total-row.total {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   Order builder — a wide, calculation-first line-item workspace
   ========================================================================== */

.order-form-card {
  padding: 0;
  overflow: hidden;
  border-color: rgba(109, 94, 248, 0.2);
  box-shadow: 0 24px 48px -32px rgba(73, 57, 191, 0.45);
}

.order-form {
  padding: 28px;
  background: linear-gradient(155deg, rgba(109, 94, 248, 0.025), transparent 28%, rgba(35, 185, 161, 0.035));
}

.order-form-intro {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -28px -28px 26px;
  padding: 22px 28px;
  background:
    radial-gradient(circle at 92% 15%, rgba(255, 255, 255, 0.42), transparent 130px),
    linear-gradient(112deg, #6352e6 0%, #7869f7 49%, #35aacb 100%);
  border-bottom: 0;
}

.order-form-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #5a4ae0;
  background: #fff;
  box-shadow: 0 12px 24px -12px rgba(42, 31, 126, 0.55);
}

.order-form-icon svg {
  width: 21px;
  height: 21px;
}

.order-form-intro h2,
.order-lines-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.order-form-intro h2 {
  color: #fff;
}

.order-form-intro p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12.5px;
}

.order-form .form-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.order-form .form-control,
.order-form .form-select {
  min-height: 42px;
  border-color: var(--border) !important;
  border-radius: 10px;
  background-color: var(--surface-soft);
  color: var(--text);
  box-shadow: none;
}

.order-form textarea.form-control {
  min-height: 82px;
}

.order-form .form-control:focus,
.order-form .form-select:focus {
  border-color: var(--primary);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.order-lines-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 13px 0 13px;
}

.order-lines-heading .section-kicker {
  font-size: 10px;
  color: #1683bc;
}

.order-lines-heading h2 {
  margin-top: 4px;
  font-size: 18px;
}

.item-count {
  padding: 6px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, #eeeaff, #e0f7ff);
  color: #5643d3;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
}

.order-lines-table-shell {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
}

.order-lines-table {
  width: 100%;
  min-width: 0;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.order-lines-table thead th {
  padding: 13px 9px;
  background: linear-gradient(180deg, #f6f5ff, #f0f6ff);
  border: 0;
  border-bottom: 1px solid #e2e2f0;
  color: #70728b;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.order-lines-table thead th:first-child {
  padding-left: 16px;
  border-radius: 14px 0 0 0;
}

.order-lines-table thead th:last-child {
  padding-right: 16px;
  border-radius: 0 14px 0 0;
}

.order-lines-table tbody tr {
  transition: background 0.15s ease;
}

.order-lines-table tbody tr:hover {
  background: #faf9ff;
}

.order-lines-table tbody tr+tr td {
  border-top: 1px solid var(--border);
}

.order-lines-table td {
  padding: 12px 7px;
  vertical-align: middle;
  border: 0;
}

.order-lines-table td:first-child {
  padding-left: 16px;
}

.order-lines-table td:last-child {
  padding-right: 16px;
}

.order-lines-table .col-slno {
  width: 5%;
}

.order-lines-table .col-item {
  width: 35%;
}

.order-lines-table .col-unit {
  width: 9%;
}

.order-lines-table .col-qty {
  width: 7%;
}

.order-lines-table .col-rate {
  width: 9%;
}

.order-lines-table .col-amount {
  width: 10%;
}

.order-lines-table .col-tax-rate {
  width: 11%;
}

.order-lines-table .col-tax-amount {
  width: 11%;
}

.order-lines-table .col-total {
  width: 14%;
}

.order-lines-table thead .col-amount,
.order-lines-table thead .col-tax-amount {
  background: #effaf5;
  color: #288158;
}

.order-lines-table thead .col-tax-rate {
  background: #fff6e8;
  color: #ad701b;
}

.order-lines-table thead .col-total {
  background: #eeeaff;
  color: #5c48d7;
}

.order-lines-table td:nth-child(6),
.order-lines-table td:nth-child(8) {
  background: rgba(236, 253, 243, 0.33);
}

.order-lines-table td:nth-child(7) {
  background: rgba(255, 246, 232, 0.4);
}

.order-lines-table td:nth-child(9) {
  background: rgba(239, 236, 255, 0.48);
}

.slno-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
}

.slno-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: linear-gradient(135deg, #8778ff, #5e4be0);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 5px 10px -6px #5845cc;
}

.order-lines-table .row-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.order-lines-table tr:hover .row-remove-btn,
.order-lines-table .row-remove-btn {
  opacity: 1;
}

.order-lines-table .row-remove-btn {
  background: var(--danger-soft);
  color: var(--danger);
}

.order-lines-table .row-remove-btn svg {
  width: 13px;
  height: 13px;
}

.order-lines-table .form-control,
.order-lines-table .form-select {
  min-height: 39px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 12.5px;
}

.rate-cell {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.row-rate {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  padding: 0 10px;
  border-radius: 9px;
  background: #eef4ff;
  color: #3767aa;
}

.tax-rate-cell {
  font-size: 13px;
  font-weight: 800;
  color: #a56b19;
  white-space: nowrap;
}

.row-tax-rate {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  padding: 0 10px;
  border-radius: 9px;
  background: #fff4df;
  color: #a56b19;
}

.order-lines-table .select2-container--bootstrap-5 .select2-selection {
  min-height: 39px;
  border-radius: 9px;
}

.order-lines-table .select2-container--default .select2-selection--single {
  padding: 9px;
  background: var(--surface-soft);
  /* width: 100px; */
}

.select2-container--default {
  width: 150px;
}

.select2-selection--single {
  width: 200px;
}


.order-lines-table .stock-hint {
  margin-top: 6px;
  padding: 3px 7px;
  font-size: 10.5px;
}

.amount-cell {
  color: var(--text);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.tax-amount-cell {
  color: #1683bc;
}

.grand-cell {
  color: #5b46dc;
  font-size: 13.5px;
}

#add-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  border-radius: 9px;
  font-weight: 700;
  color: #5b46dc;
  border-color: #bcb5ff;
  background: #f7f6ff;
}

#add-item-btn:hover {
  color: #fff;
  border-color: #6d5ef8;
  background: linear-gradient(135deg, #8173fb, #6150dd);
}

#add-item-btn svg {
  width: 15px;
  height: 15px;
}

.order-totals {
  margin-top: 23px;
  max-width: 330px;
  padding: 17px 18px;
  border: 1px solid #d9d3ff;
  border-radius: 14px;
  background: linear-gradient(145deg, #faf9ff, #f0edff);
  box-shadow: 0 12px 24px -20px rgba(79, 60, 194, 0.55);
}

.order-totals .total-row.total {
  margin-top: 4px;
  padding-top: 13px;
  color: #5541d4;
  border-top-color: #d8d2fb;
}

.order-totals output {
  font: inherit;
  font-weight: 750;
}

html[data-theme="dark"] .order-form {
  background: linear-gradient(155deg, rgba(145, 133, 255, 0.08), transparent 30%, rgba(53, 176, 220, 0.05));
}

html[data-theme="dark"] .order-form-intro {
  background: linear-gradient(112deg, #41368e, #5549b5 52%, #1d7088);
}

html[data-theme="dark"] .order-lines-table-shell {
  background: var(--surface);
}

html[data-theme="dark"] .order-lines-table thead th {
  background: #25283a;
  border-bottom-color: var(--border);
  color: var(--text-muted);
}

html[data-theme="dark"] .order-lines-table thead .col-amount,
html[data-theme="dark"] .order-lines-table thead .col-tax-amount {
  background: #20362f;
  color: #77d7aa;
}

html[data-theme="dark"] .order-lines-table thead .col-tax-rate {
  background: #3d321e;
  color: #f3c36a;
}

html[data-theme="dark"] .order-lines-table thead .col-total {
  background: #312d55;
  color: #c3bdff;
}

html[data-theme="dark"] .order-lines-table td:nth-child(6),
html[data-theme="dark"] .order-lines-table td:nth-child(8) {
  background: rgba(29, 59, 49, 0.36);
}

html[data-theme="dark"] .order-lines-table td:nth-child(7) {
  background: rgba(69, 55, 31, 0.36);
}

html[data-theme="dark"] .order-lines-table td:nth-child(9) {
  background: rgba(45, 42, 80, 0.6);
}

html[data-theme="dark"] .row-rate {
  background: #28344b;
  color: #9ec6ff;
}

html[data-theme="dark"] .row-tax-rate {
  background: #3d321e;
  color: #f3c36a;
}

html[data-theme="dark"] .item-count {
  background: #312d55;
  color: #c3bdff;
}

html[data-theme="dark"] .order-totals {
  border-color: #4d4785;
  background: linear-gradient(145deg, #25233f, #1f2230);
}


@media (max-width: 900px) {
  .dash-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .dash-shortcuts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-welcome {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .order-form {
    padding: 20px 16px;
  }

  .order-form-intro {
    margin: -20px -16px 22px;
    padding: 19px 16px;
    align-items: flex-start;
  }

  .order-form-intro p {
    line-height: 1.45;
  }

  .order-lines-heading {
    margin-top: 26px;
  }

  .order-lines-table-shell {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .order-lines-table,
  .order-lines-table tbody {
    display: block;
    width: 100%;
  }

  .order-lines-table thead {
    display: none;
  }

  .order-lines-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    margin-bottom: 13px;
    padding: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 10px 22px -20px rgba(31, 28, 64, 0.38);
  }

  .order-lines-table tbody tr+tr td {
    border-top: 0;
  }

  .order-lines-table td {
    min-width: 0;
    padding: 9px 8px;
    border: 0;
  }

  .order-lines-table td:first-child,
  .order-lines-table td:last-child {
    padding-right: 8px;
    padding-left: 8px;
  }

  .order-lines-table td::before {
    display: block;
    margin-bottom: 5px;
    color: var(--text-faint);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .order-lines-table td:nth-child(1)::before {
    content: "SL No";
  }

  .order-lines-table td:nth-child(2)::before {
    content: "Item search";
  }

  .order-lines-table td:nth-child(3)::before {
    content: "Unit";
  }

  .order-lines-table td:nth-child(4)::before {
    content: "Qty";
  }

  .order-lines-table td:nth-child(5)::before {
    content: "Rate";
  }

  .order-lines-table td:nth-child(6)::before {
    content: "Amount";
  }

  .order-lines-table td:nth-child(7)::before {
    content: "Tax percentage";
  }

  .order-lines-table td:nth-child(8)::before {
    content: "Tax amount";
  }

  .order-lines-table td:nth-child(9)::before {
    content: "Total amount";
  }

  .order-lines-table td:nth-child(2) {
    grid-column: 1 / -1;
  }

  .order-lines-table td:nth-child(6),
  .order-lines-table td:nth-child(8),
  .order-lines-table td:nth-child(9) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 65px;
    border-radius: 9px;
  }

  .order-lines-table td:nth-child(6),
  .order-lines-table td:nth-child(8) {
    background: var(--success-soft);
  }

  .order-lines-table td:nth-child(7) {
    background: var(--warn-soft);
    border-radius: 9px;
  }

  .order-lines-table td:nth-child(9) {
    background: var(--primary-soft);
  }

  .order-lines-table .row-remove-btn {
    opacity: 1;
  }

  .order-lines-table .select2-container {
    width: 100% !important;
  }

  .order-totals {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .dash-stats {
    grid-template-columns: 1fr;
  }

  .dash-topbar {
    padding: 12px 16px;
  }

  .dash-content {
    padding: 20px 16px;
  }

  .dash-user .who {
    display: none;
  }

  .dash-date {
    display: none;
  }

  .dash-stat-card {
    min-height: 142px;
  }

  .dash-section-heading>span {
    display: none;
  }

  .dash-panel {
    padding: 19px 16px;
  }

  .bar-chart {
    gap: 9px;
    height: 155px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header-actions .btn {
    flex: 1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .order-totals {
    max-width: none;
  }
}

.select2-selection__rendered {
  padding: 0px;
  line-height: 11px !important;

}

.product-column .select2-container {
  width: 350px !important;
}

.unit-column .select2-container {
  width: 80px !important;
}

.product-column .select2-container .select2-selection,
.unit-column .select2-container .select2-selection {
  width: 100% !important;
}

.statement-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.statement-title {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  color: #222;
}

.statement-subtitle {
  margin: 4px 0 0;
  color: #777;
  font-size: 13px;
}


/* Date Filter */

.statement-filter {
  background: #f8f9fa;
  border: 1px solid #e2e5e8;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 18px;
}

.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 15px;
  flex-wrap: wrap;
}

.filter-field {
  width: 200px;
}

.filter-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
}

.filter-field .form-control {
  height: 38px;
  border-radius: 6px;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.filter-actions .btn {
  height: 38px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
}


/* Summary */

.statement-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 18px;
}

.summary-box {
  padding: 15px 18px;
  background: #fff;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
}

.summary-box span {
  display: block;
  font-size: 12px;
  color: #777;
  margin-bottom: 5px;
}

.summary-box strong {
  font-size: 18px;
  color: #222;
}

.debit-summary {
  border-left: 4px solid #dc3545;
}

.credit-summary {
  border-left: 4px solid #198754;
}


/* Table */

.statement-table-wrap {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.statement-table {
  width: 100% !important;
  margin: 0 !important;
  font-size: 13px;
}

.statement-table thead th {
  background: #f4f6f8;
  color: #333;
  font-weight: 600;
  white-space: nowrap;
  padding: 11px 8px;
  border-bottom: 1px solid #ddd;
}

.statement-table tbody td {
  padding: 9px 8px;
  vertical-align: middle;
}

.statement-table tbody tr:hover {
  background: #f8fbff;
}

.statement-table .amtCol {
  text-align: right;
}

.amount-cell {
  text-align: right;
  white-space: nowrap;
}

.balance-cell {
  font-weight: 600;
}


/* Opening */

.opening-balance-row {
  background: #f8f9fa !important;
  font-weight: 500;
}

.summary-label-cell {
  text-align: right;
  font-weight: 600;
  color: #444;
}


/* Period Total */

.period-total-row {
  background: #f8f9fa;
  border-top: 2px solid #ddd;
}

.transaction-count {
  display: inline-block;
  margin-left: 5px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #e9ecef;
  font-size: 11px;
  color: #555;
}


/* Closing Balance */

.closing-balance-row {
  background: #eef4ff !important;
  border-top: 2px solid #d5e2f5;
}

.closing-amount {
  font-size: 15px;
  font-weight: 700;
}


/* Empty */

.no-records {
  text-align: center;
  color: #dc3545;
  padding: 35px !important;
  font-weight: 500;
}


/* Pagination */

.pagination-wrapper {
  padding: 10px 5px;
}


/* Mobile */

@media (max-width: 768px) {

  .statement-summary {
    grid-template-columns: 1fr;
  }

  .filter-row {
    display: block;
  }

  .filter-field {
    width: 100%;
    margin-bottom: 12px;
  }

  .filter-actions {
    margin-top: 5px;
  }

  .statement-table-wrap {
    overflow-x: auto;
  }

  .statement-table {
    min-width: 1000px;
  }

}

/* =========================================
   Account Statement Pagination
   ========================================= */

.pagination-row td {
  padding: 18px 20px !important;
  background: #ffffff;
  border-top: 1px solid #e9ecef;
}

.statement-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

/* Pagination information */

.pagination-info {
  color: #6b7280;
  font-size: 13px;
  line-height: 34px;
  white-space: nowrap;
}

.pagination-info strong {
  color: #111827;
  font-weight: 600;
}

/* Pagination container */

.pagination-links {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  pointer-events: auto !important;
}

.pagination-links nav {
  margin: 0;
  padding: 0;
}

/* UL */

.pagination-links .pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  margin: 0;
  padding: 0;

  list-style: none;
}

/* LI */

.pagination-links .page-item {
  margin: 0;
  padding: 0;
}

/* Page buttons */

.pagination-links .page-link {
  position: relative;
  z-index: 101;

  display: flex;
  align-items: center;
  justify-content: center;

  min-width: 36px;
  height: 36px;

  padding: 0 11px;

  border: 1px solid #e2e8f0;
  border-radius: 8px;

  background: #ffffff;
  color: #475569;

  font-size: 13px;
  font-weight: 500;

  text-decoration: none;

  cursor: pointer !important;
  pointer-events: auto !important;

  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
}

/* Hover */

.pagination-links .page-link:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #2563eb;

  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);

  transform: translateY(-1px);
}

/* Active page */

.pagination-links .page-item.active .page-link {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;

  font-weight: 600;

  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
}

/* Active hover */

.pagination-links .page-item.active .page-link:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;

  transform: translateY(-1px);
}

/* Disabled */

.pagination-links .page-item.disabled .page-link {
  background: #f8fafc;
  border-color: #edf0f3;
  color: #cbd5e1;

  cursor: not-allowed !important;
  pointer-events: none !important;

  box-shadow: none;
}

/* Previous / Next */

.pagination-links .page-item:first-child .page-link,
.pagination-links .page-item:last-child .page-link {
  min-width: 78px;
  padding: 0 13px;

  font-weight: 500;
}

/* Ellipsis */

.pagination-links .page-item.disabled .page-link {
  border-color: transparent;
  background: transparent;
}

.bigdrop {
  width: 565px !important;
}

/* =========================================
   Mobile
   ========================================= */

@media (max-width: 768px) {

  .pagination-row td {
    padding: 15px 10px !important;
  }

  .statement-pagination {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .pagination-info {
    font-size: 12px;
    line-height: 25px;
  }

  .pagination-links .pagination {
    gap: 4px;
    flex-wrap: wrap;
  }

  .pagination-links .page-link {
    min-width: 34px;
    height: 34px;

    padding: 0 8px;
  }

  .pagination-links .page-item:first-child .page-link,
  .pagination-links .page-item:last-child .page-link {
    min-width: 65px;
  }

  .bigdrop {
    width: unset !important;
  }
}