/* Helm — application stylesheet (Phase 1: login, shell, admin). */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0f6b54;   /* Digitata green */
  --accent-soft: #e6f2ee;
  --ok: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
[hidden] { display: none !important; }

/* ── login ─────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(30, 41, 59, .10);
  padding: 36px 42px;
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.login-logo { height: 52px; margin: 0 auto 14px; display: block; }
.login-card h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: .5px; color: var(--accent); }
.sub { margin: 0 0 18px; color: var(--muted); }
.login-block {
  border-top: 1px solid var(--line);
  margin-top: 18px; padding-top: 16px;
  text-align: left;
}
.login-block h3 { margin: 0 0 6px; font-size: 14px; }
.login-block form { display: flex; flex-direction: column; gap: 8px; }
.notice {
  background: #fff7ed; border: 1px solid var(--warn); color: #7c2d12;
  border-radius: 8px; padding: 8px 12px; font-size: 13px;
}

/* ── shared bits ───────────────────────────────────────────────────────── */
input, select {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.btn {
  padding: 9px 16px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; display: inline-block; text-align: center;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-ms { background: #2f2f2f; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0; }
.hint.ok { color: var(--ok); }
.hint.bad, .bad { color: var(--bad); }

/* ── app shell ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 10px 18px;
}
.brand-logo { height: 28px; }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--accent); }
.spacer { flex: 1; }
.user-chip { color: var(--muted); }
.user-chip small { color: #94a3b8; }
.layout { display: flex; min-height: calc(100vh - 53px); }
#nav {
  width: 190px; flex-shrink: 0; padding: 14px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.nav-item {
  text-align: left; padding: 9px 12px; border: 0; border-radius: 8px;
  background: transparent; font: inherit; cursor: pointer; color: var(--ink);
}
.nav-item:hover { background: var(--accent-soft); }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
#main { flex: 1; padding: 18px; min-width: 0; }
.panel {
  background: var(--panel); border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(30, 41, 59, .06); padding: 20px 22px;
}
.panel h2 { margin: 0 0 12px; font-size: 19px; }

/* ── tabs / tables / forms (admin) ─────────────────────────────────────── */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab {
  padding: 8px 14px; border: 0; background: transparent; font: inherit;
  cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted);
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.add-form {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px;
}
.grid { width: 100%; border-collapse: collapse; }
.grid th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line);
}
.grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:hover td { background: #fafcfb; }
.detail-cell { font-size: 12px; color: var(--muted); max-width: 340px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── toasts ────────────────────────────────────────────────────────────── */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px;
  opacity: 0; transform: translateY(8px); transition: all .25s; max-width: 340px;
}
.toast.show { opacity: 1; transform: none; }
.toast-ok { background: var(--ok); }
.toast-bad { background: var(--bad); }

/* ── session-expired overlay ───────────────────────────────────────────── */
.sess-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(30, 41, 59, .55);
  display: flex; align-items: center; justify-content: center;
}
.sess-card {
  background: var(--panel); border-radius: var(--radius);
  padding: 26px 30px; max-width: 380px; text-align: center;
  box-shadow: 0 10px 36px rgba(0, 0, 0, .25);
}
.sess-card h3 { margin: 0 0 8px; }
.sess-actions { margin-top: 16px; display: flex; gap: 10px; justify-content: center; }

/* ── responsive ────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  #nav { width: auto; flex-direction: row; overflow-x: auto; }
  .grid { display: block; overflow-x: auto; }
}
