/* ═══════════════════════════════════════════════════════════════════
   APP SHELL DESIGN SYSTEM — PT. SARASWANTI SAWIT MAKMUR
   Executive Plantation Intelligence UI / Mobile & Desktop Master Shell
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --primary: #064e3b;
  --primary-light: #047857;
  --primary-dark: #022c22;
  --accent: #d97706;
  --accent-light: #f59e0b;
  --emerald: #10b981;
  --teal: #0d9488;
  --sky: #0284c7;
  --rose: #e11d48;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --sidebar-bg: #041d16;
  --sidebar-card: #082920;
  --sidebar-hover: #0c382c;
  --sidebar-border: rgba(16, 185, 129, 0.12);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --sb-width: 260px;
  --sb-collapsed: 74px;
  --hdr-height: 70px;
}

/* ─────────────────────────────────────────────────────────────────
   1. LOGIN GATE — MODERN SPLIT SCREEN & GLASS CARD
   ───────────────────────────────────────────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  background: #021a13;
  color: #fff;
  font-family: var(--font-sans);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-screen.show {
  opacity: 1;
  pointer-events: auto;
}

.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.45;
  animation: floatBlobs 20s infinite alternate ease-in-out;
}

.login-blob.b1 {
  width: 500px;
  height: 500px;
  background: #047857;
  top: -100px;
  left: -100px;
}

.login-blob.b2 {
  width: 450px;
  height: 450px;
  background: #065f46;
  bottom: -120px;
  right: 20%;
  animation-duration: 26s;
}

.login-blob.b3 {
  width: 350px;
  height: 350px;
  background: #d97706;
  top: 40%;
  right: -80px;
  opacity: 0.25;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

@keyframes floatBlobs {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
  100% { transform: translate(-30px, 35px) scale(0.95); }
}

.login-hero {
  flex: 1.2;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.login-hero-inner {
  max-width: 520px;
  z-index: 2;
}

.login-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #6ee7b7;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-bottom: 24px;
}

.login-hero-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.login-hero-title {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  color: #f8fafc;
}

.login-hero-title span {
  background: linear-gradient(135deg, #34d399, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-hero-text {
  font-size: 16px;
  line-height: 1.6;
  color: #94a3b8;
  margin-bottom: 32px;
}

.login-hero-points {
  display: flex;
  gap: 24px;
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 24px;
}

.login-hero-points li {
  font-size: 13px;
  color: #cbd5e1;
  font-weight: 500;
}

.login-hero-points li span {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.login-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  position: relative;
  z-index: 3;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(8, 39, 31, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  text-align: left;
}

.login-logo {
  width: 58px;
  height: 58px;
  background: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  padding: 6px;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #34d399;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
  margin-bottom: 6px;
}

.login-sub {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 24px;
}

.login-card .fl {
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: block;
}

.login-input {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.login-input .li-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  stroke: #64748b;
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}

.login-input .fc {
  width: 100%;
  background: rgba(2, 26, 19, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  padding: 13px 44px 13px 42px;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.login-input .fc:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
  background: rgba(2, 26, 19, 0.95);
}

.login-input .li-toggle {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: color 0.15s;
}

.login-input .li-toggle:hover {
  color: #cbd5e1;
}

.login-input .li-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.login-card .err {
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12px;
  margin-bottom: 16px;
  font-weight: 500;
}

.login-card .btn-block {
  width: 100%;
  padding: 13px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-card .btn-block:hover {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.login-card .btn-block:active {
  transform: translateY(0);
}

.login-foot {
  text-align: center;
  font-size: 11px;
  color: #64748b;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .login-hero { display: none; }
  .login-panel { padding: 20px; }
  .login-card { padding: 32px 24px; }
}

/* ─────────────────────────────────────────────────────────────────
   2. APP LAYOUT STRUCTURE
   ───────────────────────────────────────────────────────────────── */
.layout-wrapper {
  display: flex;
  min-height: 100vh;
  background: #f1f5f9;
  font-family: var(--font-sans);
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding-left: var(--sb-width);
}

.layout-wrapper.sb-collapsed .main-wrap {
  padding-left: var(--sb-collapsed);
}

/* ─────────────────────────────────────────────────────────────────
   3. SIDEBAR NAVIGATION
   ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sb-width);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  color: #e2e8f0;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  user-select: none;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-height: var(--hdr-height);
  box-sizing: border-box;
}

.sb-logo {
  width: 38px;
  height: 38px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.sb-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sb-brand-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #f8fafc;
}

.sb-brand-text span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: #34d399;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.sb-close {
  display: none;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.sb-close svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Sidebar Search */
.sb-search {
  padding: 12px 16px;
  position: relative;
  display: flex;
  align-items: center;
}

.sb-search svg {
  position: absolute;
  left: 28px;
  width: 15px;
  height: 15px;
  stroke: #64748b;
  fill: none;
  stroke-width: 2;
  pointer-events: none;
}

.sb-search input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 8px 36px 8px 34px;
  color: #fff;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}

.sb-search input:focus {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(52, 211, 153, 0.4);
}

.sb-search input::placeholder {
  color: #64748b;
}

.sb-kbd {
  position: absolute;
  right: 26px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  color: #94a3b8;
  font-family: var(--font-mono);
  pointer-events: none;
}

/* Nav Menu Side */
.nav-side {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 10px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.nav-side::-webkit-scrollbar {
  width: 5px;
}
.nav-side::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 99px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #5eead4;
  opacity: 0.6;
  padding: 14px 10px 6px 10px;
  white-space: nowrap;
}

.nav-side .nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  text-shadow: none !important;
}

.nav-side .nav-btn .nb-icon {
  font-size: 16px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-side .nav-btn .nb-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

.nav-side .nav-btn .nb-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

.nav-side .nav-btn:hover {
  background: var(--sidebar-hover);
  color: #f1f5f9;
}

.nav-side .nav-btn.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.22), rgba(16, 185, 129, 0.06));
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-weight: 700;
}

.nav-side .nav-btn.active::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 4px;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
}

/* Sidebar Footer */
.sb-footer {
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 6px;
}

.sb-foot-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.sb-foot-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.sb-foot-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Collapsed Sidebar Mode (Desktop) */
.layout-wrapper.sb-collapsed .sidebar {
  width: var(--sb-collapsed);
}

.layout-wrapper.sb-collapsed .sb-brand-text,
.layout-wrapper.sb-collapsed .sb-search,
.layout-wrapper.sb-collapsed .nav-section-title,
.layout-wrapper.sb-collapsed .nav-side .nav-btn .nb-label,
.layout-wrapper.sb-collapsed .nav-side .nav-btn .nb-badge,
.layout-wrapper.sb-collapsed .sb-footer span {
  display: none !important;
}

.layout-wrapper.sb-collapsed .sb-brand {
  justify-content: center;
  padding: 16px 0;
}

.layout-wrapper.sb-collapsed .nav-side .nav-btn {
  justify-content: center;
  padding: 10px 0;
}

.layout-wrapper.sb-collapsed .sb-collapse svg {
  transform: rotate(180deg);
}

/* ─────────────────────────────────────────────────────────────────
   4. HEADER — GLASSMORPHISM & DYNAMIC STATUS
   ───────────────────────────────────────────────────────────────── */
.hdr {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--surface-border);
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  transition: transform 0.25s ease;
}

.hdr.hdr-hidden {
  transform: translateY(-100%);
}

.hdr-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 28px;
  min-height: var(--hdr-height);
  box-sizing: border-box;
}

.hdr-menu {
  display: none;
}

.hdr-title {
  flex: 1;
  min-width: 0;
}

.hdr-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.hdr-eyebrow .sep {
  color: var(--text-subtle);
}

.hdr-eyebrow .co {
  color: var(--primary);
  font-weight: 700;
}

.hdr-title h1 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
  line-height: 1.2;
  margin: 0;
}

.hdr-title p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin: 2px 0 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Header Actions */
.hdr-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: #ffffff;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
  background: var(--surface-subtle);
  border-color: #cbd5e1;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.hdr-refresh {
  width: auto;
  padding: 0 14px;
  gap: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
}

.hdr-refresh.spinning svg {
  animation: spinRef 0.9s infinite linear;
}

@keyframes spinRef {
  100% { transform: rotate(360deg); }
}

.hdr-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hdr-btns .btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: #ffffff;
  color: var(--text-main);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.hdr-btns .btn-icon:hover {
  background: var(--surface-subtle);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.hdr-btns .btn-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.hdr-btns .hdr-logout {
  color: var(--rose);
  border-color: rgba(225, 29, 72, 0.2);
}

.hdr-btns .hdr-logout:hover {
  background: rgba(225, 29, 72, 0.05);
}

.hdr-more {
  display: none;
}

/* Header Live KPI Stats Bar */
.hdr-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 28px 10px 28px;
  border-top: 1px solid rgba(226, 232, 240, 0.6);
  background: rgba(248, 250, 252, 0.8);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.hstat {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
}

.hstat span:first-child {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.hstat span:last-child {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─────────────────────────────────────────────────────────────────
   5. SLICER BAR (FILTER BULAN)
   ───────────────────────────────────────────────────────────────── */
.content-slicer-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--surface-border);
  position: sticky;
  top: 0;
  z-index: 45;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  transition: top 0.2s ease;
}

.content-slicer-bar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.slicer-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.slicer-label svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ─────────────────────────────────────────────────────────────────
   6. MAIN VIEWPORT & CARDS
   ───────────────────────────────────────────────────────────────── */
.main {
  padding: 24px 28px 60px 28px;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.main.tk-full-width {
  max-width: none;
  padding-left: 28px;
  padding-right: 28px;
}

/* ─────────────────────────────────────────────────────────────────
   7. MOBILE BOTTOM NAV & FAB
   ───────────────────────────────────────────────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 75;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--surface-border);
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)) 12px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
  justify-content: space-around;
  align-items: center;
}

.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 58px;
}

.bn-item .bn-icon {
  font-size: 18px;
  line-height: 1;
}

.bn-item.active {
  color: var(--primary);
  font-weight: 800;
}

.bn-item.active .bn-icon {
  transform: translateY(-2px);
}

.fab-top {
  position: fixed;
  bottom: 74px;
  right: 18px;
  z-index: 70;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--surface-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.fab-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.fab-top svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
}

/* Sidebar Backdrop on Mobile */
.sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 79;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sb-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* ─────────────────────────────────────────────────────────────────
   8. RESPONSIVE BREAKPOINTS (MOBILE & TABLET EXCELLENCE)
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .main-wrap {
    padding-left: 0 !important;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.sb-open {
    transform: translateX(0);
  }

  .sb-close {
    display: inline-flex;
  }

  .sb-backdrop {
    display: block;
  }

  .sb-collapse,
  .sb-footer {
    display: none;
  }

  .hdr-menu {
    display: inline-flex;
  }

  .hdr-top {
    padding: 10px 18px;
  }

  .main {
    padding: 16px 18px 70px 18px;
  }
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
  }

  .hdr-stats {
    padding: 6px 14px 8px 14px;
    gap: 14px;
  }

  .hdr-refresh .lbl {
    display: none;
  }

  .hdr-btns {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 14px;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 8px;
    box-shadow: var(--shadow-xl);
    z-index: 90;
    min-width: 170px;
  }

  .hdr-btns.show {
    display: flex;
  }

  .hdr-btns .btn-icon {
    width: 100%;
    justify-content: flex-start;
  }

  .hdr-more {
    display: inline-flex;
  }

  .main {
    padding: 12px 14px 80px 14px;
  }

  .hdr-title h1 {
    font-size: 15px;
  }

  .hdr-title p {
    font-size: 10px;
  }
}

/* ─────────────────────────────────────────────────────────────────
   9. INTERACTIVE TABLE TOOLBAR & AUTO-FIT CONTROLLER
   ───────────────────────────────────────────────────────────────── */
.hdr-tbl-ctrl {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hdr-tbl-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: #047857;
  color: #ffffff;
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 999px;
  border: 1.5px solid #ffffff;
  line-height: 1;
  font-family: var(--font-mono);
}

.tbl-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid var(--surface-border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 6px 10px;
  font-family: var(--font-sans);
  font-size: 11px;
  user-select: none;
  transition: all 0.2s ease;
}

.tbl-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tbl-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: #ffffff;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.tbl-tool-btn:hover {
  background: #f1f5f9;
  color: var(--text-primary);
}

.tbl-tool-btn.active {
  background: #047857;
  color: #ffffff;
  border-color: #047857;
  box-shadow: 0 1px 3px rgba(4, 120, 87, 0.3);
}

.tbl-tool-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.tbl-hint-text {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tbl-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.tbl-font-box {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  gap: 2px;
}

.tbl-font-lbl {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tbl-font-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.12s ease;
  padding: 0;
}

.tbl-font-btn:hover {
  background: #f1f5f9;
  border-color: var(--surface-border);
}

.tbl-font-val {
  padding: 2px 6px;
  font-size: 10.5px;
  font-weight: 800;
  color: #047857;
  font-family: var(--font-mono);
  cursor: pointer;
  border: none;
  background: transparent;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.tbl-font-val:hover {
  background: #ecfdf5;
}

.tbl-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border);
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.tbl-more-btn:hover {
  background: #f1f5f9;
}

/* Connect toolbar to table wrapper cleanly */
.tbl-toolbar + .tbl-wrap,
.tbl-toolbar + .yield-table-wrapper,
.tbl-toolbar + [id$="-tbl-wrap"] {
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  border-top: 1px solid var(--surface-border) !important;
}

/* Modal Table Settings */
.tbl-modal-content {
  max-width: 520px;
  border-radius: var(--radius-xl);
  padding: 24px;
}

.tbl-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
  position: relative;
}

.tbl-modal-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  color: #047857;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid rgba(4, 120, 87, 0.15);
}

.tbl-modal-header h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.tbl-modal-header p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.tbl-modal-section {
  margin-bottom: 20px;
}

.tbl-sec-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.tbl-mode-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tbl-mode-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--surface-border);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  font-family: inherit;
}

.tbl-mode-card:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.tbl-mode-card.active {
  border-color: #047857;
  background: #f0fdf4;
  box-shadow: 0 2px 8px rgba(4, 120, 87, 0.12);
}

.tbl-mode-card .tm-icon {
  font-size: 20px;
  line-height: 1;
  padding-top: 2px;
}

.tbl-mode-card .tm-info strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.tbl-mode-card.active .tm-info strong {
  color: #047857;
}

.tbl-mode-card .tm-info span {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.tbl-font-scales {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.tbl-font-pill {
  flex: 1;
  min-width: 48px;
  text-align: center;
  font-size: 11px;
  padding: 7px 4px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.tbl-font-slider-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  gap: 12px;
}

.tbl-current-font {
  font-size: 16px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #047857;
}

.tbl-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-border);
}
