/* ===================================================
   ApexTrade PRO - Design System & Stylesheet
   (Balanced Dark & Eye-Friendly Soft Light Mode)
   =================================================== */

/* --- BALANCED DARK THEME (Midnight Slate) --- */
:root, [data-theme="dark"] {
  --bg-main: #0f172a;        /* Soft Slate 900 */
  --bg-header: rgba(15, 23, 42, 0.88);
  --bg-card: rgba(30, 41, 59, 0.72); /* Slate 800 */
  --bg-card-solid: #1e293b;
  --bg-input: rgba(15, 23, 42, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-highlight: rgba(99, 102, 241, 0.35);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --color-indigo: #6366f1;
  --color-indigo-glow: rgba(99, 102, 241, 0.35);
  --color-emerald: #10b981;
  --color-emerald-bg: rgba(16, 185, 129, 0.14);
  --color-emerald-glow: rgba(16, 185, 129, 0.3);
  
  --color-rose: #f43f5e;
  --color-rose-bg: rgba(244, 63, 94, 0.14);
  
  --color-amber: #f59e0b;
  --color-amber-bg: rgba(245, 158, 11, 0.14);
  --color-amber-glow: rgba(245, 158, 11, 0.3);

  --color-cyan: #06b6d4;
  --color-purple: #a855f7;

  --meter-track: rgba(255, 255, 255, 0.06);
  --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.45);
  --table-th-bg: rgba(15, 23, 42, 0.5);
  --table-hover: rgba(255, 255, 255, 0.025);
  --modal-overlay-bg: rgba(0, 0, 0, 0.75);

  --bg-gradient-radial: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.14) 0px, transparent 45%),
    radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.10) 0px, transparent 40%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.09) 0px, transparent 50%);
}

/* --- EYE-FRIENDLY SOFT LIGHT THEME (Clean Slate Frost) --- */
[data-theme="light"] {
  --bg-main: #f1f5f9;        /* Soft Slate 100 (Not blinding pure white) */
  --bg-header: rgba(248, 250, 252, 0.88);
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-solid: #ffffff;
  --bg-input: #f8fafc;
  --border-glass: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-highlight: rgba(99, 102, 241, 0.4);

  --text-main: #0f172a;       /* Slate 900 */
  --text-muted: #475569;      /* Slate 600 */
  --text-dim: #94a3b8;       /* Slate 400 */

  --color-indigo: #4f46e5;
  --color-indigo-glow: rgba(79, 70, 229, 0.25);
  --color-emerald: #059669;
  --color-emerald-bg: rgba(5, 150, 105, 0.1);
  --color-emerald-glow: rgba(5, 150, 105, 0.25);
  
  --color-rose: #e11d48;
  --color-rose-bg: rgba(225, 29, 72, 0.1);
  
  --color-amber: #d97706;
  --color-amber-bg: rgba(217, 119, 6, 0.1);
  --color-amber-glow: rgba(217, 119, 6, 0.25);

  --color-cyan: #0891b2;
  --color-purple: #9333ea;

  --meter-track: #e2e8f0;
  --shadow-main: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
  --table-th-bg: #f8fafc;
  --table-hover: rgba(241, 245, 249, 0.6);
  --modal-overlay-bg: rgba(15, 23, 42, 0.6);

  --bg-gradient-radial: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.07) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(245, 158, 11, 0.05) 0px, transparent 40%),
    radial-gradient(at 50% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
}

/* Constants */
:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 9999px;
  --glass-blur: blur(14px);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

body {
  background-color: var(--bg-main);
  background-image: var(--bg-gradient-radial);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- AUTH LOGIN SCREEN --- */
.auth-screen-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-header {
  text-align: center;
  margin-bottom: 26px;
}

.auth-logo {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-indigo), #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 24px var(--color-indigo-glow);
}

.auth-header h2 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.auth-header h2 span {
  background: linear-gradient(90deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-header p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
}

.input-with-icon .form-input {
  padding-left: 42px;
  padding-right: 42px;
}

.btn-eye-toggle {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
}

.btn-eye-toggle:hover {
  color: var(--text-main);
}

.auth-security-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--meter-track);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.auth-security-notice svg {
  color: var(--color-emerald);
  flex-shrink: 0;
}

.btn-full {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  margin-top: 6px;
}

.alert-error {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-rose-bg);
  border: 1px solid var(--color-rose);
  color: var(--color-rose);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
}

.main-app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* --- GLASS CARD --- */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  padding: 22px;
  position: relative;
}

/* --- TOP HEADER --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-glass);
  padding: 12px 20px;
}

.header-container {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--color-indigo), #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 16px var(--color-indigo-glow);
}

.brand-info h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-info h1 span {
  background: linear-gradient(90deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 0.9em;
}

.user-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- DESKTOP NAV TABS --- */
.desktop-nav {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-glass);
}

[data-theme="dark"] .desktop-nav {
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .nav-tab:hover {
  background: rgba(0, 0, 0, 0.05);
}

.nav-tab.active {
  background: linear-gradient(135deg, var(--color-indigo), #4f46e5);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 10px var(--color-indigo-glow);
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- THEME TOGGLE BUTTON --- */
.theme-btn {
  cursor: pointer;
  position: relative;
}

[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; color: var(--color-amber); }

[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; color: var(--color-indigo); }

.btn-logout-icon:hover {
  color: var(--color-rose);
  border-color: var(--color-rose);
}

.btn-logout-text {
  color: var(--color-rose) !important;
}

.btn-logout-text:hover {
  background: var(--color-rose-bg) !important;
  border-color: var(--color-rose) !important;
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  white-space: nowrap;
}

.btn-glow {
  background: linear-gradient(135deg, var(--color-indigo), #4f46e5);
  color: #fff;
  box-shadow: 0 0 16px var(--color-indigo-glow);
}

.btn-glow:hover {
  box-shadow: 0 0 22px var(--color-indigo-glow);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--color-indigo);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  border-color: var(--border-highlight);
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .btn-secondary:hover {
  background: #f8fafc;
}

.btn-pdf {
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #fff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.25);
}

.btn-pdf:hover {
  background: #be123c;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--color-rose-bg);
  color: var(--color-rose);
  border: 1px solid var(--color-rose);
}

.btn-danger:hover {
  background: var(--color-rose);
  color: #fff;
}

.btn-icon-only {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
  padding: 9px;
  border-radius: var(--radius-md);
}

.btn-icon-only:hover {
  border-color: var(--border-highlight);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--color-indigo);
}

/* --- MAIN WRAPPER & TAB CONTENT --- */
.main-wrapper {
  max-width: 1300px;
  margin: 20px auto 0;
  padding: 0 16px;
  width: 100%;
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 22px;
  animation: fadeInTab 0.22s ease-out;
}

.tab-content.active {
  display: flex;
}

@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- TARGET PROGRESS WIDGETS --- */
.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.target-card {
  padding: 20px 24px;
  overflow: hidden;
}

.card-daily::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--color-amber), #ea580c);
}

.card-monthly::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--color-emerald), var(--color-cyan));
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge-tag {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-amber {
  background: var(--color-amber-bg);
  color: var(--color-amber);
  border: 1px solid var(--color-amber);
}

.tag-emerald {
  background: var(--color-emerald-bg);
  color: var(--color-emerald);
  border: 1px solid var(--color-emerald);
}

.target-numbers {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
}

.cur-profit { color: var(--text-main); }
.goal-profit { color: var(--text-dim); }

.meter-bar {
  width: 100%;
  height: 12px;
  background: var(--meter-track);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 10px;
}

.meter-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.fill-amber {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 12px var(--color-amber-glow);
}

.fill-emerald {
  background: linear-gradient(90deg, #10b981, #06b6d4);
  box-shadow: 0 0 12px var(--color-emerald-glow);
}

.card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.status-badge {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-pending { background: var(--meter-track); color: var(--text-muted); }
.status-done { background: var(--color-emerald-bg); color: var(--color-emerald); border: 1px solid var(--color-emerald); }

/* --- METRICS GRID --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
}

.metric-card:hover {
  border-color: var(--border-highlight);
  transform: translateY(-2px);
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-indigo { background: rgba(99, 102, 241, 0.15); color: var(--color-indigo); }
.icon-emerald { background: var(--color-emerald-bg); color: var(--color-emerald); }
.icon-amber { background: var(--color-amber-bg); color: var(--color-amber); }
.icon-cyan { background: rgba(6, 182, 212, 0.15); color: var(--color-cyan); }

.metric-details { display: flex; flex-direction: column; }
.metric-title { font-size: 0.78rem; text-transform: uppercase; color: var(--text-muted); font-weight: 500; letter-spacing: 0.5px; }
.metric-val { font-size: 1.4rem; font-weight: 700; font-family: var(--font-mono); margin: 3px 0 2px; }
.metric-sub { font-size: 0.76rem; color: var(--text-dim); }
.metric-sub.positive { color: var(--color-emerald); font-weight: 600; }
.metric-sub.negative { color: var(--color-rose); font-weight: 600; }

/* --- CHART CARD --- */
.chart-card {
  padding: 22px;
}

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

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-title h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.chart-badge {
  font-size: 0.78rem;
  background: var(--meter-track);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
}

.chart-container {
  position: relative;
  height: 270px;
  width: 100%;
}

/* --- PRO TABLES --- */
.table-scroll-container {
  overflow-x: auto;
  margin-top: 8px;
}

.pro-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.87rem;
}

.pro-table th {
  background: var(--table-th-bg);
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-glass);
  text-transform: uppercase;
  font-size: 0.73rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.pro-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-glass);
  vertical-align: middle;
  white-space: nowrap;
}

.pro-table tbody tr:hover {
  background: var(--table-hover);
}

/* Badges inside table */
.dir-pill {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.72rem;
}

.dir-buy { background: var(--color-emerald-bg); color: var(--color-emerald); }
.dir-sell { background: var(--color-rose-bg); color: var(--color-rose); }

.status-pill {
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.st-win { background: var(--color-emerald-bg); color: var(--color-emerald); }
.st-loss { background: var(--color-rose-bg); color: var(--color-rose); }
.st-be { background: var(--meter-track); color: var(--text-muted); }

.pnl-cell {
  font-family: var(--font-mono);
  font-weight: 700;
}

.pnl-green { color: var(--color-emerald); }
.pnl-red { color: var(--color-rose); }
.pnl-gray { color: var(--text-muted); }

.notes-cell {
  max-width: 250px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-muted);
}

.btn-tbl-action {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.btn-tbl-action:hover {
  color: var(--color-rose);
}

/* --- REKAP TAB STYLES --- */
.rekap-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.rekap-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.segmented-control {
  display: flex;
  background: var(--meter-track);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-glass);
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s;
}

.seg-btn.active {
  background: var(--color-indigo);
  color: #fff;
  box-shadow: 0 2px 8px var(--color-indigo-glow);
}

.rekap-actions {
  display: flex;
  gap: 10px;
}

.rekap-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.stat-mini-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-mini-card .label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-mini-card h3 {
  font-size: 1.3rem;
  font-family: var(--font-mono);
  font-weight: 700;
}

.val-pnl { color: var(--color-emerald); }
.val-highlight { color: var(--color-amber); }

/* --- HISTORY CONTROLS --- */
.history-filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.search-item {
  flex: 2;
  min-width: 220px;
}

.filter-item {
  flex: 1;
  min-width: 140px;
}

/* --- SETTINGS & PAIR MANAGER --- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.settings-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.pair-add-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.pair-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pair-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--meter-track);
  border: 1px solid var(--border-glass);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--color-indigo);
}

.chip-del-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
}

.chip-del-btn:hover {
  color: var(--color-rose);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-indigo);
  box-shadow: 0 0 0 3px var(--color-indigo-glow);
}

.help-hint {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.file-upload-btn {
  cursor: pointer;
}

/* --- MODAL STYLES --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.modal-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px 22px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border-glass);
  background: var(--table-th-bg);
}

/* Calculator Highlight Box */
.calc-highlight-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  background: var(--table-th-bg);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-glass);
  margin-top: 14px;
}

.calc-res-item span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.calc-res-item h4 {
  font-size: 1.25rem;
  font-family: var(--font-mono);
  margin-top: 4px;
}

.text-emerald { color: var(--color-emerald); }
.text-amber { color: var(--color-amber); }

/* --- MOBILE BOTTOM NAVIGATION --- */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  background: var(--bg-header);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  padding: 8px 12px;
  z-index: 900;
  justify-content: space-around;
}

.mob-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-family);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}

.mob-tab.active {
  color: var(--color-indigo);
}

.mob-tab.active svg {
  stroke: var(--color-indigo);
}

/* --- EMPTY PLACEHOLDER --- */
.empty-placeholder {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-dim);
}

.empty-placeholder p {
  margin-top: 8px;
  font-size: 0.9rem;
}

.hidden { display: none !important; }

/* ===================================================
   PDF REPORT TEMPLATE STYLING (For html2pdf.js)
   =================================================== */
.pdf-template-wrapper {
  background: #ffffff;
  color: #1f2937;
  padding: 30px;
  font-family: Arial, sans-serif;
  width: 800px;
}

.pdf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #6366f1;
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.pdf-brand h2 {
  font-size: 18px;
  color: #1e1b4b;
  margin-bottom: 4px;
}

.pdf-brand p {
  font-size: 13px;
  color: #6366f1;
  font-weight: bold;
}

.pdf-meta p {
  font-size: 12px;
  color: #4b5563;
  margin-bottom: 2px;
}

.pdf-summary-grid {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.pdf-sum-card {
  flex: 1;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 12px;
}

.pdf-sum-card span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  color: #6b7280;
  font-weight: bold;
}

.pdf-sum-card strong {
  display: block;
  font-size: 15px;
  color: #111827;
  margin-top: 2px;
}

.pdf-section-title {
  font-size: 14px;
  margin-bottom: 10px;
  color: #111827;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 4px;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 20px;
}

.pdf-table th {
  background: #e0e7ff;
  color: #3730a3;
  padding: 8px 6px;
  text-align: left;
  border: 1px solid #c7d2fe;
}

.pdf-table td {
  padding: 7px 6px;
  border: 1px solid #e5e7eb;
}

.pdf-footer {
  text-align: center;
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
  font-size: 10px;
  color: #9ca3af;
}

/* ===================================================
   RESPONSIVE MEDIA QUERIES
   =================================================== */
@media (max-width: 860px) {
  .desktop-nav { display: none; }
  .mobile-bottom-nav { display: flex; }
  .user-tag { display: none; }
  .btn-text { display: none; }
  .btn-glow { padding: 9px 12px; }
  .rekap-header-bar { flex-direction: column; align-items: stretch; }
  .rekap-controls { flex-direction: column; align-items: stretch; }
  .rekap-actions { width: 100%; }
  .rekap-actions .btn { flex: 1; }
}

@media (max-width: 480px) {
  .target-grid { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 14px; gap: 10px; }
  .metric-icon { width: 38px; height: 38px; }
  .metric-val { font-size: 1.15rem; }
  .settings-grid { grid-template-columns: 1fr; }
}
