:root {
  --wood-dark: #1c130c;
  --wood: #2e1f14;
  --wood-light: #4a3320;
  --parchment: #e8d9b0;
  --parchment-light: #f2e6c4;
  --parchment-dark: #d6c090;
  --ink: #2b1d10;
  --ink-soft: #4a3820;
  --gold: #a97a1f;
  --gold-bright: #d9a441;
  --gold-dim: #8a6a2f;
  --crimson: #6e1c1c;
  --crimson-bright: #8f2727;
  --green-ok: #2f5d34;
  --green-bright: #4a8a52;
  --red-off: #8a2020;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--wood-dark);
  color: var(--ink);
  font-family: Verdana, Arial, 'EB Garamond', Georgia, sans-serif;
  font-size: 13px;
  line-height: 1.45;
}

h1, h2, h3 { margin: 0; color: var(--ink); }
p { margin: 0 0 0.6em; }

a { color: var(--crimson); text-decoration: none; }
a:hover { color: var(--crimson-bright); text-decoration: underline; }

code {
  background: rgba(0,0,0,0.08);
  padding: 0.1em 0.3em;
  font-size: 0.9em;
  border-radius: 2px;
}

/* --- Overall shell --- */
.site-shell {
  max-width: 1000px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--wood);
  border-left: 1px solid #000;
  border-right: 1px solid #000;
  box-shadow: 0 0 30px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
}

/* --- Top strip: brand only --- */
.site-topbar {
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  border-bottom: 2px solid var(--gold);
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--gold-bright);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.brand:hover { color: #f0c76a; text-decoration: none; }
.brand-crest { font-size: 1.1rem; }
.topbar-session {
  font-size: 0.78rem;
  color: var(--parchment-dark);
}
.topbar-session strong { color: var(--gold-bright); }

/* --- Body: sidebar + content --- */
.site-body {
  flex: 1;
  display: flex;
  align-items: stretch;
}

.sidebar {
  width: 190px;
  flex: 0 0 190px;
  background: linear-gradient(180deg, var(--wood), var(--wood-dark));
  border-right: 2px solid var(--gold);
  padding: 0.75rem 0;
}
.sidebar-item { margin-bottom: 0.15rem; }
.sidebar-top-link {
  display: block;
  padding: 0.4rem 0.9rem;
  color: var(--parchment);
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-left: 3px solid transparent;
}
.sidebar-top-link:hover, .sidebar-top-link.active {
  background: rgba(217,164,65,0.12);
  border-left-color: var(--gold-bright);
  color: var(--gold-bright);
  text-decoration: none;
}
.sidebar-section {
  margin-top: 0.6rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(217,164,65,0.25);
}
.sidebar-section-title {
  padding: 0.2rem 0.9rem;
  font-size: 0.72rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
}
.sidebar-sub-link, .sidebar-sub-link-disabled {
  display: block;
  padding: 0.32rem 0.9rem 0.32rem 1.4rem;
  font-size: 0.78rem;
  color: var(--parchment-dark);
  border-left: 3px solid transparent;
}
.sidebar-sub-link:hover {
  background: rgba(217,164,65,0.12);
  border-left-color: var(--gold-bright);
  color: var(--gold-bright);
  text-decoration: none;
}
.sidebar-sub-link-disabled {
  color: #6b5a3f;
  cursor: default;
  font-style: italic;
}
.sidebar-sub-link.inline-form-link { width: 100%; text-align: left; background: none; border: none; border-left: 3px solid transparent; cursor: pointer; font: inherit; }

/* --- Main content --- */
.content {
  flex: 1;
  background: var(--parchment);
  padding: 0.85rem 1rem 1.5rem;
  min-width: 0;
}

/* --- Panels (the core "portal box" pattern) --- */
.portal-panel {
  border: 1px solid var(--gold);
  background: var(--parchment-light);
  margin-bottom: 0.85rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.portal-panel-title {
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  color: var(--gold-bright);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
  border-bottom: 1px solid var(--gold);
}
.portal-panel-body { padding: 0.75rem 0.9rem; }
.portal-panel-body p:last-child { margin-bottom: 0; }

/* --- Status list (home page + future server-status panel) --- */
.status-list { width: 100%; border-collapse: collapse; }
.status-list tr { border-bottom: 1px solid var(--parchment-dark); }
.status-list tr:last-child { border-bottom: none; }
.status-list td { padding: 0.3rem 0.2rem; font-size: 0.82rem; }
.status-list td.status-label { color: var(--ink-soft); width: 55%; }
.status-list td.status-value { text-align: right; font-weight: bold; }
.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.status-dot.on { background: var(--green-bright); box-shadow: 0 0 3px var(--green-bright); }
.status-dot.off { background: var(--red-off); }
.status-dot.unknown { background: #9a8a5f; }
.status-on { color: var(--green-ok); }
.status-off { color: var(--red-off); }

/* --- Buttons: square, beveled, small-caps --- */
.btn {
  display: inline-block;
  padding: 0.4rem 1rem;
  font-family: Verdana, Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 2px;
  cursor: pointer;
  border-style: solid;
  border-width: 1px;
}
.btn-primary {
  background: var(--crimson);
  color: var(--parchment-light);
  border-color: #4a1414;
  border-top-color: #a53a3a;
  border-left-color: #a53a3a;
}
.btn-primary:hover { background: var(--crimson-bright); text-decoration: none; color: var(--parchment-light); }
.btn-secondary {
  background: var(--wood-light);
  color: var(--parchment);
  border-color: #1a1109;
  border-top-color: #6b4a2c;
  border-left-color: #6b4a2c;
}
.btn-secondary:hover { background: var(--wood); text-decoration: none; color: var(--parchment); }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.inline-form { display: inline; margin: 0; }

/* --- Forms --- */
.form-group { margin-bottom: 0.7rem; }
.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}
.form-group input {
  width: 100%;
  max-width: 320px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  background: #fbf3de;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
}
.form-group input:focus {
  outline: none;
  border-color: var(--crimson);
  box-shadow: 0 0 0 2px rgba(110,28,28,0.15);
}
.form-hint { font-size: 0.76rem; color: var(--ink-soft); margin-top: 0.2rem; }
.form-actions { margin-top: 0.8rem; }

.alert {
  padding: 0.5rem 0.7rem;
  border-radius: 2px;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
}
.alert-error { background: rgba(110,28,28,0.1); border: 1px solid var(--crimson); color: var(--crimson); }
.alert-success { background: rgba(47,93,52,0.1); border: 1px solid var(--green-ok); color: var(--green-ok); }
.alert-info { background: rgba(74,51,32,0.08); border: 1px solid var(--wood-light); color: var(--ink-soft); }

/* --- Key/value info table (account summary) --- */
table.kv-table { width: 100%; border-collapse: collapse; }
table.kv-table tr { border-bottom: 1px solid var(--parchment-dark); }
table.kv-table tr:last-child { border-bottom: none; }
table.kv-table td { padding: 0.35rem 0.2rem; font-size: 0.85rem; vertical-align: middle; }
table.kv-table td.kv-key { color: var(--ink-soft); width: 35%; font-weight: bold; }
table.kv-table td.kv-edit { text-align: right; }
table.kv-table td.kv-edit a, table.kv-table td.kv-edit summary { font-size: 0.76rem; cursor: pointer; }

details.inline-edit summary { list-style: none; display: inline-block; }
details.inline-edit summary::-webkit-details-marker { display: none; }
details.inline-edit .edit-form-wrap { margin-top: 0.5rem; padding: 0.5rem; background: rgba(0,0,0,0.04); border: 1px solid var(--parchment-dark); }

/* Small clickable "chip" -- used for [Edit]/[Delete]-style controls so they
   read as buttons, not plain text, with an obvious hover state. */
.chip-link {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  font-size: 0.72rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--crimson);
  background: rgba(110,28,28,0.08);
  border: 1px solid var(--crimson);
  border-radius: 2px;
  cursor: pointer;
}
.chip-link:hover {
  background: var(--crimson);
  color: var(--parchment-light);
  text-decoration: none;
}
details.inline-edit[open] summary .chip-link {
  background: var(--crimson);
  color: var(--parchment-light);
}

.collapsible-panel > summary {
  cursor: pointer;
  list-style: none;
}
.collapsible-panel > summary::-webkit-details-marker { display: none; }
.collapsible-panel > summary .portal-panel-title { display: block; }
.collapsible-panel > summary .portal-panel-title::after {
  content: '▸';
  float: right;
}
.collapsible-panel[open] > summary .portal-panel-title::after { content: '▾'; }

table.character-table { width: 100%; border-collapse: collapse; margin-top: 0.2rem; font-size: 0.85rem; }
table.character-table th, table.character-table td {
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--parchment-dark);
}
table.character-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(0,0,0,0.04);
}

.badge-account-id {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  color: var(--crimson);
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--gold-dim);
  background: var(--wood-dark);
  color: #8a7a5a;
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
  text-align: center;
}
.site-footer a { color: #a08558; }
.footer-meta { opacity: 0.85; }

@media (max-width: 720px) {
  .site-shell { border-left: none; border-right: none; }
  .site-body { flex-direction: column; }
  .sidebar { width: 100%; flex: none; border-right: none; border-bottom: 2px solid var(--gold); }
  .content { padding: 0.75rem; }
}
