/* ─── Shared base styles ────────────────────────────────────────────────── */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-body);
}

h1, h2, h3 { font-family: var(--font-heading); }

button, .btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
button.secondary, .btn.secondary {
  background: var(--surface-3);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
button.danger { background: var(--critical); color: #ffffff; }

.value.good { color: var(--good); }
.value.critical { color: var(--critical); }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar nav { display: flex; gap: 10px; align-items: center; }

/* Brand lockup: RHIMCHU (dominant) + sub-brand label (small, accent, spaced) */
.brand-lockup { display: flex; align-items: baseline; gap: 8px; line-height: 1; }
.brand-lockup .brand-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}
.brand-lockup .brand-sub {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--accent);
}

main { max-width: 1100px; margin: 0 auto; padding: 24px 28px 60px; }

.panel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.panel h3 {
  font-size: 12px; margin: 0 0 16px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
}

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; }

.empty { color: var(--text-muted); font-size: 14px; padding: 40px 0; text-align: center; }

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  background: var(--surface-2);
  color: var(--text-primary);
  width: 340px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog .actions { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }
dialog .dialog-error { color: var(--critical); font-size: 12.5px; margin-top: 10px; min-height: 1em; }

.spacer-top-sm { margin-top: 12px; }
.text-muted { color: var(--text-muted); }

/* ─── Floating-label form field ─────────────────────────────────────────────
   Pure CSS: input has placeholder=" " so :placeholder-shown only matches when
   truly empty; label floats up on focus or once there's content. No JS. */

.field { position: relative; margin-top: 16px; }
.field:first-of-type { margin-top: 0; }

.field input, .field select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  padding: 16px 12px 4px;
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: border-color 150ms ease;
}
.field input:focus, .field select:focus { border-color: var(--accent); }

.field label {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
  background: var(--field-label-bg, var(--surface-2));
  padding: 0 4px;
  transition: top 150ms ease, font-size 150ms ease, color 150ms ease, transform 150ms ease;
}

.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label,
.field select ~ label {
  top: 0;
  transform: translateY(-50%);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--accent);
}
.field input:not(:focus):not(:placeholder-shown) ~ label {
  color: var(--text-muted);
}
.field select:not(:focus) ~ label { color: var(--text-muted); }

/* ─── App shell: seamless sidebar + topbar chrome ───────────────────────── */

.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  background: var(--surface-1);
  padding: 22px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.sidebar .brand-lockup { padding: 0 8px; }

.sidebar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 8px;
  margin-bottom: 8px;
}

.menu-item {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
}
.menu-item:hover { background: var(--surface-2); color: var(--text-primary); }
.menu-item.is-active { background: var(--surface-2); color: var(--accent); font-weight: 600; }

.main-pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar-new {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: var(--surface-1);
}
.topbar-title { font-family: var(--font-heading); font-size: 17px; font-weight: 700; color: var(--text-primary); }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}

main#content { flex: 1; background: var(--surface-0); padding: 26px 28px 60px; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; flex-direction: row; flex-wrap: wrap; gap: 16px; padding: 16px; }
  .sidebar .brand-lockup { width: 100%; }
  .sidebar-section { flex: 1 1 auto; min-width: 160px; }
}
