/* Solomon Islands FBO Data Works – Team Daily Reports */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1a1d26;
  --muted: #5c6578;
  --primary: #0b6e4f;
  --primary-hover: #085c42;
  --border: #dce1ea;
  --chip: #eef1f6;
  --chip-sel: #0b6e4f;
  --chip-sel-text: #fff;
  --danger: #c0392b;
  --success: #1e7e34;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-theme="dark"] {
  --bg: #12151c;
  --surface: #1c212b;
  --text: #e8eaef;
  --muted: #9aa3b5;
  --primary: #2ecc9a;
  --primary-hover: #27b888;
  --border: #2a3140;
  --chip: #2a3140;
  --chip-sel: #2ecc9a;
  --chip-sel-text: #0d1a14;
  --shadow: 0 2px 12px rgba(0,0,0,.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}

/* Auth */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 .25rem; font-size: 1.35rem; }
.subtitle { color: var(--muted); margin: 0 0 1.5rem; }
.auth-footer { margin-top: 1.25rem; text-align: center; font-size: .9rem; }
.hint { font-size: .8rem; color: var(--muted); text-align: center; }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand strong { display: block; }
.brand .year { font-size: .8rem; color: var(--muted); }
.user-area { display: flex; align-items: center; gap: .75rem; }
.user-name { font-weight: 600; }

/* Layout */
.app-shell {
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 0 auto;
}
@media (min-width: 900px) {
  .app-shell {
    flex-direction: row;
    align-items: flex-start;
  }
  .main-content { flex: 1; min-width: 0; }
  .sidebar {
    width: 280px;
    position: sticky;
    top: 60px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    order: 2;
  }
  .main-content { order: 1; }
}

.main-content { padding: 1rem 1.25rem 3rem; }
.sidebar {
  padding: 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
@media (min-width: 900px) {
  .sidebar {
    border-top: none;
    border-left: 1px solid var(--border);
  }
}

.menu-group { margin-bottom: 1.5rem; }
.menu-group h3 {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .5rem;
}
.nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .65rem .85rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: .95rem;
  margin-bottom: .25rem;
  min-height: 44px;
  transition: background .15s;
}
.nav-btn:hover { background: var(--chip); }
.nav-btn.active { background: var(--primary); color: var(--chip-sel-text); font-weight: 600; }
.nav-btn .badge {
  font-size: .75rem;
  background: rgba(0,0,0,.12);
  padding: .15rem .45rem;
  border-radius: 999px;
}
.nav-btn.active .badge { background: rgba(255,255,255,.25); }
.nav-btn.locked { opacity: .85; }
.check { color: var(--success); font-weight: 700; }

/* Cards & form */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.page-header h1 { margin: 0; font-size: 1.4rem; }
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card h3 { margin: 0 0 .75rem; font-size: 1.05rem; }
.guide ol { margin: 0; padding-left: 1.25rem; color: var(--muted); }

.tag, .badge-tag {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
}
.tag.locked { background: #fde8e8; color: #9b1c1c; }
.tag.submitted { background: #d1fae5; color: #065f46; }
.tag.draft { background: #e0e7ff; color: #3730a3; }
[data-theme="dark"] .tag.locked { background: #3f1f1f; color: #fca5a5; }
[data-theme="dark"] .tag.submitted { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .tag.draft { background: #1e1b4b; color: #a5b4fc; }

/* Chips & tiles */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: .5rem;
}
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text);
  padding: .55rem .9rem;
  border-radius: 999px;
  font-size: .9rem;
  cursor: pointer;
  min-height: 42px;
  transition: all .15s;
}
.chip:hover:not(:disabled) { border-color: var(--primary); }
.chip.selected {
  background: var(--chip-sel);
  color: var(--chip-sel-text);
  border-color: var(--chip-sel);
  font-weight: 600;
}
.chip:disabled { opacity: .6; cursor: not-allowed; }

.activity-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.tile.selected { border-color: var(--primary); }
.tile-btn {
  width: 100%;
  border: none;
  background: transparent;
  padding: 1rem .75rem;
  cursor: pointer;
  text-align: center;
  color: var(--text);
  min-height: 80px;
}
.tile-btn .icon { font-size: 1.5rem; display: block; margin-bottom: .35rem; }
.tile-btn .name { font-size: .85rem; }
.tile-expand {
  padding: .75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.tile-expand label { display: block; font-size: .85rem; margin-bottom: .5rem; }
.tile-expand select, .other-note, .other-input {
  width: 100%;
  padding: .5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin-top: .25rem;
}
.hours-total { margin-top: .75rem; font-size: .95rem; }

.block-label { display: block; font-weight: 600; margin: .75rem 0 .4rem; }
.field-block { margin-bottom: 1rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.tag-list .tag {
  background: var(--chip);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.tag-list .remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 .2rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
  transition: background .15s, border-color .15s;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn.outline:hover { border-color: var(--primary); color: var(--primary); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: .35rem .7rem; min-height: 36px; font-size: .85rem; }
.btn.icon { padding: .5rem; min-width: 44px; background: transparent; border: 1px solid var(--border); }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 1rem 0;
}
.save-status { font-size: .9rem; color: var(--muted); }

/* Dashboard cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.summary-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .1s;
}
.summary-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.mood { font-size: .85rem; color: var(--muted); }
.meta { display: flex; gap: .75rem; font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.summary-text { margin: 0; font-size: .9rem; color: var(--muted); }

.missing-box {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.missing-box h3 { margin: 0 0 .35rem; font-size: 1rem; }

/* Admin */
.admin-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin-table th, .admin-table td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--border); }
.inline-form { display: inline-block; margin-right: .5rem; margin-bottom: .5rem; }
label { display: block; margin-bottom: .75rem; font-size: .9rem; }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin-top: .25rem;
}
textarea { resize: vertical; }

.alert {
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.alert.error { background: #fde8e8; color: #9b1c1c; }
.alert.success { background: #d1fae5; color: #065f46; }
[data-theme="dark"] .alert.error { background: #3f1f1f; color: #fca5a5; }
[data-theme="dark"] .alert.success { background: #064e3b; color: #6ee7b7; }

.banner {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: .5rem 1rem;
  font-size: .9rem;
}

.answer-list dt { font-weight: 600; margin-top: .5rem; }
.answer-list dd { margin: 0 0 .25rem; color: var(--muted); }
.history-list { list-style: none; padding: 0; margin: 0; }
.history-list li { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.mini-summary { margin: .25rem 0 0; font-size: .85rem; color: var(--muted); }
.meta-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; font-size: .9rem; color: var(--muted); }
.empty { color: var(--muted); font-style: italic; }

@media (max-width: 899px) {
  .sidebar { order: -1; }
  .menu-group { display: flex; flex-wrap: wrap; gap: .35rem; }
  .menu-group h3 { width: 100%; }
  .nav-btn { flex: 1 1 auto; min-width: 120px; }
}
