/* PlotSale Enterprise UI System
   Shared by login.html and analytics.html
   Uses vanilla CSS only. No build step required. */

:root {
  --pp-font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pp-sidebar-width: clamp(282px, 18vw, 346px);
  --pp-radius-xl: 22px;
  --pp-radius-lg: 18px;
  --pp-radius-md: 14px;
  --pp-radius-sm: 10px;
  --pp-speed: 180ms;
  --pp-max-content: 1780px;

  --pp-green-950: #061308;
  --pp-green-900: #0b1f10;
  --pp-green-850: #102817;
  --pp-green-800: #15321d;
  --pp-green-700: #1f5834;
  --pp-green-600: #168447;
  --pp-green-500: #1fb85c;
  --pp-green-400: #4fd864;
  --pp-green-300: #77ee82;
  --pp-orange: #f6a034;
  --pp-blue: #3b82f6;
  --pp-red: #e44848;
  --pp-amber: #d69624;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --app-bg: #07110a;
  --app-bg-soft: #0a1710;
  --sidebar-bg: rgba(16, 31, 23, 0.98);
  --surface: rgba(20, 37, 27, 0.96);
  --surface-2: rgba(23, 45, 32, 0.96);
  --surface-3: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(79, 216, 100, 0.075);
  --border: rgba(134, 188, 142, 0.17);
  --border-strong: rgba(134, 188, 142, 0.32);
  --text: #f4faf1;
  --text-strong: #ffffff;
  --muted: #a9bea9;
  --muted-2: #7f937f;
  --accent: #4fd864;
  --accent-strong: #1fb85c;
  --accent-deep: #168447;
  --accent-soft: rgba(79, 216, 100, 0.16);
  --card-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  --table-head-bg: #f0f5ef;
  --table-head-text: #0b1810;
}

html[data-theme="light"] {
  color-scheme: light;
  --app-bg: #f5f8f4;
  --app-bg-soft: #edf4ed;
  --sidebar-bg: rgba(255, 255, 255, 0.98);
  --surface: rgba(255, 255, 255, 0.96);
  --surface-2: rgba(255, 255, 255, 0.98);
  --surface-3: rgba(14, 93, 48, 0.045);
  --surface-hover: rgba(22, 132, 71, 0.075);
  --border: rgba(37, 76, 45, 0.12);
  --border-strong: rgba(22, 132, 71, 0.28);
  --text: #102016;
  --text-strong: #08120c;
  --muted: #5d705f;
  --muted-2: #7a897d;
  --accent: #168447;
  --accent-strong: #126d3b;
  --accent-deep: #0f5f34;
  --accent-soft: rgba(22, 132, 71, 0.12);
  --card-shadow: 0 22px 70px rgba(17, 39, 23, 0.08);
  --table-head-bg: #edf4ef;
  --table-head-text: #132319;
}

* { box-sizing: border-box; }

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: var(--pp-font);
  color: var(--text);
  background:
    radial-gradient(circle at 80% -10%, rgba(79, 216, 100, 0.08), transparent 30%),
    linear-gradient(180deg, var(--app-bg-soft), var(--app-bg));
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--pp-speed) ease, opacity var(--pp-speed) ease, background var(--pp-speed) ease;
}

a:hover { color: var(--accent); }

button,
input,
select {
  font: inherit;
}

button { cursor: pointer; }

img,
svg { display: block; }

.page-hidden { display: none !important; }

body.page-transition-ready .app-main,
body.page-transition-ready .mobile-main,
body.page-transition-ready .login-shell {
  opacity: 0;
}

body.page-transition-ready.page-transition-in .app-main,
body.page-transition-ready.page-transition-in .mobile-main,
body.page-transition-ready.page-transition-in .login-shell {
  opacity: 1;
  transition: opacity 180ms ease;
}

body.page-transition-ready.page-transition-out .app-main,
body.page-transition-ready.page-transition-out .mobile-main,
body.page-transition-ready.page-transition-out .login-shell {
  opacity: 0;
  transition: opacity 140ms ease;
}

@media (prefers-reduced-motion: reduce) {
  body.page-transition-ready .app-main,
  body.page-transition-ready .mobile-main,
  body.page-transition-ready .login-shell,
  body.page-transition-ready.page-transition-in .app-main,
  body.page-transition-ready.page-transition-in .mobile-main,
  body.page-transition-ready.page-transition-in .login-shell,
  body.page-transition-ready.page-transition-out .app-main,
  body.page-transition-ready.page-transition-out .mobile-main,
  body.page-transition-ready.page-transition-out .login-shell {
    opacity: 1;
    transition: none;
  }
}

/* Brand */
.logo-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: visible;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-brand .logo-mark {
  width: 70px;
  height: 70px;
}

.app-brand .logo-mark {
  width: 58px;
  height: 58px;
}

.mobile-brand .logo-mark {
  width: 46px;
  height: 46px;
}

.brand-word {
  font-size: clamp(33px, 4vw, 49px);
  font-weight: 900;
  line-height: .95;
  letter-spacing: -0.045em;
}

.brand-word .neutral { color: var(--text-strong); }
.brand-word .green { color: var(--accent); }
.brand-word .orange { color: var(--pp-orange); }

/* Login */
.login-page {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  padding: clamp(18px, 4vw, 44px);
  background:
    linear-gradient(90deg, rgba(4, 14, 7, 0.42), rgba(4, 14, 7, 0.18)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=2400&q=86") center / cover no-repeat;
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 75% 15%, rgba(79, 216, 100, 0.18), transparent 18%),
    linear-gradient(180deg, rgba(2, 11, 4, 0.16), rgba(2, 11, 4, 0.64));
}

.theme-toggle.login-theme-toggle {
  position: fixed;
  top: 24px;
  right: 28px;
  z-index: 5;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
}

.login-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 455px);
  margin-top: -4vh;
  padding: clamp(30px, 4.2vw, 50px) clamp(22px, 3.7vw, 40px);
  border: 1px solid rgba(113, 178, 116, 0.12);
  border-radius: 8px;
  background: rgba(21, 42, 24, 0.9);
  box-shadow: 0 34px 95px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(9px);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: clamp(30px, 4.2vw, 48px);
}

.login-form {
  display: grid;
  gap: 18px;
}

.field-group { position: relative; }

.login-input,
.app-control {
  width: 100%;
  border: 1px solid rgba(148, 205, 151, 0.08);
  outline: none;
  color: #f5fbf1;
  background: rgba(14, 30, 16, 0.9);
  transition: border-color var(--pp-speed) ease, box-shadow var(--pp-speed) ease, background var(--pp-speed) ease;
}

.login-input {
  height: 62px;
  border-radius: 9px;
  padding: 0 18px;
  font-size: 18px;
}

.login-input::placeholder { color: rgba(232, 243, 229, 0.45); }

.login-input:focus,
.app-control:focus {
  border-color: rgba(79, 216, 100, 0.52);
  background: rgba(10, 27, 13, 0.96);
  box-shadow: 0 0 0 4px rgba(79, 216, 100, 0.08);
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 42px;
  height: 42px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 11px;
  color: rgba(236, 247, 233, 0.72);
  background: transparent;
}

.password-toggle:hover { color: #ffffff; background: rgba(255, 255, 255, 0.05); }

.primary-btn {
  height: 64px;
  border: 0;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(135deg, #168447, #0f6d39);
  box-shadow: 0 18px 48px rgba(10, 107, 55, 0.34);
  font-size: 21px;
  font-weight: 800;
  transition: transform var(--pp-speed) ease, filter var(--pp-speed) ease, box-shadow var(--pp-speed) ease;
}

.primary-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 22px 54px rgba(10, 107, 55, 0.38);
}

.login-links {
  display: grid;
  gap: 20px;
  margin-top: 10px;
  color: rgba(219, 235, 215, 0.76);
  font-size: 17px;
}

.login-links a { color: #72ee80; font-weight: 700; }

.login-side-note {
  position: absolute;
  left: max(28px, 13vw);
  bottom: 11vh;
  z-index: 2;
  color: rgba(244, 250, 241, 0.78);
  font-size: clamp(17px, 1.35vw, 24px);
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.login-watermark {
  position: absolute;
  right: 7vw;
  bottom: 7vh;
  z-index: 1;
  width: min(360px, 34vw);
  height: min(360px, 34vw);
  display: grid;
  place-items: center;
  opacity: 0.26;
}

.login-watermark img {
  width: 74%;
  height: 74%;
  object-fit: contain;
}

html[data-theme="light"] .login-page {
  background:
    linear-gradient(90deg, rgba(244, 248, 242, 0.88), rgba(237, 246, 235, 0.72)),
    url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=2400&q=86") center / cover no-repeat;
}

html[data-theme="light"] .login-page::before {
  background:
    radial-gradient(circle at 74% 16%, rgba(22, 132, 71, 0.18), transparent 18%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(237, 246, 235, 0.86));
}

html[data-theme="light"] .login-shell {
  border-color: rgba(22, 132, 71, 0.18);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 34px 95px rgba(17, 39, 23, 0.16);
}

html[data-theme="light"] .login-input,
html[data-theme="light"] .app-control {
  border-color: rgba(37, 76, 45, 0.16);
  color: var(--text);
  background: rgba(255, 255, 255, 0.94);
}

html[data-theme="light"] .login-input::placeholder {
  color: rgba(16, 32, 22, 0.48);
}

html[data-theme="light"] .login-input:focus,
html[data-theme="light"] .app-control:focus {
  border-color: rgba(22, 132, 71, 0.38);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(22, 132, 71, 0.10);
}

html[data-theme="light"] .password-toggle {
  color: rgba(16, 32, 22, 0.62);
}

html[data-theme="light"] .password-toggle:hover {
  color: var(--text-strong);
  background: rgba(22, 132, 71, 0.08);
}

html[data-theme="light"] .login-links {
  color: rgba(16, 32, 22, 0.70);
}

html[data-theme="light"] .login-links a {
  color: var(--accent);
}

html[data-theme="light"] .login-side-note {
  color: rgba(16, 32, 22, 0.70);
}

html[data-theme="light"] .login-watermark {
  opacity: 0.14;
}

/* App layout */
.app-page {
  min-height: 100svh;
  background:
    radial-gradient(circle at 68% -10%, rgba(79, 216, 100, 0.08), transparent 28%),
    linear-gradient(180deg, var(--app-bg-soft), var(--app-bg));
}

.desktop-app-shell {
  display: grid;
  grid-template-columns: var(--pp-sidebar-width) minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100svh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: 18px 0 50px rgba(0, 0, 0, 0.12);
  z-index: 10;
}

.sidebar-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 2vw, 34px) clamp(18px, 1.6vw, 26px);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 24px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.app-brand .logo-mark { width: 52px; height: 52px; border-radius: 16px; }

.app-brand-title {
  color: var(--text-strong);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.app-brand-subtitle {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-spacer { flex: 1 1 auto; min-height: 24px; }

.sidebar-footer {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 0 18px;
  border-radius: 14px;
  color: var(--muted);
  font-size: clamp(16px, 1.2vw, 20px);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.nav-link i {
  width: 24px;
  text-align: center;
  font-size: 18px;
  color: currentColor;
  opacity: .95;
}

.nav-link:hover {
  color: var(--text-strong);
  background: var(--surface-hover);
}

.nav-link.active {
  color: var(--text-strong);
  background: var(--accent-soft);
}

.nav-link.logout-link { color: var(--muted); }
.nav-link.logout-link:hover { color: var(--pp-red); background: rgba(228, 72, 72, .08); }

.app-main {
  min-width: 0;
  padding: clamp(26px, 2.7vw, 48px);
}

.app-main-inner {
  max-width: var(--pp-max-content);
  min-height: calc(100svh - clamp(52px, 5.4vw, 96px));
  display: flex;
  flex-direction: column;
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 58px;
  margin-bottom: clamp(26px, 2vw, 38px);
}

.topbar-tools,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--accent);
  background: transparent;
  transition: color var(--pp-speed) ease, background var(--pp-speed) ease;
}

.icon-btn:hover { color: var(--text-strong); background: var(--surface-hover); }

.record-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(135deg, #1fb85c, #168447);
  box-shadow: 0 15px 38px rgba(22, 132, 71, .22);
  font-size: 15px;
  font-weight: 850;
}

.record-btn:hover { color: #ffffff; filter: brightness(1.05); }

.theme-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 78px;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
}

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  transition: transform var(--pp-speed) ease;
}

html[data-theme="dark"] .theme-toggle::before { transform: translateX(36px); }

.theme-toggle i {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  font-size: 14px;
}

html[data-theme="light"] .theme-toggle .sun-icon,
html[data-theme="dark"] .theme-toggle .moon-icon { color: #ffffff; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-avatar {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: linear-gradient(135deg, #4fd864, #168447);
  box-shadow: 0 12px 30px rgba(22, 132, 71, .22);
}

.user-avatar i { font-size: 20px; }

.user-name {
  color: var(--text-strong);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.user-role {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.page-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.page-title {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(38px, 3.4vw, 58px);
  line-height: .95;
  font-weight: 900;
  letter-spacing: -0.07em;
}

.page-subtitle {
  max-width: 820px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(15px, .95vw, 17px);
  line-height: 1.55;
}

.dashboard-grid {
  flex: 1 0 auto;
  display: grid;
  gap: clamp(18px, 1.5vw, 24px);
  margin-top: clamp(24px, 2.3vw, 36px);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1.2vw, 20px);
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-lg);
  background: var(--surface);
  box-shadow: var(--card-shadow);
}

.kpi-card {
  position: relative;
  min-height: clamp(126px, 8vw, 154px);
  padding: clamp(18px, 1.4vw, 24px);
  overflow: hidden;
}

.kpi-card::after {
  content: "";
  position: absolute;
  right: -48px;
  bottom: -62px;
  width: 176px;
  height: 176px;
  border-radius: 50%;
  background: rgba(79, 216, 100, 0.06);
}

.kpi-card.primary {
  border-color: rgba(79, 216, 100, .32);
  background: linear-gradient(135deg, #168447, #43bf84);
  color: #ffffff;
}

.kpi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.kpi-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 15px;
  color: #ffffff;
  background: rgba(79, 216, 100, 0.15);
  border: 1px solid rgba(79, 216, 100, 0.18);
}

.kpi-card.primary .kpi-icon {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.17);
}

.kpi-icon i { font-size: 23px; }

.kpi-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .035em;
}

.kpi-card.primary .kpi-label { color: rgba(255, 255, 255, .88); }

.kpi-value {
  margin-top: 18px;
  color: var(--text-strong);
  font-size: clamp(25px, 2vw, 35px);
  line-height: 1;
  text-align: right;
  font-weight: 900;
  letter-spacing: -0.065em;
  position: relative;
  z-index: 1;
}

.kpi-card.primary .kpi-value { color: #ffffff; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(340px, .95fr);
  gap: clamp(18px, 1.5vw, 24px);
  align-items: start;
}

.stack { display: grid; gap: clamp(18px, 1.5vw, 24px); }

.panel { padding: clamp(18px, 1.45vw, 24px); }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-title {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(19px, 1.2vw, 23px);
  font-weight: 900;
  letter-spacing: -0.045em;
}

.panel-link {
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
}

.panel-link:hover { color: var(--text-strong); }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-3);
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: var(--text);
  font-size: 15px;
}

.data-table th,
.data-table td {
  padding: 14px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th:last-child,
.data-table td:last-child { border-right: 0; }
.data-table tr:last-child td { border-bottom: 0; }

.data-table th {
  color: var(--table-head-text);
  background: var(--table-head-bg);
  font-weight: 900;
  white-space: nowrap;
}

.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table a { color: var(--accent); font-weight: 850; }
.data-table a:hover { color: var(--text-strong); }

.status-pill,
.info-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  color: var(--accent);
  background: var(--accent-soft);
}

.status-pill { color: var(--text-strong); }

.chart-card { min-height: 230px; }

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr));
  gap: 10px;
  align-items: end;
  height: 152px;
  padding-top: 12px;
}

.bar-item {
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.bar {
  width: 100%;
  min-height: 9px;
  border-radius: 9px 9px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 8px 24px rgba(22, 132, 71, .2);
}

.alert-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
}

.alert-danger { color: var(--pp-red); }
.alert-warning { color: var(--pp-amber); }

.section-label {
  margin: 22px 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.info-pill.blue { color: var(--pp-blue); background: rgba(59, 130, 246, .12); }
.info-pill.success { color: var(--accent); background: var(--accent-soft); }
.info-pill.plain { color: var(--muted); background: transparent; padding-inline: 2px; }

.mini-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.mini-summary-card {
  min-height: 88px;
  padding: 16px;
  border-radius: 15px;
  border: 1px solid var(--border);
  background: var(--surface-3);
}

.mini-summary-card .small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.mini-summary-card .big {
  margin-top: 10px;
  color: var(--text-strong);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -.05em;
}


.app-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: clamp(34px, 3.2vw, 58px);
  padding: 18px 0 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.footer-separator {
  color: var(--border-strong);
}

.app-footer a {
  color: var(--muted);
}

.app-footer a:hover {
  color: var(--accent);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  max-width: min(380px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  color: var(--text-strong);
  background: var(--surface-2);
  box-shadow: var(--card-shadow);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity var(--pp-speed) ease, transform var(--pp-speed) ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.mobile-app-shell { display: none; }

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--sidebar-bg) 94%, transparent);
  backdrop-filter: blur(14px);
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-brand .logo-mark { width: 42px; height: 42px; border-radius: 13px; }
.mobile-brand-title { color: var(--text-strong); font-weight: 900; letter-spacing: -.04em; }
.mobile-brand-subtitle { color: var(--muted); font-size: 11px; font-weight: 750; }

.mobile-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  width: min(86vw, 340px);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: 22px 0 64px rgba(0,0,0,.28);
  transform: translateX(-104%);
  transition: transform var(--pp-speed) ease;
}

body.mobile-menu-open .mobile-drawer { transform: translateX(0); }
body.mobile-menu-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, .52);
}

.mobile-drawer-inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
}

.mobile-main {
  min-height: calc(100svh - 74px);
  display: flex;
  flex-direction: column;
  padding: 20px 16px 42px;
}

.mobile-main > .dashboard-grid {
  flex: 1 0 auto;
}
.mobile-actions-row { display: flex; gap: 10px; margin: 18px 0 4px; }
.mobile-actions-row .record-btn { flex: 1; }

@media (min-width: 2200px) {
  :root { --pp-max-content: 2180px; }
  .data-table { font-size: 16px; }
}

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .topbar-tools .icon-btn:not(:first-child) { display: none; }
}

@media (max-width: 980px) {
  :root { --pp-sidebar-width: 252px; }
  .user-name,
  .user-role { display: none; }
  .record-btn span { display: none; }
}

@media (max-width: 860px) {
  .desktop-app-shell { display: none; }
  .mobile-app-shell { display: block; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { text-align: left; }
  .page-title { font-size: 38px; letter-spacing: -.055em; }
  .page-subtitle { font-size: 14px; }
  .panel { padding: 16px; }
  .bar-chart { overflow-x: auto; }
  .login-shell { width: min(100%, 390px); margin-top: -5vh; }
  .login-side-note { left: 24px; bottom: 8vh; }
  .login-watermark { display: none; }
  .theme-toggle.login-theme-toggle { display: none; }
}

@media (max-width: 560px) {
  .login-page { padding: 18px; align-items: center; }
  .login-shell { width: 100%; padding: 30px 22px; }
  .login-brand { gap: 10px; margin-bottom: 30px; }
  .logo-mark { width: 48px; height: 48px; } .login-brand .logo-mark { width: 60px; height: 60px; }
  .brand-word { font-size: 35px; }
  .login-input { height: 56px; font-size: 16px; }
  .primary-btn { height: 58px; font-size: 19px; }
  .login-links { font-size: 15px; }
  .login-side-note { position: relative; left: auto; bottom: auto; margin-top: 24px; text-align: center; font-size: 16px; }
  .toast { right: 16px; bottom: 16px; }
  .data-table { min-width: 680px; }
}


/* Listing pages: Client Registry and Plot Inventory */
.page-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  border-radius: 12px;
  font-weight: 850;
  transition: transform var(--pp-speed) ease, filter var(--pp-speed) ease, background var(--pp-speed) ease, color var(--pp-speed) ease;
}

.secondary-btn {
  padding: 0 18px;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  box-shadow: 0 15px 38px rgba(22,132,71,.22);
  font-size: 15px;
}

.secondary-btn:hover {
  color: #fff;
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.ghost-btn {
  padding: 0 16px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  font-size: 14px;
}

.ghost-btn:hover {
  color: var(--text-strong);
  background: var(--surface-hover);
}

.listing-grid {
  display: grid;
  gap: clamp(18px, 1.5vw, 24px);
  margin-top: clamp(24px, 2.3vw, 36px);
}

.filter-panel {
  padding: clamp(18px, 1.5vw, 24px);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr .9fr auto;
  gap: 16px;
  align-items: end;
}

.filter-grid.clients {
  grid-template-columns: 1.25fr .95fr auto auto;
}

.form-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.form-field label {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 800;
}

.control,
.select-control {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  padding: 0 14px;
  color: var(--text);
  background: var(--input-bg, rgba(11, 26, 18, .88));
  transition: border-color var(--pp-speed) ease, box-shadow var(--pp-speed) ease, background var(--pp-speed) ease;
}

html[data-theme="light"] .control,
html[data-theme="light"] .select-control {
  background: rgba(255,255,255,.95);
}

.control::placeholder {
  color: var(--muted-2);
}

.control:focus,
.select-control:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--text);
  font-weight: 750;
  white-space: nowrap;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-deep);
}

.filter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.buyer-finance-card {
  margin-top: 1rem;
  overflow: hidden;
}

.agreement-schedule-card {
  margin-top: .5rem;
  overflow: hidden;
}

.buyer-finance-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(16px, 1.4vw, 22px);
}

.buyer-finance-header .title {
  margin: 0;
  font-size: clamp(20px, 1.5vw, 26px);
  letter-spacing: -0.045em;
}

.agreement-schedule-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(16px, 1.4vw, 22px);
}

.agreement-schedule-header .title {
  margin: 0;
  font-size: clamp(20px, 1.5vw, 26px);
}

.finance-live-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.buyer-finance-summary {
  display: grid;
  grid-template-columns: minmax(280px, .95fr) minmax(0, 1.55fr);
  gap: clamp(16px, 1.3vw, 22px);
}

.agreement-schedule-summary {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(0, 1.55fr);
  gap: clamp(16px, 1.3vw, 22px);
}

.finance-hero,
.finance-metric {
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-md);
  background: var(--surface-3);
}

.agreement-schedule-hero,
.agreement-schedule-metric {
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-md);
  background: var(--surface-3);
}

.finance-hero {
  position: relative;
  min-height: 224px;
  padding: clamp(18px, 1.45vw, 24px);
  overflow: hidden;
  background:
    radial-gradient(circle at 96% 10%, rgba(79, 216, 100, .16), transparent 34%),
    linear-gradient(135deg, rgba(22, 132, 71, .28), rgba(20, 37, 27, .96));
}

html[data-theme="light"] .finance-hero {
  background:
    radial-gradient(circle at 96% 10%, rgba(22, 132, 71, .12), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(238, 246, 240, .98));
}

.agreement-schedule-hero {
  min-height: 256px;
  padding: clamp(18px, 1.45vw, 24px);
  background:
    radial-gradient(circle at 96% 4%, rgba(246, 160, 52, .16), transparent 30%),
    linear-gradient(135deg, rgba(22, 132, 71, .24), rgba(20, 37, 27, .96));
}

html[data-theme="light"] .agreement-schedule-hero {
  background:
    radial-gradient(circle at 96% 4%, rgba(246, 160, 52, .14), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(239, 247, 241, .98));
}

.finance-hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.agreement-schedule-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.finance-icon,
.finance-metric-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #ffffff;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}

.finance-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  color: var(--accent);
}

.finance-chip {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--text-strong);
  background: rgba(255, 255, 255, .08);
  font-size: 12px;
  font-weight: 900;
}

html[data-theme="light"] .finance-chip {
  background: rgba(22, 132, 71, .1);
}

.finance-label {
  position: relative;
  z-index: 1;
  margin: 26px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.finance-amount {
  position: relative;
  z-index: 1;
  color: var(--text-strong);
  font-size: clamp(34px, 3vw, 48px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.065em;
}

.finance-progress {
  position: relative;
  z-index: 1;
  height: 9px;
  margin-top: 22px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .1);
}

html[data-theme="light"] .finance-progress {
  background: rgba(22, 132, 71, .12);
}

.finance-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

.finance-caption {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.agreement-deposit-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.agreement-deposit-pair > div {
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-sm);
  background: rgba(255, 255, 255, .055);
}

html[data-theme="light"] .agreement-deposit-pair > div {
  background: rgba(22, 132, 71, .055);
}

.agreement-deposit-pair span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.agreement-deposit-pair strong {
  display: block;
  color: var(--text-strong);
  font-size: clamp(17px, 1.15vw, 22px);
  font-weight: 900;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.agreement-schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 1vw, 16px);
}

.agreement-schedule-metric {
  min-height: 126px;
  padding: 15px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
}

.agreement-schedule-balance {
  grid-column: span 2;
  background:
    radial-gradient(circle at 96% 0%, rgba(79, 216, 100, .1), transparent 34%),
    var(--surface-3);
}

.agreement-schedule-metric .finance-metric-icon {
  grid-row: span 2;
}

.agreement-schedule-metric strong {
  min-width: 0;
  color: var(--text-strong);
  font-size: clamp(17px, 1.15vw, 23px);
  font-weight: 900;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.finance-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 1vw, 16px);
}

.finance-metric {
  min-height: 102px;
  padding: 15px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
}

.finance-metric-icon {
  grid-row: span 2;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--accent);
}

.finance-metric-label {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.finance-metric strong {
  min-width: 0;
  color: var(--text-strong);
  font-size: clamp(18px, 1.25vw, 24px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.finance-metric-warning .finance-metric-icon {
  color: var(--pp-amber);
  background: rgba(214, 150, 36, .14);
}

.finance-metric-success .finance-metric-icon {
  color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 1100px) {
  .buyer-finance-summary,
  .agreement-schedule-summary {
    grid-template-columns: 1fr;
  }

  .agreement-schedule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .buyer-finance-header,
  .agreement-schedule-header {
    flex-direction: column;
  }

  .finance-metric-grid,
  .agreement-schedule-grid,
  .agreement-deposit-pair {
    grid-template-columns: 1fr;
  }

  .agreement-schedule-balance {
    grid-column: auto;
  }
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.table-pager-info {
  min-width: 0;
  white-space: nowrap;
}

.table-pager-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.table-pager-actions .btn {
  min-width: 88px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-btn {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-3);
  font-weight: 750;
}

.page-btn:not(:disabled):hover {
  color: var(--text-strong);
  background: var(--surface-hover);
}

.page-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.status-pill.success {
  color: var(--accent);
  background: var(--accent-soft);
}

.status-pill.blue,
.info-pill.blue {
  color: var(--pp-blue);
  background: rgba(59,130,246,.12);
}

.status-pill.warning,
.info-pill.warning {
  color: var(--pp-amber);
  background: rgba(214,150,36,.14);
}

.status-pill.neutral {
  color: var(--muted);
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.muted-cell {
  color: var(--muted);
}

.mobile-record-list {
  display: none;
  gap: 12px;
  margin-top: 16px;
}

.record-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.record-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.record-title {
  color: var(--text-strong);
  font-weight: 900;
  letter-spacing: -.035em;
}

.record-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.record-meta {
  padding: 10px;
  border-radius: 13px;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.record-meta span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.record-meta strong {
  display: block;
  margin-top: 5px;
  color: var(--text-strong);
  font-size: 14px;
  overflow-wrap: anywhere;
}

@media (max-width: 1380px) {
  .filter-grid,
  .filter-grid.clients {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .page-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 860px) {
  .filter-grid,
  .filter-grid.clients {
    grid-template-columns: 1fr;
  }

  .checkbox-field {
    min-height: auto;
  }

  .desktop-table-area {
    display: none;
  }

  .mobile-record-list {
    display: grid;
  }
}

@media (max-width: 560px) {
  .record-grid {
    grid-template-columns: 1fr;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .secondary-btn,
  .page-actions .ghost-btn {
    flex: 1;
  }
}


/* Report and receipt page refinements */
.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 1.5vw, 24px);
  margin-top: clamp(24px, 2.3vw, 36px);
}
.report-card {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 1.45vw, 24px);
}
.report-card.wide { grid-column: 1 / -1; }
.report-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.report-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 14px 34px rgba(22,132,71,.22);
  flex: 0 0 auto;
}
.report-card h2 {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(18px, 1.05vw, 22px);
  font-weight: 900;
  letter-spacing: -.045em;
}
.report-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.report-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}
.report-form-row .form-field { min-width: min(100%, 180px); }
.mini-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-3);
}
.mini-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
  color: var(--text);
}
.mini-table th,
.mini-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.mini-table th:last-child,
.mini-table td:last-child { border-right: 0; }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table th {
  color: var(--table-head-text);
  background: var(--table-head-bg);
  font-weight: 900;
  white-space: nowrap;
}
.receipt-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.receipt-action-btn {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--accent);
  background: var(--surface-3);
}
.receipt-action-btn:hover {
  color: var(--text-strong);
  background: var(--surface-hover);
}
@media (max-width: 1180px) { .report-grid { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .report-grid { grid-template-columns: 1fr; }
  .report-card-header { align-items: center; }
  .report-form-row { display: grid; grid-template-columns: 1fr; }
  .mini-table-wrap { display: none; }
}


/* Activity Log + System Settings */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr);
  gap: clamp(18px, 1.5vw, 24px);
}

.settings-section {
  display: grid;
  gap: 18px;
}

.settings-card {
  padding: clamp(18px, 1.45vw, 24px);
}

.settings-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.settings-card-title {
  margin: 0;
  color: var(--text-strong);
  font-size: clamp(18px, 1.1vw, 22px);
  font-weight: 900;
  letter-spacing: -.045em;
}

.settings-card-text {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-grid.one {
  grid-template-columns: 1fr;
}

.textarea-control {
  width: 100%;
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  padding: 13px 14px;
  resize: vertical;
  color: var(--text);
  background: var(--surface-2);
}

.textarea-control:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.file-control {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface-3);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.settings-current-panel {
  margin: 18px 0 22px;
  padding: clamp(16px, 1.4vw, 22px);
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-md);
  background:
    radial-gradient(circle at 96% 0%, rgba(79, 216, 100, .08), transparent 32%),
    var(--surface-2);
}

.settings-current-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.settings-current-header .title {
  margin: 0;
  font-size: clamp(20px, 1.35vw, 25px);
}

.settings-current-state {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.settings-current-state.is-error {
  border-color: rgba(239, 68, 68, .34);
  color: #f87171;
  background: rgba(239, 68, 68, .1);
}

.settings-current-overview {
  display: grid;
  grid-template-columns: minmax(280px, .95fr) minmax(220px, .7fr) minmax(220px, .7fr);
  gap: 14px;
  align-items: stretch;
}

.settings-current-profile,
.settings-current-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-sm);
  background: var(--surface-3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

.settings-current-profile {
  display: grid;
  align-content: start;
  gap: 14px;
  grid-row: span 2;
  background:
    radial-gradient(circle at 0% 0%, rgba(79, 216, 100, .1), transparent 40%),
    var(--surface-3);
}

.settings-current-card {
  display: grid;
  align-content: start;
  gap: 12px;
}

.settings-current-card-wide {
  grid-column: span 2;
}

.settings-current-company {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.settings-current-avatar {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 15px;
  font-weight: 950;
}

.settings-current-company h3,
.settings-current-card h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 17px;
  font-weight: 950;
  line-height: 1.15;
}

.settings-current-company span {
  display: inline-flex;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.settings-current-label {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1.1;
  text-transform: uppercase;
}

.settings-current-card-head {
  display: grid;
  gap: 1px;
}

.settings-current-pair-grid,
.settings-current-email-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.settings-current-pair {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
}

.settings-current-pair span,
.settings-current-metric span,
.settings-current-schedule > div > span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  line-height: 1.15;
  text-transform: uppercase;
}

.settings-current-pair strong {
  display: block;
  min-width: 0;
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.settings-current-pair strong.is-muted {
  color: var(--muted-2);
}

.settings-current-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.settings-current-metric {
  min-width: 0;
  padding: 12px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(79, 216, 100, .06);
}

.settings-current-metric strong {
  display: block;
  color: var(--text-strong);
  font-size: clamp(17px, 1.15vw, 22px);
  font-weight: 950;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.settings-current-metric em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.settings-current-schedule {
  display: grid;
  gap: 10px;
}

.settings-current-schedule > div {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
}

.settings-current-schedule > div > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.settings-current-chip,
.settings-current-toggle-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  font-weight: 900;
  line-height: 1;
}

.settings-current-chip {
  padding: 0 9px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
}

.settings-current-chip.is-muted {
  color: var(--muted-2);
  background: var(--surface-2);
}

.settings-current-toggle-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-current-toggle-pill {
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11px;
  text-transform: uppercase;
}

.settings-current-toggle-pill span {
  color: var(--muted);
}

.settings-current-toggle-pill strong {
  color: var(--text-strong);
}

.settings-current-toggle-pill.is-on strong {
  color: var(--accent);
}

.settings-current-toggle-pill.is-off strong {
  color: var(--muted-2);
}

.settings-current-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.settings-current-group {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-sm);
  background: var(--surface-3);
}

.settings-current-group h3 {
  margin: 0 0 12px;
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 900;
}

.settings-current-group dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.settings-current-row {
  display: grid;
  gap: 3px;
}

.settings-current-row dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.settings-current-row dd {
  min-width: 0;
  margin: 0;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.settings-current-row dd.is-muted {
  color: var(--muted-2);
}

.settings-current-pill {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
}

.current-setting {
  margin: 6px 0 0;
  padding: 6px 8px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--pp-radius-sm) var(--pp-radius-sm) 0;
  color: var(--muted);
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.toggle-list {
  display: grid;
  gap: 12px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-3);
}

.toggle-row strong {
  display: block;
  color: var(--text-strong);
  font-size: 14px;
}

.toggle-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.switch {
  position: relative;
  width: 50px;
  height: 28px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: background .18s ease, border-color .18s ease;
}

.switch span::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  top: 2px;
  left: 3px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .18s ease, background .18s ease;
}

.switch input:checked + span {
  background: var(--accent-soft);
  border-color: var(--border-strong);
}

.switch input:checked + span::before {
  transform: translateX(20px);
  background: var(--accent);
}

.status-card {
  display: grid;
  gap: 14px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.status-row:last-child {
  border-bottom: 0;
}

.status-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.status-row strong {
  color: var(--text-strong);
  font-size: 14px;
  text-align: right;
}

.audit-details {
  max-width: 420px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audit-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 800;
}

.activity-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 1.2vw, 20px);
  margin-top: clamp(20px, 2vw, 28px);
}

.activity-summary-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.activity-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.activity-summary-card strong {
  display: block;
  margin-top: 10px;
  color: var(--text-strong);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -.05em;
}

@media (max-width: 1180px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-current-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-current-profile { grid-row: auto; }
  .settings-current-card-wide { grid-column: span 2; }
  .settings-current-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-card-header { display: grid; }
  .settings-current-header { display: grid; }
  .settings-current-overview,
  .settings-current-pair-grid,
  .settings-current-email-grid,
  .settings-current-metric-grid { grid-template-columns: 1fr; }
  .settings-current-card-wide { grid-column: auto; }
  .settings-current-grid { grid-template-columns: 1fr; }
  .activity-summary-grid { grid-template-columns: 1fr; }
  .audit-details { max-width: none; white-space: normal; }
}

/* App integration helpers: keep existing form and modal hooks usable with the enterprise shell. */
:root {
  --radius-lg: var(--pp-radius-lg);
  --shadow: var(--card-shadow);
}

.is-hidden { display: none !important; }

.control,
.select-control,
.input,
textarea.input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: 700 14px/1.2 var(--pp-font);
  padding: 11px 13px;
  outline: none;
  transition: border-color var(--pp-speed), box-shadow var(--pp-speed), background var(--pp-speed);
}

textarea.input,
.textarea-control {
  min-height: 96px;
  resize: vertical;
}

.input:focus,
textarea.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.label,
.form-field label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.help-tip,
.muted {
  color: var(--muted);
}

.error {
  color: var(--pp-red);
  font-weight: 800;
}

.success-msg {
  color: var(--accent);
  font-weight: 850;
}

.form-row {
  margin-bottom: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.full-width,
.form-grid .full-width {
  grid-column: 1 / -1;
}

.toolbar,
.save-row,
.pager,
.table-footer,
.pagination,
.callout-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.pager,
.table-footer {
  justify-content: space-between;
  margin-top: 18px;
}

.btn,
.btn-primary,
.btn-danger,
.btn-link,
.page-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-sm);
  padding: 0 16px;
  color: var(--text);
  background: var(--surface-2);
  font: 850 14px/1.1 var(--pp-font);
  text-decoration: none;
  text-align: center;
  vertical-align: middle;
  appearance: none;
  cursor: pointer;
  transition: transform var(--pp-speed), border-color var(--pp-speed), background var(--pp-speed), color var(--pp-speed);
}

.btn:hover,
.page-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.btn-primary,
.secondary-btn {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #061308;
}

html[data-theme="light"] .btn-primary,
html[data-theme="light"] .secondary-btn {
  color: #ffffff;
}

html[data-theme="light"] .btn-primary:hover,
html[data-theme="light"] .secondary-btn:hover {
  color: #ffffff;
}

.btn-danger {
  border-color: rgba(228, 72, 72, .32);
  color: #fff;
  background: rgba(228, 72, 72, .18);
}

.btn-link {
  min-height: auto;
  border: 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
}

.btn:disabled,
.page-btn:disabled {
  cursor: not-allowed;
  opacity: .58;
  transform: none;
}

.callout {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-md);
  background: var(--surface-2);
}

.callout-warning {
  border-color: rgba(214, 150, 36, .32);
  background: rgba(214, 150, 36, .10);
}

.callout-title {
  margin: 0 0 6px;
  color: var(--text-strong);
  font-weight: 900;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(8px);
}

.modal-backdrop.is-open {
  display: flex;
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-lg);
  background: var(--surface);
  box-shadow: var(--card-shadow);
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.badge,
.status-pill.alert-warning {
  color: var(--pp-amber);
  background: rgba(214, 150, 36, .14);
}

.badge-danger,
.status-pill.alert-danger {
  color: var(--pp-red);
  background: rgba(228, 72, 72, .14);
}

.badge-success {
  color: var(--accent);
  background: var(--accent-soft);
}

.desktop-table-area .data-table tr[data-id],
.desktop-table-area .data-table tr[data-href],
.data-table tr[data-id],
.data-table tr[data-href] {
  cursor: pointer;
}

body.enterprise-live {
  min-height: 100svh;
  background:
    radial-gradient(circle at 68% -10%, rgba(79, 216, 100, 0.08), transparent 28%),
    linear-gradient(180deg, var(--app-bg-soft), var(--app-bg));
  color: var(--text);
  font-family: var(--pp-font);
}

body.enterprise-live .app-shell {
  display: grid;
  grid-template-columns: var(--pp-sidebar-width) minmax(0, 1fr);
  min-height: 100svh;
  background: transparent;
}

body.enterprise-live .app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100svh;
  padding: clamp(26px, 2.7vw, 48px);
}

body.enterprise-live .app-footer {
  margin: auto auto 0;
  max-width: var(--pp-max-content) !important;
  width: 100%;
}

body.enterprise-live .container {
  max-width: var(--pp-max-content) !important;
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

body.enterprise-live .card {
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-lg);
  background: var(--surface);
  box-shadow: var(--card-shadow);
  padding: clamp(18px, 1.45vw, 24px);
  margin-bottom: clamp(18px, 1.8vw, 28px);
}

body.enterprise-live h1.title,
body.enterprise-live .container > div:first-child h1.title {
  color: var(--text-strong);
  font-size: clamp(34px, 3.2vw, 58px);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: .95;
}

body.enterprise-live h2.title {
  color: var(--text-strong);
  letter-spacing: -0.035em;
}

body.enterprise-live .container > div:first-child {
  margin: 0 0 clamp(20px, 2vw, 30px) !important;
}

body.enterprise-live .container > div:first-child > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.enterprise-live #logout-btn {
  display: none !important;
}

body.enterprise-live .topbar .icon-btn {
  color: var(--text);
  text-decoration: none;
}

body.enterprise-live .mobile-header {
  display: none;
}

body.enterprise-live .modal-card .title {
  font-size: 1.15rem !important;
  letter-spacing: -0.02em;
}

body.enterprise-live .table-responsive,
body.enterprise-live [style*="overflow-x: auto"] {
  border-radius: var(--pp-radius-md);
}

body.enterprise-live .data-table .money {
  font-weight: 900;
  color: var(--text-strong);
}

body.enterprise-live .update-method-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

body.enterprise-live .update-method-card {
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-md);
  background: color-mix(in srgb, var(--surface) 92%, var(--accent-soft));
  padding: 16px;
}

body.enterprise-live .update-method-card h3 {
  margin: 0 0 8px;
  color: var(--text-strong);
  font-size: 1rem;
}

body.enterprise-live .code-block {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-sm);
  background: color-mix(in srgb, var(--page-bg) 90%, #000);
  color: var(--text-strong);
  overflow-x: auto;
  white-space: pre;
}

body.enterprise-live .code-block code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

body.enterprise-live .data-table {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--pp-radius-md);
  background: var(--surface);
  color: var(--text);
}

body.enterprise-live .data-table th {
  background: var(--table-head-bg);
  color: var(--table-head-text);
}

body.enterprise-live .data-table td {
  color: var(--text);
  background: transparent;
}

body.enterprise-live .data-table tbody tr,
body.enterprise-live .data-table tbody tr:nth-child(odd),
body.enterprise-live .data-table tbody tr:nth-child(even) {
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, var(--accent-soft));
  color: var(--text);
}

body.enterprise-live .data-table tbody tr:hover,
body.enterprise-live .data-table tbody tr:nth-child(even):hover {
  background: var(--surface-hover);
}

body.enterprise-live .data-table tbody tr td,
body.enterprise-live .data-table tbody tr:nth-child(even) td {
  color: var(--text);
}

body.enterprise-live .data-table a {
  color: var(--accent);
}

body.enterprise-live .data-table a:hover {
  color: var(--text-strong);
}

html[data-theme="light"] body.enterprise-live .data-table tbody tr,
html[data-theme="light"] body.enterprise-live .data-table tbody tr:nth-child(odd),
html[data-theme="light"] body.enterprise-live .data-table tbody tr:nth-child(even) {
  background: #ffffff;
  color: var(--text);
}

html[data-theme="light"] body.enterprise-live .data-table tbody tr:hover,
html[data-theme="light"] body.enterprise-live .data-table tbody tr:nth-child(even):hover {
  background: var(--surface-hover);
}

@media (max-width: 760px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  body.enterprise-live .update-method-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  body.enterprise-live .app-shell {
    display: block;
    min-height: calc(100svh - 74px);
  }

  body.enterprise-live .app-shell > .sidebar {
    display: none;
  }

  body.enterprise-live .mobile-header {
    display: flex;
  }

  body.enterprise-live .app-main {
    min-height: calc(100svh - 74px);
    padding: 20px 16px 42px;
  }

  body.enterprise-live .shell-topbar {
    display: none;
  }

  body.enterprise-live h1.title,
  body.enterprise-live .container > div:first-child h1.title {
    font-size: 38px;
  }
}
