:root {
  --bg: #161616;
  --surface: #212121;
  --raised: #333333;
  --border: #3a3a3a;
  --text: #f7f7f7;
  --muted: #a8a8a8;
  --accent: #c70008;
  --accent-dark: #8b0000;
  --danger: #ff5a3c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

button, input, textarea, select { font: inherit; color: inherit; }

a { color: var(--text); }

.center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.signin {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand {
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 22px;
}
.brand span { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); }

input[type="text"], input[type="email"], input[type="tel"], input[type="search"], textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  background: var(--accent);
  border: 0;
  border-bottom: 3px solid var(--accent-dark);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secondary { background: var(--raised); border-bottom-color: #222; }
.link {
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
  color: var(--text);
}

.tabs { display: flex; gap: 8px; }
.tabs button {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}
.tabs button[aria-pressed="true"] { border-color: var(--accent); background: var(--raised); }

/* The dashboard */
.shell { display: flex; min-height: 100vh; }
.nav {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav .brand { margin: 0 6px 16px; font-size: 18px; }
.nav button {
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.nav button[aria-current="page"] { background: var(--raised); }
.nav .who { margin-top: auto; padding: 0 10px; }

.main { flex: 1; min-width: 0; padding: 24px 28px 60px; }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 28px 0 10px; }
.intro { color: var(--muted); max-width: 760px; margin: 0 0 18px; }

.cards { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-width: 150px;
  cursor: pointer;
  text-align: left;
}
.card[aria-pressed="true"] { border-color: var(--accent); }
.card .n { font-size: 26px; font-weight: 800; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 8px 0 10px; }
.toolbar input[type="search"] { width: 240px; }
.chip {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}

.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: right; }
th:first-child, td:first-child, th.text, td.text { text-align: left; }
th { position: sticky; top: 0; background: var(--surface); font-weight: 600; }
th button { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #1e1e1e; }
tbody tr[aria-selected="true"] { background: #2a1416; }
tr.total td { font-weight: 700; }

.thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; background: var(--raised); display: block; }

/* The profile panel */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
}
.panel .photos { display: flex; gap: 8px; overflow-x: auto; }
.panel .photo { width: 150px; height: 150px; border-radius: 10px; object-fit: cover; background: var(--raised); flex-shrink: 0; }
.panel .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-top: 6px; }
.panel .close { align-self: flex-end; }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.fig { margin: 0; }
.turnback { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.spaced { margin-top: 10px; align-self: flex-start; }
.reasons button[aria-pressed="true"] { border-color: var(--accent); background: #3a1a1c; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .nav { width: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px 16px; }
  .nav .brand { margin: 0 12px 0 0; }
  .nav .who { margin: 0 0 0 auto; }
  .main { padding: 16px; }
}
