/* Goud Graaiers member platform: fleet theme, dark navy + parchment + gold ramp */
:root {
  --navy: #132029;
  --navy-2: #1a2a36;
  --surface: #1e303e;
  --surface-2: #2a3f50;
  --ink: #e8e2d2;
  --ink-muted: #9fb0ba;
  --gold-1: #f2dc86;
  --gold-2: #d4af37;
  --gold-3: #a67f12;
  --danger: #c96a5a;
  --green: #5fae7f;
  --ramp: linear-gradient(120deg, #f2dc86, #d4af37 45%, #a67f12);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
@supports (height: 100dvh) { html, body { height: 100dvh; } }
body {
  margin: 0;
  background: var(--navy);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--ink-muted); }
.pad { padding: 16px; }
.row { display: flex; gap: 12px; align-items: center; }

.brand {
  font-weight: 800;
  letter-spacing: .08em;
  background: var(--ramp);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand { font-size: 26px; text-transform: uppercase; }
.brand.small { font-size: 17px; }
.brand-sub { color: var(--ink-muted); font-size: 13px; margin-bottom: 22px; letter-spacing: .14em; text-transform: uppercase; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: min(420px, 100%);
  background: var(--navy-2);
  border: 1px solid var(--surface-2);
  border-radius: 12px;
  padding: 32px 34px;
}
.auth-card h2 { margin: 14px 0 10px; font-size: 19px; }
.auth-card label { display: block; margin: 14px 0; font-size: 13px; color: var(--ink-muted); }
.auth-card input, .auth-card textarea {
  display: block; width: 100%; margin-top: 6px;
  background: var(--navy); color: var(--ink);
  border: 1px solid var(--surface-2); border-radius: 8px;
  padding: 10px 12px; font: inherit;
}
.auth-card input:focus, .auth-card textarea:focus { outline: none; border-color: var(--gold-2); }
.auth-links { margin-top: 16px; font-size: 13px; }
.auth-links a { color: var(--gold-2); }
.recovery-code {
  font-family: ui-monospace, monospace;
  font-size: 24px; letter-spacing: .12em;
  color: var(--gold-1);
  background: var(--navy);
  border: 1px dashed var(--gold-3);
  border-radius: 8px;
  text-align: center;
  padding: 14px;
  margin: 14px 0;
}
.error {
  margin-top: 14px; padding: 10px 12px;
  background: #2a1e1c; border: 1px solid var(--danger);
  border-radius: 8px; color: #f0c9c1; font-size: 14px;
}

/* ---------- buttons ---------- */
.gold-btn {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2) 60%, var(--gold-3));
  color: #241c04;
  border: none; border-radius: 8px;
  font: inherit; font-weight: 700;
  padding: 9px 16px; cursor: pointer;
}
.gold-btn:hover { filter: brightness(1.08); }
.gold-btn:disabled { opacity: .5; cursor: default; }
.link-btn {
  background: none; border: none; color: var(--ink-muted);
  font: inherit; cursor: pointer; padding: 4px; text-decoration: underline;
}
.link-btn:hover { color: var(--ink); }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 230px 1fr; height: 100vh; }
@supports (height: 100dvh) { .app { height: 100dvh; } }
.sidebar {
  background: var(--navy-2);
  border-right: 1px solid var(--surface-2);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  min-width: 0;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; margin: 18px 0; }
.nav-item {
  text-align: left; background: none; border: none;
  color: var(--ink-muted); font: inherit; font-weight: 600;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
}
.nav-item:hover { color: var(--ink); background: var(--surface); }
.nav-item.active { color: var(--ink); background: var(--surface-2); }
.side-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-muted); padding: 10px 12px 4px;
}
#channel-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.channel-item {
  text-align: left; background: none; border: none;
  color: var(--ink-muted); font: inherit;
  padding: 7px 12px; border-radius: 8px; cursor: pointer;
}
.channel-item::before { content: "# "; color: var(--gold-3); }
.channel-item:hover { color: var(--ink); background: var(--surface); }
.channel-item.active { color: var(--gold-1); background: var(--surface-2); }
.sidebar-foot {
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--surface-2);
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-size: 14px;
}
.rank-badge {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--gold-3); color: var(--gold-1);
  border-radius: 20px; padding: 2px 8px; vertical-align: middle;
}
.main { display: flex; flex-direction: column; min-width: 0; }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.view-head { padding: 14px 22px; border-bottom: 1px solid var(--surface-2); }
.view-head h1 {
  margin: 0; font-size: 20px; text-transform: uppercase; letter-spacing: .05em;
  background: var(--ramp); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.view-head-row { display: flex; justify-content: space-between; align-items: center; }

/* ---------- chat ---------- */
.messages { flex: 1; overflow-y: auto; padding: 14px 22px; }
.msg { margin: 0 0 12px; }
.msg-head { font-size: 13px; margin-bottom: 2px; }
.msg-author { font-weight: 700; color: var(--gold-1); }
.rank-tag {
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--gold-3); border-radius: 10px; padding: 1px 6px;
  margin-left: 6px; color: var(--gold-1); vertical-align: 1px;
}
.rank-tag.leader { border-color: var(--gold-3); }
.rank-tag.founder { border-color: var(--gold-2); background: rgba(212, 175, 55, .15); }
.msg-time { color: var(--ink-muted); }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.composer {
  display: flex; gap: 10px; padding: 12px 22px 16px;
  border-top: 1px solid var(--surface-2);
}
.composer input {
  flex: 1; background: var(--navy-2); color: var(--ink);
  border: 1px solid var(--surface-2); border-radius: 8px;
  padding: 10px 14px; font: inherit;
}
.composer input:focus { outline: none; border-color: var(--gold-2); }

/* ---------- voyages ---------- */
#voyage-list { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.voyage {
  background: var(--navy-2);
  border: 1px solid var(--surface-2);
  border-left: 3px solid var(--gold-2);
  border-radius: 10px;
  padding: 16px 18px;
}
.voyage h3 { margin: 0 0 4px; font-size: 17px; }
.voyage-when { color: var(--gold-1); font-size: 13px; margin-bottom: 8px; }
.voyage-host { color: var(--ink-muted); font-size: 13px; }
.voyage-text { white-space: pre-wrap; margin: 10px 0 12px; overflow-wrap: anywhere; }
.att-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.att-btn {
  background: var(--surface); color: var(--ink-muted);
  border: 1px solid var(--surface-2); border-radius: 20px;
  font: inherit; font-size: 13px; padding: 5px 14px; cursor: pointer;
}
.att-btn:hover { color: var(--ink); }
.att-btn.on[data-status="coming"] { background: #1d3328; border-color: var(--green); color: #c9ecd8; }
.att-btn.on[data-status="maybe"] { background: #332d1d; border-color: var(--gold-2); color: var(--gold-1); }
.att-btn.on[data-status="out"] { background: #332019; border-color: var(--danger); color: #f0c9c1; }
.att-counts { font-size: 13px; color: var(--ink-muted); margin-left: auto; }
.att-names { font-size: 13px; color: var(--ink-muted); margin-top: 8px; }
.voyage-del { margin-left: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 180px; }
.tz-preview { font-size: 12px; color: var(--gold-1); margin-top: 4px; min-height: 15px; }
#vf-tz { width: auto; flex: 0 0 auto; }
#my-templates { margin-top: 14px; }
#my-templates summary { cursor: pointer; font-weight: 700; color: var(--gold-1); }
.mt-item {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--surface-2);
  padding: 8px 0; font-size: 14px;
}
.mt-item .mt-preview { color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- admin ---------- */
#view-admin { overflow-y: auto; padding-bottom: 24px; }
.panel {
  margin: 18px 22px 0;
  background: var(--navy-2);
  border: 1px solid var(--surface-2);
  border-radius: 10px;
  padding: 18px 20px;
}
.panel h3 { margin: 0 0 10px; }
.panel label { display: block; margin: 12px 0; font-size: 13px; color: var(--ink-muted); }
.panel input, .panel select, .panel textarea {
  display: block; width: 100%; margin-top: 6px;
  background: var(--navy); color: var(--ink);
  border: 1px solid var(--surface-2); border-radius: 8px;
  padding: 9px 12px; font: inherit;
}
.panel textarea { font-family: ui-monospace, monospace; font-size: 13px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; color: var(--ink-muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 6px 8px; }
.admin-table td { padding: 8px; border-top: 1px solid var(--surface-2); }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--gold-3);
  border-radius: 8px; padding: 10px 18px; font-size: 14px;
  z-index: 50; max-width: 90vw;
}

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: none; border-bottom: 1px solid var(--surface-2); padding: 10px 12px; gap: 6px; }
  .side-nav { flex-direction: row; margin: 0; }
  .side-label { display: none; }
  #channel-list { flex-direction: row; overflow-x: auto; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; }
  .messages, #voyage-list { padding: 12px; }
  .composer { padding: 10px 12px 12px; }
  .panel { margin: 12px; }
}
