/* =====================================================================
   Azrael's Empire — theme
   Palette: near-black void, crimson seal, oxblood, royal-blue undertone,
            worn gold for rank/authority accents, bone-white text.
   ===================================================================== */

:root {
  --void:        #0a0a0d;
  --panel:       #131217;
  --panel-2:     #1a1820;
  --line:        #2a2732;
  --crimson:     #8e1f2d;
  --crimson-br:  #b5293a;
  --blue:        #24345e;
  --blue-br:     #3d55a0;
  --gold:        #c9a24b;
  --gold-dim:    #8a7237;
  --bone:        #e9e4d8;
  --bone-dim:    #a39c8c;
  --danger:      #c0392b;
  --ok:          #4a7c59;

  --font-display: 'Cinzel', 'Georgia', serif;
  --font-body: 'Work Sans', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at top, #1c1420 0%, var(--void) 55%),
    var(--void);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--crimson-br); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  color: var(--bone);
  font-weight: 600;
  margin: 0 0 0.5em;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: linear-gradient(180deg, #150f13 0%, var(--void) 100%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(201,162,75,0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--gold);
}
.brand .sigil {
  width: 34px; height: 34px;
  border: 1.5px solid var(--gold-dim);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  color: var(--crimson-br);
  background: radial-gradient(circle, #201720 0%, #120d12 100%);
  font-size: 1.1rem;
}

nav.mainnav { display: flex; gap: 4px; flex-wrap: wrap; }
nav.mainnav a {
  color: var(--bone-dim);
  padding: 8px 14px;
  border-radius: 3px;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
nav.mainnav a:hover, nav.mainnav a.active {
  color: var(--bone);
  border-color: var(--line);
  background: var(--panel-2);
}

.userbox { display: flex; align-items: center; gap: 12px; font-size: 0.85rem; color: var(--bone-dim); }
.userbox .rankbadge { color: var(--gold); }
.userbox a.logout { color: var(--crimson-br); }

.account-menu { position: relative; }
.account-trigger {
  background: none;
  border: 1px solid transparent;
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.account-trigger:hover { border-color: var(--line); background: var(--panel-2); }
.account-trigger .caret { color: var(--gold-dim); font-size: 0.7rem; }
.account-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 170px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  overflow: hidden;
  z-index: 50;
}
.account-dropdown.open { display: block; }
.account-dropdown a {
  display: block;
  padding: 10px 14px;
  color: var(--bone);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--line);
}
.account-dropdown a:last-child { border-bottom: none; }
.account-dropdown a:hover { background: var(--panel-2); color: var(--gold); }
.account-dropdown a.logout { color: var(--crimson-br); }
.account-dropdown a.logout:hover { background: rgba(142,31,45,0.12); color: var(--crimson-br); }

main.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
}
.panel::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--crimson) 0%, var(--gold-dim) 50%, var(--blue-br) 100%);
  border-radius: 6px 6px 0 0;
}

.page-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.page-title h1 { font-size: 1.6rem; }
.eyebrow {
  font-family: var(--font-mono);
  color: var(--gold-dim);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--gold); font-family: var(--font-display); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: rgba(255,255,255,0.02); }
table.matrix th, table.matrix td { text-align: center; }
table.matrix td:first-child, table.matrix th:first-child { text-align: left; }

.rank-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  background: rgba(201,162,75,0.08);
  white-space: nowrap;
}
.role-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  margin: 1px;
  border: 1px solid var(--blue-br);
  color: #9fb3ea;
  background: rgba(61,85,160,0.12);
  white-space: nowrap;
}

label { display: block; margin: 14px 0 5px; font-size: 0.85rem; color: var(--bone-dim); }
input[type=text], input[type=password], input[type=search], select, textarea {
  width: 100%;
  background: var(--void);
  border: 1px solid var(--line);
  color: var(--bone);
  padding: 9px 11px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 0.92rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(201,162,75,0.15);
}
textarea { min-height: 110px; resize: vertical; }

.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 4px;
  border: 1px solid var(--gold-dim);
  background: linear-gradient(180deg, #221a12 0%, #171016 100%);
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.btn:hover { border-color: var(--gold); background: #2a2016; }
.btn.primary { border-color: var(--crimson-br); color: #f0c9c9; background: linear-gradient(180deg, #3a1218 0%, #200a0d 100%); }
.btn.primary:hover { background: #4a151c; }
.btn.small { padding: 5px 12px; font-size: 0.75rem; }
.btn.danger { border-color: var(--danger); color: #f2a99f; }

.flash { padding: 10px 16px; border-radius: 4px; margin-bottom: 16px; font-size: 0.88rem; border: 1px solid; }
.flash.info    { background: rgba(61,85,160,0.12); border-color: var(--blue-br); color: #b9c6ec; }
.flash.success { background: rgba(74,124,89,0.12); border-color: var(--ok); color: #b7dcc0; }
.flash.error   { background: rgba(192,57,43,0.12); border-color: var(--danger); color: #f0b6ae; }

.muted { color: var(--bone-dim); }
.mono { font-family: var(--font-mono); }
.hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

.auth-wrap {
  max-width: 400px; margin: 8vh auto; padding: 0 20px;
}
.auth-wrap .panel { text-align: left; }
.auth-wrap .sigil-big {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border: 2px solid var(--gold-dim); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.8rem; color: var(--crimson-br);
  background: radial-gradient(circle, #201720 0%, #120d12 100%);
}

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  padding: 12px 0 12px 18px;
  border-left: 2px solid var(--line);
  position: relative;
  margin-left: 6px;
}
.timeline li::before {
  content: "";
  position: absolute; left: -6px; top: 16px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gold-dim); border: 2px solid var(--void);
}
.timeline .ttag { font-family: var(--font-mono); font-size: 0.72rem; color: var(--gold-dim); text-transform: uppercase; }
.timeline .tdate { font-size: 0.72rem; color: var(--bone-dim); float: right; }

.access-none { color: var(--bone-dim); }
.access-view { color: #9fb3ea; }
.access-edit { color: var(--gold); }

footer.site {
  text-align: center; padding: 24px; color: var(--bone-dim); font-size: 0.78rem;
  border-top: 1px solid var(--line);
}

/* Spreadsheet-style grid for game entry (Excel-like compact table) */
.sheet-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table.sheet { width: 100%; border-collapse: collapse; font-size: 0.82rem; background: var(--void); }
table.sheet th, table.sheet td {
  border: 1px solid var(--line);
  padding: 4px 6px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
table.sheet th {
  background: var(--panel-2);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}
table.sheet td.sheet-name { white-space: normal; min-width: 120px; font-family: var(--font-body); }
table.sheet td.sheet-report { white-space: normal; min-width: 180px; }
table.sheet input[type=text], table.sheet select, table.sheet textarea {
  width: 100%;
  min-width: 64px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--bone);
  padding: 3px 4px;
  font-size: 0.8rem;
  border-radius: 2px;
}
table.sheet select.rating-cell { min-width: 46px; text-align: center; }
table.sheet input:focus, table.sheet select:focus, table.sheet textarea:focus {
  outline: none;
  border-color: var(--gold-dim);
  background: rgba(201,162,75,0.08);
}
table.sheet textarea { min-height: 32px; resize: vertical; }
table.sheet tr:nth-child(even) td { background: rgba(255,255,255,0.015); }
table.sheet tr:hover td { background: rgba(201,162,75,0.04); }

/* ===================================================================
   Genuine Excel look — scoped ONLY to elements inside .excel-sheet.
   White background, gray gridlines, Excel-style header row.
   The rest of the site (dark theme) is untouched.
   =================================================================== */
.excel-sheet {
  background: #ffffff;
  border: 1px solid #b7b7b7;
  border-radius: 2px;
  overflow-x: auto;
}
.excel-sheet table.sheet {
  background: #ffffff;
  font-family: Calibri, 'Segoe UI', Arial, sans-serif;
  font-size: 12.5px;
  color: #1f1f1f;
  border-collapse: collapse;
}
.excel-sheet table.sheet th {
  background: #f3f2f1;
  color: #1f1f1f;
  font-family: Calibri, 'Segoe UI', Arial, sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  text-transform: none;
  letter-spacing: normal;
  border: 1px solid #b7b7b7;
  position: sticky;
  top: 0;
}
.excel-sheet table.sheet td {
  background: #ffffff;
  border: 1px solid #d4d4d4;
  color: #1f1f1f;
}
.excel-sheet table.sheet tr:nth-child(even) td { background: #ffffff; }
.excel-sheet table.sheet tr:hover td { background: #f5f9fc; }
.excel-sheet table.sheet td.sheet-name { color: #1f1f1f; font-weight: 500; }
.excel-sheet table.sheet td.sheet-name a { color: #185abd; }
.excel-sheet table.sheet input[type=text],
.excel-sheet table.sheet select,
.excel-sheet table.sheet textarea {
  background: transparent;
  color: #1f1f1f;
  border: 1px solid transparent;
  font-family: Calibri, 'Segoe UI', Arial, sans-serif;
  font-size: 12.5px;
}
.excel-sheet table.sheet input[type=text]:focus,
.excel-sheet table.sheet select:focus,
.excel-sheet table.sheet textarea:focus {
  outline: none;
  border: 1.5px solid #107c41;
  background: #ffffff;
  box-shadow: 0 0 0 1px #107c41;
}
.excel-sheet table.sheet select option { color: #1f1f1f; background: #ffffff; }
.excel-sheet table.sheet .mono { color: #1f1f1f; font-family: Consolas, Calibri, monospace; }
.excel-sheet table.sheet .btn.danger {
  background: #ffffff; border-color: #c0392b; color: #c0392b;
  font-family: Calibri, 'Segoe UI', Arial, sans-serif;
}
