/* =========================================================
   AFSFF One-Page CMS — Admin Stylesheet
   Brand tokens: ocean #00274D | teal #00A896 | coral #E8735A | sand #F2E8D5
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w:   260px;
  --topbar-h:    60px;
  --navy:        #00274D;
  --navy-deep:   #001a34;
  --navy-light:  #0a3a60;
  --teal:        #00A896;
  --teal-dark:   #008070;
  --coral:       #E8735A;
  --coral-dark:  #c4573e;
  --sand:        #F2E8D5;
  --white:       #ffffff;
  --bg:          #f0f4f8;
  --card-bg:     #ffffff;
  --border:      #dde3ea;
  --text:        #1a2535;
  --text-mid:    #5a6a7e;
  --text-light:  #8a9ab0;
  --success:     #2da44e;
  --error:       #cf222e;
  --warning:     #d4a017;
  --r:           8px;
  --r-lg:        12px;
  --shadow:      0 1px 3px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

/* ── AUTH PAGES ─────────────────────────────── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
}

.auth-card {
  background: var(--white);
  border-radius: var(--r-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.75rem;
}

.logo-mark {
  width: 44px;
  height: 44px;
  background: var(--teal);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -.5px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}
.logo-text span { display: block; font-weight: 400; font-size: .8rem; color: var(--text-mid); }

.auth-title { font-size: 1.35rem; font-weight: 700; margin-bottom: .35rem; }
.auth-sub   { font-size: .82rem; color: var(--text-mid); margin-bottom: 1.5rem; }
.auth-sub code { background: var(--bg); padding: .1em .4em; border-radius: 4px; font-size: .82em; }

/* ── SHELL ──────────────────────────────────── */
.admin-shell { display: flex; min-height: 100vh; }

/* ── SIDEBAR ────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo .logo-text { color: #fff; }
.sidebar-logo .logo-text span { color: rgba(255,255,255,.55); }

.sidebar-nav { flex: 1; padding: .75rem 0; }

.nav-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: 1rem 1.25rem .3rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .62rem 1.25rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .875rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active {
  background: rgba(0,168,150,.15);
  color: var(--teal);
  border-left-color: var(--teal);
}
.sidebar-nav a .nav-icon { font-size: 1rem; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: rgba(255,255,255,.55);
  font-size: .82rem;
  text-decoration: none;
  padding: .4rem 0;
}
.sidebar-footer a:hover { color: var(--coral); }

/* ── MAIN CONTENT ───────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 1rem; font-weight: 600; color: var(--navy); }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.topbar-user { font-size: .8rem; color: var(--text-mid); }

.content { padding: 2rem; flex: 1; }

/* ── ALERTS ─────────────────────────────────── */
.alert {
  padding: .8rem 1rem;
  border-radius: var(--r);
  margin-bottom: 1.25rem;
  font-size: .875rem;
  font-weight: 500;
}
.alert-success { background: #d3f4e0; color: #1a6335; border-left: 4px solid var(--success); }
.alert-error   { background: #fde8e9; color: #8b1a1f; border-left: 4px solid var(--error); }
.alert-info    { background: #e0f0ff; color: #0c3b6e; border-left: 4px solid var(--teal); }
.alert-warning { background: #fff7e0; color: #7a5c00; border-left: 4px solid var(--warning); }

/* ── CARDS ──────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.5rem; }

/* ── DASHBOARD GRID ─────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--card-bg);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-label { font-size: .75rem; color: var(--text-mid); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .3rem; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-card .stat-sub   { font-size: .75rem; color: var(--text-light); margin-top: .25rem; }

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.section-card {
  background: var(--card-bg);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.section-card .section-icon { font-size: 2rem; }
.section-card h3 { font-size: .95rem; font-weight: 700; color: var(--navy); }
.section-card p  { font-size: .82rem; color: var(--text-mid); flex: 1; }

/* ── TABLES ─────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-mid);
  padding: .65rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}
td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

.tag-badge {
  display: inline-block;
  background: rgba(0,168,150,.1);
  color: var(--teal-dark);
  font-size: .7rem;
  font-weight: 600;
  padding: .15rem .5rem;
  border-radius: 20px;
  margin: .1rem;
}
.tag-badge.coral { background: rgba(232,115,90,.1); color: var(--coral-dark); }

/* ── FORMS ──────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: .4rem;
}
.form-label .optional { font-weight: 400; color: var(--text-light); }
.form-label .sw-label { color: var(--teal-dark); font-weight: 400; font-size: .75rem; margin-left: .25rem; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: .875rem;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0,168,150,.15);
}
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint { font-size: .75rem; color: var(--text-light); margin-top: .3rem; }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

.bilingual-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.bilingual-group .lang-tag {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .15rem .45rem;
  border-radius: 4px;
  margin-left: .4rem;
}
.lang-en { background: rgba(0,39,77,.08); color: var(--navy); }
.lang-sw { background: rgba(0,168,150,.1); color: var(--teal-dark); }

/* Range input */
input[type="range"] { width: 100%; accent-color: var(--teal); }

/* ── BUTTONS ────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--r);
  padding: .65rem 1.25rem;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-primary:hover { background: var(--teal-dark); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: .62rem 1.2rem;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.btn-secondary:hover { border-color: var(--navy); background: #f8fafc; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: #fde8e9;
  color: var(--error);
  border: 1.5px solid #f5c2c4;
  border-radius: var(--r);
  padding: .45rem .9rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-danger:hover { background: #f5c2c4; }

.btn-sm   { padding: .4rem .8rem; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; padding-top: .75rem; padding-bottom: .75rem; }
.btn-group { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* ── STATUS / MISC ──────────────────────────── */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; }
.dot-green  { background: var(--success); }
.dot-red    { background: var(--error); }
.dot-yellow { background: var(--warning); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-light); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.empty-state p { font-size: .9rem; }

.section-title { font-size: 1.15rem; font-weight: 700; color: var(--navy); margin-bottom: 1.5rem; }

.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-actions h1 { font-size: 1.15rem; font-weight: 700; color: var(--navy); }

/* Seascape color swatches */
.color-swatch {
  display: inline-block;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.1);
  vertical-align: middle;
  margin-right: .3rem;
}

/* Partner list items */
.partner-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.partner-item:last-child { border-bottom: none; }
.partner-drag { color: var(--text-light); cursor: grab; font-size: 1.2rem; }
.partner-name { flex: 1; font-weight: 500; }
.partner-url  { font-size: .8rem; color: var(--text-light); }

/* Instrument card list */
.instrument-item {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.instrument-item:last-child { border-bottom: none; }
.instrument-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.instrument-icon   { font-size: 1.4rem; }
.instrument-title  { font-weight: 700; flex: 1; }
.instr-status {
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 20px;
}
.instr-status.active      { background: rgba(0,168,150,.12); color: var(--teal-dark); }
.instr-status.scaling     { background: rgba(0,39,77,.1);    color: var(--navy); }
.instr-status.feasibility { background: rgba(232,115,90,.12); color: var(--coral-dark); }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-wrap { margin-left: 0; }
  .form-row, .form-row-3, .bilingual-group { grid-template-columns: 1fr; }
}
