:root {
  --navy: #0a1824;
  --navy-deep: #061018;
  --surface: #0f2234;
  --surface-hover: #132a3e;
  --ink: #071018;
  --emerald: #10d9a0;
  --emerald-bright: #1fe8b0;
  --emerald-deep: #0bbb88;
  --text: #e8f4ef;
  --text-soft: #c5d4cf;
  --muted: #8aa39a;
  --faint: #5a7871;
  --border: #1a2f3f;
  --border-bright: #2a4558;
  --border-soft: rgba(16, 217, 160, 0.08);
  --display: 'Orbitron', 'Russo One', 'Arial Black', system-ui, sans-serif;
  --sans: 'Manrope', 'IBM Plex Sans Thai', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--navy);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(16, 217, 160, 0.10), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  background-attachment: fixed;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(45deg, rgba(16, 217, 160, 0.04) 1px, transparent 1px),
    linear-gradient(-45deg, rgba(16, 217, 160, 0.04) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0.1));
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; position: relative; z-index: 1; }
.font-display { font-family: var(--display); letter-spacing: -0.01em; text-transform: uppercase; }
.font-mono { font-family: var(--mono); }
.accent { color: var(--emerald); display: inline-block; transform: skewX(-10deg); font-weight: 900; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgba(16, 217, 160, 0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(16, 217, 160, 0.5); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px;
  font-weight: 600; font-size: 14px; cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s var(--ease-out);
  font-family: var(--sans);
}
.btn-primary { background: var(--emerald); color: var(--ink); }
.btn-primary:hover { background: var(--emerald-bright); transform: translateY(-1px);
  box-shadow: 0 10px 30px -10px rgba(16, 217, 160, 0.5); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-bright); }
.btn-secondary:hover { background: var(--surface); border-color: var(--emerald); }
.btn-danger { background: rgba(207, 79, 79, 0.15); color: #e88; border: 1px solid rgba(207, 79, 79, 0.3); }
.btn-danger:hover { background: rgba(207, 79, 79, 0.3); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.card h3 { font-family: var(--display); font-size: 16px; margin-bottom: 12px; letter-spacing: 0.05em; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px;
  color: var(--faint); text-transform: uppercase; font-weight: 500;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.tbl td { padding: 12px; border-bottom: 1px solid var(--border); color: var(--text-soft); }
.tbl tr:hover td { background: rgba(16, 217, 160, 0.03); }

/* Form */
.field { margin-bottom: 16px; }
.field label, .field-label {
  display: block; font-family: var(--mono); font-size: 11px;
  color: var(--emerald); letter-spacing: 1.5px; text-transform: uppercase;
  margin-bottom: 6px; font-weight: 500;
}
/* Catch bare <input> (no type attr defaults to text) plus every text-like type */
.input,
input:not([type]),
input[type=text],
input[type=number],
input[type=email],
input[type=password],
input[type=search],
input[type=url],
input[type=tel],
input[type=date],
input[type=time],
input[type=datetime-local],
input[type=month],
input[type=week],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, background-color .15s;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.input:focus, input:focus, textarea:focus, select:focus {
  border-color: rgba(16, 217, 160, 0.4);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(16, 217, 160, 0.08);
}

input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }

/* Dropdown chevron (we disabled native appearance above) */
select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238aa39a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
select:focus {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2310d9a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
}
select option { background: var(--surface); color: var(--text); }

/* Number spinners — keep functional but less visually obtrusive on dark bg */
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  opacity: 0.5;
  filter: invert(0.7);
}
input[type=number]:hover::-webkit-inner-spin-button { opacity: 1; }

/* Range slider — dark-theme friendly */
input[type=range] { accent-color: var(--emerald); height: 6px; }

/* Disabled state */
input:disabled, textarea:disabled, select:disabled {
  opacity: 0.5; cursor: not-allowed;
}

/* File inputs — dress up the "Choose File" button so it doesn't break the look */
input[type=file] {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.35); border: 1px dashed rgba(16, 217, 160, 0.25);
  color: var(--muted); font-family: var(--mono); font-size: 12px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
input[type=file]:hover { border-color: rgba(16, 217, 160, 0.5); background: rgba(0, 0, 0, 0.45); }
input[type=file]::file-selector-button {
  padding: 6px 12px; margin-right: 12px; border: 0; border-radius: 6px;
  background: rgba(16, 217, 160, 0.15); color: var(--emerald-bright);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase;
  cursor: pointer; transition: background .15s;
}
input[type=file]::file-selector-button:hover { background: rgba(16, 217, 160, 0.25); }

/* Checkbox & radio — dark-theme accent */
input[type=checkbox], input[type=radio] {
  width: 16px; height: 16px; accent-color: var(--emerald); cursor: pointer;
  vertical-align: middle;
}

.badge {
  display: inline-block; font-family: var(--mono); font-size: 10px;
  padding: 3px 8px; border-radius: 4px; letter-spacing: 1px;
  background: rgba(16, 217, 160, 0.1); color: var(--emerald);
}
.badge-gray { background: rgba(138, 163, 154, 0.15); color: var(--muted); }
.badge-red { background: rgba(207, 79, 79, 0.15); color: #e88; }

/* App shell (for /app and /admin) */
.app-shell { height: 100vh; display: flex; overflow: hidden; }
.side-bar {
  width: 64px; flex-shrink: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; background: var(--navy-deep);
  border-right: 1px solid var(--border-soft);
}
.side-bar .logo-mark {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy); box-shadow: 0 0 0 1px rgba(16, 217, 160, 0.25);
  margin-bottom: 16px;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; width: 100%; align-items: center; }
.nav-btn {
  width: 44px; height: 44px; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--faint); cursor: pointer;
  transition: all .15s;
}
.nav-btn:hover { background: rgba(16, 217, 160, 0.08); color: var(--text-soft); }
.nav-btn.active { background: rgba(16, 217, 160, 0.14); color: var(--emerald-bright); }
.top-header {
  height: 56px; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10, 24, 36, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.crumb {
  font-family: var(--display); font-size: 11px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase;
}
.crumb .sep { color: var(--faint); margin: 0 8px; }
.crumb .current { color: var(--text-soft); }
.app-main { flex: 1; overflow-y: auto; position: relative; }
.app-container { padding: 32px; max-width: 1200px; margin: 0 auto; }
.page-header { margin-bottom: 28px; }
.page-header h1 {
  font-family: var(--display); font-size: clamp(28px, 3vw, 42px);
  font-weight: 900; letter-spacing: -0.01em; line-height: 1;
  text-transform: uppercase; margin-bottom: 8px;
}
.page-header .eyebrow {
  font-family: var(--mono); font-size: 11px; color: var(--emerald);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 10px;
  display: inline-block;
}
.page-header .sub { color: var(--muted); font-size: 14px; }

/* Stats grid (dashboard) */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.stat-card .label {
  font-family: var(--mono); font-size: 10px; color: var(--faint);
  letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 8px;
}
.stat-card .value {
  font-family: var(--display); font-size: 30px; font-weight: 900;
  color: var(--text); letter-spacing: -0.01em;
}
.stat-card .value.emerald { color: var(--emerald-bright); }
.stat-card .hint { color: var(--muted); font-size: 12px; margin-top: 4px; font-family: var(--mono); }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

@media (max-width: 780px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Flash messages */
.flash {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px;
  font-size: 13px; border: 1px solid transparent;
}
.flash-ok { background: rgba(16, 217, 160, 0.1); border-color: rgba(16, 217, 160, 0.3); color: var(--emerald-bright); }
.flash-err { background: rgba(207, 79, 79, 0.1); border-color: rgba(207, 79, 79, 0.3); color: #e88; }
