/* ============================================================
   rook.css — dark dashboard CSS library
   Semantic HTML, context-aware styling, minimal classes.
   ============================================================ */

/* --- Reset & Custom Properties --- */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #080c11;
  --surface: #0e1520;
  --surface2: #131d2b;
  --border: #1e2d40;
  --text: #dce6f4;
  --text-sub: #7b92ae;
  --text-dim: #4a6070;
  --accent: #4da3ff;
  --green: #3ddc97;
  --red: #ff6b6b;
  --radius: 14px;
  --radius-sm: 8px;
  --space: 18px;
  --space-sm: 12px;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* --- Base Elements --- */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; }

p { margin: 0 0 1em; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space) 0;
}

code {
  background: rgba(77, 163, 255, .1);
  color: #7cc0ff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .88em;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  border: 1px solid #253348;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
button:hover, .btn:hover { border-color: var(--accent); }

.btn-link {
  background: none;
  border-color: transparent;
  color: var(--accent);
}
.btn-link:hover { text-decoration: underline; border-color: transparent; }

table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 8px 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th { color: var(--text-sub); font-size: .82rem; font-weight: 500; }
tr:last-child td, tr:last-child th { border-bottom: none; }

/* --- Topbar --- */
.topbar {
  border-bottom: 1px solid var(--border);
  padding: var(--space) 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.topbar h1 {
  font-size: 1.1rem;
  font-weight: 600;
}
.topbar > * {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* --- Grid --- */
.grid {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.col-1  { grid-column: span 1; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  [class*="col-"] { grid-column: span 1; }
}

/* --- Card --- */
.card {
  background: linear-gradient(160deg, #101929 0%, #0d1520 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space);
}

/* Card headings: small caps, muted, flex row for icon + text + chip */
.card > h1, .card > h2, .card > h3 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

/* Definition lists inside cards: stat-row style */
.card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
}
.card dt, .card dd {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.card dt {
  color: var(--text-sub);
  font-size: .82rem;
}
.card dd {
  font-weight: 600;
  font-size: .88rem;
  text-align: right;
}
/* Remove border on last row */
.card dt:nth-last-of-type(1),
.card dd:last-of-type {
  border-bottom: none;
}

/* Card action links — right-aligned row at card bottom */
.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border);
}
.card-actions a {
  font-size: .76rem;
  color: var(--text-sub);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  text-decoration: none;
}
.card-actions a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Timestamps */
.card time, .card small {
  display: inline-block;
  margin-top: var(--space-sm);
  font-size: .74rem;
  color: var(--text-dim);
}

/* --- Chips / Badges --- */
.chip {
  font-size: .72rem;
  padding: 4px 9px;
  border-radius: 20px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.chip.blue,  .chip-blue  { background: rgba(77, 163, 255, .13); color: #4da3ff; }
.chip.green, .chip-green { background: rgba(61, 220, 151, .13); color: #3ddc97; }
.chip.red,   .chip-red   { background: rgba(255, 107, 107, .13); color: #ff6b6b; }

/* --- Gauge --- */
.gauge {
  display: flex;
  align-items: center;
  gap: 20px;
}
.gauge svg {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.gauge-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.gauge-ring svg {
  transform: rotate(-90deg);
}
.gauge-ring .track { fill: none; stroke: #1a2840; stroke-width: 10; }
.gauge-ring .fill  { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.gauge-ring .label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-ring .label strong {
  font-size: 1.4rem;
  font-weight: 700;
}
.gauge-ring .label span {
  font-size: .7rem;
  color: var(--text-dim);
}

/* --- Utility --- */
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}
.text-dim { color: var(--text-dim); }
.text-sub { color: var(--text-sub); }
