/* ============================================================
   ARSALAN TRADERS | PLANT MANAGEMENT
   Modern Bootstrap UI
   Light + Dark Theme
   ============================================================ */


/* ============================================================
   THEME VARIABLES
   ============================================================ */

:root {

  --wp-primary: #0d9488;
  --wp-primary-dark: #0f766e;
  --wp-primary-light: #ccfbf1;

  --wp-bg: #f6f8fb;
  --wp-card: #ffffff;
  --wp-card-hover: #ffffff;

  --wp-sidebar: #0b1220;
  --wp-sidebar-hover: #172235;

  --wp-text: #0f172a;
  --wp-text-secondary: #64748b;
  --wp-text-light: #94a3b8;

  --wp-border: #e5eaf0;
  --wp-border-strong: #d7dee7;

  --wp-success: #16a34a;
  --wp-warning: #d97706;
  --wp-danger: #dc2626;
  --wp-info: #2563eb;

  --wp-radius: 16px;
  --wp-radius-sm: 11px;

  --wp-shadow:
          0 1px 2px rgba(15, 23, 42, 0.03),
          0 5px 18px rgba(15, 23, 42, 0.04);

  --wp-shadow-hover:
          0 14px 35px rgba(15, 23, 42, 0.09);

  --wp-input-bg: #ffffff;
}


/* ============================================================
   DARK THEME
   ============================================================ */

html[data-theme="dark"] {

  --wp-bg: #0b1120;

  --wp-card: #111827;

  --wp-card-hover: #172033;

  --wp-text: #f1f5f9;

  --wp-text-secondary: #94a3b8;

  --wp-text-light: #64748b;

  --wp-border: #243044;

  --wp-border-strong: #334155;

  --wp-input-bg: #0f172a;

  --wp-primary-light: rgba(13, 148, 136, 0.15);

  --wp-shadow:
          0 1px 2px rgba(0, 0, 0, 0.25),
          0 8px 24px rgba(0, 0, 0, 0.15);

  --wp-shadow-hover:
          0 15px 40px rgba(0, 0, 0, 0.30);
}


/* ============================================================
   GLOBAL
   ============================================================ */

html {
  scroll-behavior: smooth;
}

body {

  margin: 0;

  background: var(--wp-bg);

  color: var(--wp-text);

  font-family:
          "Poppins",
          -apple-system,
          BlinkMacSystemFont,
          "Segoe UI",
          sans-serif;
  font-size: 0.92rem;

  line-height: 1.55;

  transition:
          background-color 0.25s ease,
          color 0.25s ease;
}


::selection {

  background: var(--wp-primary-light);

  color: var(--wp-primary-dark);
}


/* ============================================================
   APP SHELL
   ============================================================ */

.app-shell {

  display: flex;

  min-height: 100vh;

  background: var(--wp-bg);
}


/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {

  width: 252px;

  flex-shrink: 0;

  background:
          linear-gradient(
                  180deg,
                  #0b1220 0%,
                  #111827 100%
          );

  color: #cbd5e1;

  display: flex;

  flex-direction: column;

  position: fixed;

  inset: 0 auto 0 0;

  z-index: 100;

  box-shadow:
          5px 0 25px rgba(15, 23, 42, 0.10);
}


.sidebar .brand {

  display: flex;

  align-items: center;

  gap: 0.75rem;

  padding: 1.3rem 1.2rem;

  border-bottom:
          1px solid rgba(255,255,255,0.06);
}


.sidebar .brand .glyph {

  width: 40px;
  height: 40px;

  display: flex;

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

  border-radius: 12px;

  background:
          linear-gradient(
                  135deg,
                  #0d9488,
                  #0f766e
          );

  color: white;

  font-weight: 800;

  font-size: 0.82rem;

  box-shadow:
          0 7px 20px rgba(13,148,136,0.25);
}


.sidebar .brand .title {

  color: white;

  font-size: 0.92rem;

  font-weight: 750;
}


.sidebar .brand .subtitle {

  color: #64748b;

  font-size: 0.68rem;

  margin-top: 2px;
}


.sidebar nav {

  flex: 1;

  overflow-y: auto;

  padding: 1rem 0.75rem;
}


.sidebar .nav-link {

  display: flex;

  align-items: center;

  gap: 0.7rem;

  padding: 0.7rem 0.85rem;

  margin-bottom: 0.25rem;

  border-radius: 10px;

  color: #94a3b8;

  font-size: 0.84rem;

  font-weight: 500;

  transition:
          background 0.18s ease,
          color 0.18s ease,
          transform 0.18s ease;
}


.sidebar .nav-link:hover {

  background:
          rgba(255,255,255,0.055);

  color: white;

  transform:
          translateX(2px);
}


.sidebar .nav-link.active {

  background:
          linear-gradient(
                  135deg,
                  #0d9488,
                  #0f766e
          );

  color: white;

  box-shadow:
          0 7px 18px rgba(13,148,136,0.20);
}


.sidebar .nav-link .dot {

  width: 6px;
  height: 6px;

  border-radius: 50%;

  background: currentColor;

  opacity: 0.5;
}


.sidebar .nav-link.active .dot {

  opacity: 1;
}


.sidebar .user-box {

  padding: 1rem 1.1rem;

  border-top:
          1px solid rgba(255,255,255,0.06);

  background:
          rgba(0,0,0,0.08);
}


.sidebar .user-box .name {

  color: white;

  font-weight: 650;

  font-size: 0.82rem;
}


.sidebar .user-box .role {

  color: #64748b;

  font-size: 0.7rem;

  margin-top: 2px;

  margin-bottom: 0.75rem;
}


/* ============================================================
   MAIN
   ============================================================ */

.main-col {

  margin-left: 252px;

  flex: 1;

  min-width: 0;

  display: flex;

  flex-direction: column;
}


/* ============================================================
   TOPBAR
   ============================================================ */

.topbar {

  min-height: 78px;

  padding:
          0.9rem 1.75rem;

  background:
          color-mix(
                  in srgb,
                  var(--wp-card) 90%,
                  transparent
          );

  border-bottom:
          1px solid var(--wp-border);

  display: flex;

  align-items: center;

  justify-content: space-between;

  position: sticky;

  top: 0;

  z-index: 50;

  backdrop-filter: blur(15px);
}


.topbar-heading h1 {

  margin: 0;

  font-size: 1.15rem;

  font-weight: 750;

  letter-spacing: -0.02em;
}


.topbar .lede {

  color: var(--wp-text-secondary);

  font-size: 0.76rem;

  margin-top: 3px;
}


.topbar-actions {

  display: flex;

  align-items: center;

  gap: 0.55rem;
}


/* ============================================================
   THEME BUTTON
   ============================================================ */

/* ============================================================
   THEME TOGGLE
   ============================================================ */

.theme-toggle {

    width: 44px;
    height: 44px;

    border: 1px solid var(--wp-border);

    border-radius: 13px;

    background:
        var(--wp-card);

    color:
        var(--wp-text);

    display: flex;

    align-items: center;

    justify-content: center;

    cursor: pointer;

    position: relative;

    overflow: hidden;

    box-shadow:
        var(--wp-shadow);

    transition:
        all 0.2s ease;
}


.theme-toggle:hover {

    border-color:
        var(--wp-primary);

    color:
        var(--wp-primary);

    transform:
        translateY(-2px);

    box-shadow:
        var(--wp-shadow-hover);
}


.theme-toggle:active {

    transform:
        scale(0.94);
}


.theme-icon {

    font-size:
        1.15rem;

    line-height:
        1;

    font-weight:
        600;
}


/* Light mode = show moon */

.sun-icon {

    display:
        none;
}


.moon-icon {

    display:
        inline-flex;
}


/* Dark mode = show sun */

html[data-theme="dark"] .sun-icon {

    display:
        inline-flex;
}


html[data-theme="dark"] .moon-icon {

    display:
        none;
}


.mobile-menu-btn {

  width: 42px;
  height: 42px;

  border:
          1px solid var(--wp-border);

  background:
          var(--wp-card);

  color:
          var(--wp-text);

  border-radius:
          11px;
}


/* ============================================================
   PAGE BODY
   ============================================================ */

.page-body {

  padding:
          1.5rem 1.75rem 2rem;

  flex: 1;
}


/* ============================================================
   CARDS
   ============================================================ */

.wp-card {

  background:
          var(--wp-card);

  border:
          1px solid var(--wp-border);

  border-radius:
          var(--wp-radius);

  padding:
          1.25rem;

  margin-bottom:
          1.2rem;

  box-shadow:
          var(--wp-shadow);

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


.wp-card:hover {

  box-shadow:
          var(--wp-shadow-hover);
}


.wp-card h2 {

  margin: 0 0 1rem;

  color:
          var(--wp-text);

  font-size:
          0.94rem;

  font-weight:
          750;

  letter-spacing:
          -0.01em;

  display:
          flex;

  align-items:
          center;

  justify-content:
          space-between;
}


/* ============================================================
   DASHBOARD HERO
   ============================================================ */

.dashboard-hero {

  background:
          linear-gradient(
                  135deg,
                  #0f766e 0%,
                  #0d9488 50%,
                  #115e59 100%
          );

  color:
          white;

  border:
          none;

  padding:
          1.45rem;

  position:
          relative;

  overflow:
          hidden;

  box-shadow:
          0 14px 35px rgba(13,148,136,0.20);
}


.dashboard-hero::before {

  content: "";

  position: absolute;

  width: 260px;
  height: 260px;

  right: -100px;
  top: -120px;

  border-radius: 50%;

  background:
          rgba(255,255,255,0.08);
}


.dashboard-hero::after {

  content: "";

  position: absolute;

  width: 170px;
  height: 170px;

  right: 100px;
  bottom: -120px;

  border-radius: 50%;

  background:
          rgba(255,255,255,0.05);
}


.dashboard-hero-content {

  position:
          relative;

  z-index:
          2;
}


.dashboard-hero .eyebrow {

  font-size:
          0.68rem;

  text-transform:
          uppercase;

  letter-spacing:
          0.1em;

  opacity:
          0.75;

  font-weight:
          700;
}


.dashboard-hero .hero-title {

  font-size:
          1.45rem;

  font-weight:
          800;

  margin-top:
          0.25rem;

  letter-spacing:
          -0.03em;
}


.dashboard-hero .hero-subtitle {

  opacity:
          0.78;

  font-size:
          0.78rem;

  margin-top:
          0.25rem;
}


/* ============================================================
   MODERN PERIOD SELECTOR
   ============================================================ */

.period-card {

  display:
          flex;

  align-items:
          center;

  justify-content:
          space-between;

  gap:
          1rem;

  flex-wrap:
          wrap;
}


.period-selector {

  display:
          inline-flex;

  align-items:
          center;

  gap:
          4px;

  padding:
          4px;

  background:
          var(--wp-bg);

  border:
          1px solid var(--wp-border);

  border-radius:
          13px;

  box-shadow:
          inset 0 1px 1px rgba(15,23,42,0.025);
}


.period-btn {

  border:
          none !important;

  background:
          transparent !important;

  color:
          var(--wp-text-secondary) !important;

  border-radius:
          9px !important;

  padding:
          0.48rem 0.78rem !important;

  font-size:
          0.73rem !important;

  font-weight:
          650 !important;

  line-height:
          1.2;

  text-transform:
          capitalize;

  transition:
          background 0.18s ease,
          color 0.18s ease,
          box-shadow 0.18s ease,
          transform 0.18s ease;
}


.period-btn:hover {

  color:
          var(--wp-text) !important;

  background:
          var(--wp-card) !important;
}


.period-btn.active {

  color:
          white !important;

  background:
          var(--wp-primary) !important;

  box-shadow:
          0 4px 10px rgba(13,148,136,0.22);

}


.period-btn.active:hover {

  color:
          white !important;

  background:
          var(--wp-primary-dark) !important;
}


.period-label {

  font-size:
          0.7rem;

  color:
          var(--wp-text-secondary);

  font-weight:
          600;

  white-space:
          nowrap;
}


/* ============================================================
   STAT CARDS
   ============================================================ */

.dashboard-stat {

  height:
          100%;

  background:
          var(--wp-card);

  border:
          1px solid var(--wp-border);

  border-radius:
          15px;

  padding:
          1.05rem;

  box-shadow:
          var(--wp-shadow);

  position:
          relative;

  overflow:
          hidden;

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


.dashboard-stat:hover {

  transform:
          translateY(-3px);

  box-shadow:
          var(--wp-shadow-hover);
}


.dashboard-stat::after {

  content: "";

  position:
          absolute;

  width:
          85px;

  height:
          85px;

  right:
          -35px;

  top:
          -35px;

  border-radius:
          50%;

  background:
          var(--wp-primary-light);
}


.dashboard-stat .stat-icon {

  width:
          35px;

  height:
          35px;

  border-radius:
          10px;

  display:
          flex;

  align-items:
          center;

  justify-content:
          center;

  background:
          var(--wp-primary-light);

  color:
          var(--wp-primary);

  font-size:
          0.82rem;

  font-weight:
          800;

  margin-bottom:
          0.8rem;

  position:
          relative;

  z-index:
          2;
}


.dashboard-stat .stat-label {

  color:
          var(--wp-text-secondary);

  font-size:
          0.69rem;

  font-weight:
          650;

  text-transform:
          uppercase;

  letter-spacing:
          0.055em;

  position:
          relative;

  z-index:
          2;
}


.dashboard-stat .stat-value {

  color:
          var(--wp-text);

  font-size:
          1.25rem;

  font-weight:
          800;

  letter-spacing:
          -0.02em;

  margin-top:
          0.15rem;

  position:
          relative;

  z-index:
          2;
}


.dashboard-stat.good {

  border-top:
          3px solid var(--wp-success);
}


.dashboard-stat.warn {

  border-top:
          3px solid var(--wp-warning);
}


.dashboard-stat.bad {

  border-top:
          3px solid var(--wp-danger);
}


.dashboard-stat.info {

  border-top:
          3px solid var(--wp-info);
}


/* ============================================================
   SECTION HEADINGS
   ============================================================ */

.section-heading {

  display:
          flex;

  align-items:
          center;

  justify-content:
          space-between;

  margin:
          1.4rem 0 0.8rem;
}


.section-heading .title {

  font-size:
          0.92rem;

  font-weight:
          750;

  color:
          var(--wp-text);
}


.section-heading .subtitle {

  color:
          var(--wp-text-secondary);

  font-size:
          0.7rem;
}


/* ============================================================
   CHARTS
   ============================================================ */

.chart-card {

  min-height:
          390px;
}


.chart-container {

  position:
          relative;

  height:
          310px;
}


.chart-card.large-chart {

  min-height:
          410px;
}


.chart-card.large-chart
.chart-container {

  height:
          330px;
}


/* ============================================================
   FORMS
   ============================================================ */

.form-control,
.form-select {

  background:
          var(--wp-input-bg);

  color:
          var(--wp-text);

  border-color:
          var(--wp-border);

  border-radius:
          9px;

  min-height:
          40px;

  transition:
          border-color 0.18s ease,
          box-shadow 0.18s ease,
          background 0.25s ease,
          color 0.25s ease;
}


.form-control::placeholder {

  color:
          var(--wp-text-light);
}


.form-control:focus,
.form-select:focus {

  background:
          var(--wp-input-bg);

  color:
          var(--wp-text);

  border-color:
          var(--wp-primary);

  box-shadow:
          0 0 0 3px rgba(13,148,136,0.11);
}


.form-label {

  color:
          var(--wp-text);

  font-weight:
          600;
}


/* ============================================================
   TABLES
   ============================================================ */

table.wp-table {

  color:
          var(--wp-text);

  font-size:
          0.84rem;
}


table.wp-table thead th {

  background:
          var(--wp-bg);

  color:
          var(--wp-text-secondary);

  border-bottom:
          1px solid var(--wp-border);

  font-size:
          0.68rem;

  text-transform:
          uppercase;

  letter-spacing:
          0.05em;
}


table.wp-table td {

  border-color:
          var(--wp-border);

  vertical-align:
          middle;
}


table.wp-table tbody tr {

  transition:
          background 0.15s ease;
}


table.wp-table tbody tr:hover {

  background:
          var(--wp-bg);
}


/* ============================================================
   BOOTSTRAP OVERRIDES
   ============================================================ */

.modal-content {

  background:
          var(--wp-card);

  color:
          var(--wp-text);

  border:
          1px solid var(--wp-border);

  border-radius:
          16px;

  box-shadow:
          0 25px 70px rgba(0,0,0,0.20);
}


.modal-header,
.modal-footer {

  border-color:
          var(--wp-border);
}


.btn-close {
  filter: none;
}

html[data-theme="dark"] .btn-close {
  filter: invert(1)
          grayscale(1)
          brightness(2);
}


/* ============================================================
   ALERTS
   ============================================================ */

.alert {

  border-radius:
          11px;
}


/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {

  text-align:
          center;

  padding:
          3rem 1rem;

  color:
          var(--wp-text-secondary);
}


.empty-state .glyph {

  font-size:
          2rem;

  margin-bottom:
          0.5rem;

  opacity:
          0.55;
}


/* ============================================================
   TOASTS
   ============================================================ */

#toast-stack {

  position:
          fixed;

  right:
          1.25rem;

  bottom:
          1.25rem;

  z-index:
          2000;

  display:
          flex;

  flex-direction:
          column;

  gap:
          0.5rem;
}


/* ============================================================
   SCROLLBAR
   ============================================================ */

* {

  scrollbar-width:
          thin;

  scrollbar-color:
          #94a3b8 transparent;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 900px) {

  .sidebar {

    transform:
            translateX(-100%);

    transition:
            transform 0.25s ease;
  }

  .sidebar.open {

    transform:
            translateX(0);
  }

  .main-col {

    margin-left:
            0;
  }

  .topbar {

    padding:
            0.8rem 1rem;
  }

  .page-body {

    padding:
            1rem;
  }

}


@media (max-width: 700px) {

  .period-card {

    align-items:
            stretch;
  }

  .period-selector {

    width:
            100%;

    overflow-x:
            auto;
  }

  .period-btn {

    flex:
            0 0 auto;
  }

}


@media (max-width: 576px) {

  .page-body {

    padding:
            0.8rem;
  }

  .wp-card {

    padding:
            1rem;

    border-radius:
            13px;
  }

  .dashboard-stat .stat-value {

    font-size:
            1.1rem;
  }

}

/* ============================================================
   SHARED DASHBOARD-STYLE COMPONENTS
   Keeps every authenticated page visually consistent with
   dashboard.html while preserving Bootstrap functionality.
   ============================================================ */

.btn-teal {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--wp-primary);
  --bs-btn-border-color: var(--wp-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--wp-primary-dark);
  --bs-btn-hover-border-color: var(--wp-primary-dark);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--wp-primary-dark);
  --bs-btn-active-border-color: var(--wp-primary-dark);
  border-radius: 10px;
  font-weight: 650;
  box-shadow: 0 5px 14px rgba(13,148,136,0.15);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn-teal:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(13,148,136,0.22);
}

.nav-tabs {
  gap: 5px;
  padding: 4px;
  background: var(--wp-card);
  border: 1px solid var(--wp-border);
  border-radius: 14px;
  box-shadow: var(--wp-shadow);
}

.nav-tabs .nav-item {
  margin-bottom: 0;
}

.nav-tabs .nav-link {
  border: 0 !important;
  border-radius: 10px !important;
  color: var(--wp-text-secondary);
  font-size: .78rem;
  font-weight: 650;
  padding: .58rem .82rem;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-tabs .nav-link:hover {
  color: var(--wp-text);
  background: var(--wp-bg);
}

.nav-tabs .nav-link.active {
  color: #fff;
  background: var(--wp-primary);
  box-shadow: 0 4px 11px rgba(13,148,136,.20);
}

.action-card {
  cursor: pointer;
  color: var(--wp-text);
  text-decoration: none;
  min-height: 150px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.action-card:hover {
  color: var(--wp-text);
  transform: translateY(-4px);
  border-color: rgba(13,148,136,.45) !important;
  box-shadow: var(--wp-shadow-hover);
}

.action-card .action-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .8rem;
  background: var(--wp-primary-light);
  color: var(--wp-primary);
  font-weight: 800;
}

.action-card h2 {
  margin: 0;
  font-size: .95rem;
}

.stat-tile {
  background: var(--wp-bg);
  border: 1px solid var(--wp-border);
  border-radius: 12px;
  padding: .75rem .9rem;
}

.stat-tile .label {
  color: var(--wp-text-secondary);
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stat-tile .value {
  color: var(--wp-text);
  font-size: 1.05rem;
  font-weight: 800;
  margin-top: .15rem;
}

.compact-stat {
  min-width: 120px;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  padding: .35rem .6rem;
  border-radius: 999px;
  background: var(--wp-primary-light);
  color: var(--wp-primary);
  border: 1px solid rgba(13,148,136,.16);
  font-size: .68rem;
  font-weight: 700;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  padding: .34rem .58rem;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge-ok {
  background: rgba(22,163,74,.10);
  color: var(--wp-success);
  border-color: rgba(22,163,74,.18);
}

.badge-warn {
  background: rgba(217,119,6,.10);
  color: var(--wp-warning);
  border-color: rgba(217,119,6,.18);
}

.badge-bad {
  background: rgba(220,38,38,.10);
  color: var(--wp-danger);
  border-color: rgba(220,38,38,.18);
}

.page-section-eyebrow {
  color: var(--wp-primary);
  font-size: .66rem;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.page-section-title {
  color: var(--wp-text);
  font-size: 1.05rem;
  font-weight: 750;
}

.list-group-item {
  background: var(--wp-card);
  color: var(--wp-text);
  border-color: var(--wp-border);
}

.dropdown-menu {
  background: var(--wp-card);
  border-color: var(--wp-border);
  box-shadow: var(--wp-shadow-hover);
}

.dropdown-item {
  color: var(--wp-text);
}

.dropdown-item:hover {
  background: var(--wp-bg);
  color: var(--wp-text);
}

.text-muted {
  color: var(--wp-text-secondary) !important;
}

.btn-outline-secondary {
  --bs-btn-color: var(--wp-text-secondary);
  --bs-btn-border-color: var(--wp-border-strong);
  --bs-btn-hover-color: var(--wp-text);
  --bs-btn-hover-bg: var(--wp-bg);
  --bs-btn-hover-border-color: var(--wp-border-strong);
}

@media (max-width: 700px) {
  .nav-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .nav-tabs .nav-link {
    white-space: nowrap;
  }
}


/* ============================================================
   COMPACT FORMS + DARK MODE COMPLETENESS
   ============================================================ */

.wp-form-modal .modal-dialog {
  max-width: 500px;
  margin: .9rem auto;
}

.wp-form-modal .modal-content {
  border-radius: 16px;
}

.wp-form-modal .modal-header {
  padding: .62rem .85rem;
}

.wp-form-modal .modal-footer {
  padding: .55rem .85rem;
}

.wp-form-modal .modal-body {
  padding: .62rem .85rem;
  max-height: min(62vh, 520px);
  overflow-y: auto;
}

.wp-form-modal .modal-body > .row {
  --bs-gutter-x: .6rem;
  --bs-gutter-y: .25rem;
}

.wp-form-modal .modal-title {
  font-size: .86rem;
  font-weight: 750;
  letter-spacing: -.01em;
}

.wp-form-modal .form-label {
  margin-bottom: .16rem;
  font-size: .70rem;
  font-weight: 650;
  letter-spacing: .01em;
}

.wp-form-modal .form-control,
.wp-form-modal .form-select {
  min-height: 32px;
  height: 32px;
  font-size: .72rem;
  padding: .28rem .5rem;
  border-radius: 9px;
}

.wp-form-modal .form-check-input {
  width: 1rem;
  height: 1rem;
  margin-top: .18rem;
}

.wp-form-modal .form-check-label {
  font-size: .72rem;
}

.wp-form-modal textarea.form-control {
  min-height: 48px;
  height: auto;
}

.wp-form-modal .mb-2 {
  margin-bottom: .3rem !important;
}

.stat-card-link {
  cursor: pointer;
}

.stat-card-link:focus-visible {
  outline: 2px solid var(--wp-primary);
  outline-offset: 3px;
}

.wp-form-modal .modal-content {
  overflow: hidden;
  box-shadow: var(--wp-shadow-hover);
}

.wp-form-modal .modal-header {
  border-bottom: 1px solid var(--wp-border);
  background: linear-gradient(135deg, var(--wp-card) 0%, var(--wp-primary-light) 100%);
}

.wp-form-modal .modal-header .btn-close {
  opacity: .65;
}

.wp-form-modal .modal-footer {
  border-top: 1px solid var(--wp-border);
}

.wp-form-modal .btn-teal {
  min-height: 31px;
  padding: .28rem .7rem;
  border-radius: 8px;
  font-size: .72rem;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(13,148,136,.14);
}

.wp-form-modal .btn-outline-secondary {
  min-height: 31px;
  padding: .28rem .65rem;
  border-radius: 8px;
  font-size: .72rem;
}

.due-summary-card {
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, var(--wp-card), var(--wp-primary-light));
}

.due-summary-label {
  color: var(--wp-text-secondary);
  font-size: .68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.due-summary-value {
  color: var(--wp-text);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-top: .15rem;
}

.due-summary-help {
  color: var(--wp-text-secondary);
  font-size: .68rem;
  margin-top: .1rem;
}

/* Bootstrap tables must inherit the application theme in both modes. */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--wp-text);
  --bs-table-border-color: var(--wp-border);
  --bs-table-striped-bg: var(--wp-bg);
  --bs-table-striped-color: var(--wp-text);
  --bs-table-hover-bg: var(--wp-bg);
  --bs-table-hover-color: var(--wp-text);
  color: var(--wp-text);
}

.table > :not(caption) > * > * {
  background-color: transparent;
  color: inherit;
  border-color: var(--wp-border);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: var(--wp-bg);
  color: var(--wp-text);
}

.table-hover > tbody > tr:hover > * {
  background-color: var(--wp-primary-light);
  color: var(--wp-text);
}

html[data-theme="dark"] .table,
html[data-theme="dark"] .table-striped,
html[data-theme="dark"] .table-hover {
  --bs-table-bg: transparent;
  --bs-table-color: var(--wp-text);
  --bs-table-striped-bg: #172033;
  --bs-table-striped-color: var(--wp-text);
  --bs-table-hover-bg: #1b293d;
  --bs-table-hover-color: var(--wp-text);
}

.form-check-input {
  background-color: var(--wp-input-bg);
  border-color: var(--wp-border-strong);
}

.input-group-text {
  background: var(--wp-bg);
  color: var(--wp-text);
  border-color: var(--wp-border);
}

.card,
.accordion-item,
.offcanvas,
.popover {
  background: var(--wp-card);
  color: var(--wp-text);
  border-color: var(--wp-border);
}

.accordion-button {
  background: var(--wp-card);
  color: var(--wp-text);
}

.accordion-button:not(.collapsed) {
  background: var(--wp-primary-light);
  color: var(--wp-text);
}

html[data-theme="dark"] .btn-light {
  --bs-btn-color: var(--wp-text);
  --bs-btn-bg: var(--wp-card);
  --bs-btn-border-color: var(--wp-border);
  --bs-btn-hover-bg: var(--wp-bg);
  --bs-btn-hover-color: var(--wp-text);
}

.form-select option {
  background: var(--wp-card);
  color: var(--wp-text);
}

@media (max-width: 700px) {
  .wp-form-modal .modal-dialog {
    max-width: calc(100% - 1rem);
    margin: .5rem auto;
  }
}

/* Authenticated pages remain hidden until the JWT is verified against /users/me.
   This blocks ordinary URL-tampering access through the static frontend. */
html.wp-auth-pending .app-shell {
  visibility: hidden;
}

/* Dashboard-style cards/forms across every module. */
.wp-card, .wp-form-modal .modal-content, .stat-tile {
  background: var(--wp-card);
  color: var(--wp-text);
  border-color: var(--wp-border);
}

.wp-form-modal .modal-content {
  border-top: 3px solid var(--wp-primary);
  box-shadow: var(--wp-shadow-hover);
}

.wp-form-modal .modal-header {
  background: linear-gradient(135deg, var(--wp-card), var(--wp-primary-light));
}

.wp-form-modal .modal-footer {
  background: var(--wp-bg);
}

.wp-form-modal .form-control,
.wp-form-modal .form-select,
.wp-form-modal textarea {
  background: var(--wp-input-bg);
  color: var(--wp-text);
  border-color: var(--wp-border);
}

.wp-form-modal .form-control:focus,
.wp-form-modal .form-select:focus,
.wp-form-modal textarea:focus {
  background: var(--wp-input-bg);
  color: var(--wp-text);
  border-color: var(--wp-primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,.12);
}

/* All application forms open centered in the viewport. */
.modal-dialog {
  display: flex;
  align-items: center;
  min-height: calc(100% - 1rem);
  margin: .5rem auto;
}

.wp-form-modal .modal-dialog {
  display: flex;
  align-items: center;
  min-height: calc(100% - 1.8rem);
  margin: .9rem auto;
}

@media (max-width: 700px) {
  .modal-dialog,
  .wp-form-modal .modal-dialog {
    min-height: calc(100% - 1rem);
    margin: .5rem auto;
  }
}


/* Sidebar icons and live alert counters */
.sidebar .nav-link .nav-icon { display:inline-flex; align-items:center; justify-content:center; width:1.35rem; min-width:1.35rem; font-size:1.05rem; line-height:1; opacity:.9; }
.sidebar .nav-link .nav-label { flex:1; min-width:0; }
.sidebar .nav-alert-badge { display:inline-flex; align-items:center; justify-content:center; min-width:1.15rem; height:1.15rem; padding:0 .22rem; border-radius:3px; background:#dc2626; color:#fff; font-size:.68rem; line-height:1; font-weight:700; box-shadow:0 0 0 1px rgba(255,255,255,.12); }
.sidebar .nav-alert-badge.d-none { display:none !important; }


/* Dashboard alert panels: use the same design tokens as the rest of the app. */
.dashboard-alert-section { margin-top: .25rem; }
.dashboard-section-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem;
}
.dashboard-section-heading h2 {
  margin: .12rem 0 0; color: var(--wp-text); font-size: 1rem; font-weight: 750;
  letter-spacing: -.015em;
}
.dashboard-section-kicker {
  display: block; color: var(--wp-text-secondary); font-size: .66rem; font-weight: 750;
  letter-spacing: .09em; text-transform: uppercase;
}
.dashboard-section-link {
  color: var(--wp-primary); font-size: .8rem; font-weight: 700; text-decoration: none;
  white-space: nowrap;
}
.dashboard-section-link:hover { color: var(--wp-primary-dark); text-decoration: underline; }
.dashboard-reminders-card { padding: 1.25rem; }
.dashboard-reminders-card .dashboard-section-heading { margin-bottom: .55rem; }
.dashboard-section-description { margin: 0 0 1rem; color: var(--wp-text-secondary); font-size: .8rem; }
.dashboard-count-badge {
  min-width: 1.8rem; height: 1.8rem; padding: 0 .45rem; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--wp-bg); border: 1px solid var(--wp-border); color: var(--wp-text-secondary);
  font-size: .78rem; font-weight: 750;
}
.dashboard-count-badge.is-alert { color: var(--wp-danger); background: color-mix(in srgb, var(--wp-danger) 9%, var(--wp-card)); border-color: color-mix(in srgb, var(--wp-danger) 25%, var(--wp-border)); }
.dashboard-alert-table-wrap { border: 1px solid var(--wp-border); border-radius: 12px; overflow: hidden; }
table.wp-table.dashboard-alert-table { margin: 0; }
table.wp-table.dashboard-alert-table thead th { padding: .8rem .9rem; background: var(--wp-bg); }
table.wp-table.dashboard-alert-table td { padding: .8rem .9rem; }
.dashboard-status-badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: .32rem .58rem;
  font-size: .7rem; font-weight: 700; line-height: 1.2; white-space: nowrap;
}
.dashboard-status-badge.is-overdue { color: var(--wp-danger); background: color-mix(in srgb, var(--wp-danger) 10%, var(--wp-card)); }
.dashboard-status-badge.is-due { color: #946200; background: color-mix(in srgb, var(--wp-warning) 15%, var(--wp-card)); }
.dashboard-empty-state {
  display: flex; align-items: center; gap: .8rem; padding: 1rem; border: 1px dashed var(--wp-border);
  border-radius: 12px; background: var(--wp-bg); color: var(--wp-text);
}
.dashboard-empty-icon {
  display: inline-flex; width: 2rem; height: 2rem; flex: 0 0 2rem; align-items: center; justify-content: center;
  border-radius: 10px; background: color-mix(in srgb, var(--wp-success) 12%, var(--wp-card));
  color: var(--wp-success); font-weight: 800;
}
.dashboard-empty-state strong, .dashboard-empty-state small { display: block; }
.dashboard-empty-state strong { font-size: .83rem; }
.dashboard-empty-state small { margin-top: .12rem; color: var(--wp-text-secondary); font-size: .76rem; }

/* Keep expense-category actions aligned and prevent buttons drifting apart. */
.expense-category-actions-cell { min-width: 190px; }
.expense-category-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: .45rem;
  flex-wrap: wrap; min-width: 175px;
}
.expense-category-actions .btn { margin: 0; white-space: nowrap; }
@media (max-width: 900px) {
  .expense-category-actions-cell { min-width: 165px; }
  .expense-category-actions { justify-content: flex-start; min-width: 155px; }
  .dashboard-alert-table { min-width: 620px; }
}
