/*
  DIRECTION: Compteur Mécanique — every score change is a mechanical
  tally-counter click, not a UI transition. Graphite housing, cream
  drum-digit windows, one vermillon lamp for the live/active state.
  Seed key 9e5ffcac. See PRODUCT.md / DESIGN.md.
*/

@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=Martian+Mono:wght@400;500;700&family=Chivo+Mono:wght@400;500;700&display=swap");

:root {
  --graphite: #101216;
  --panel: #1c1e23;
  --panel-raised: #23262c;
  --panel-line: #34373e;
  --steel: #9aa2ac;
  --steel-dim: #4a4e56;
  --cream: #f4efe4;
  --cream-dim: #d8d2c2;
  --ink: #14171b;
  --vermillon: #ef4b23;
  --vermillon-dim: rgba(239, 75, 35, 0.18);
  --danger: #c73a3a;
  --danger-dim: rgba(199, 58, 58, 0.18);
  --success: #4a9a5c;

  --font-body: "Archivo", system-ui, sans-serif;
  --font-mono: "Martian Mono", "Chivo Mono", monospace;
  --font-mono-label: "Chivo Mono", monospace;

  --radius: 8px;
  --radius-lg: 12px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--graphite);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  font-family: var(--font-body);
  font-weight: 600;
  margin: 0 0 0.5rem;
  text-wrap: balance;
}

.tb-label {
  font-family: var(--font-mono-label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--steel);
}

/* Digit window — the drum-counter number display */
.tb-window {
  background: var(--cream);
  border: 1px solid var(--steel);
  border-radius: 6px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
  text-align: center;
  padding: 8px 6px 6px;
}
.tb-window .tb-window-label {
  font-family: var(--font-mono-label);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b5f4f;
  margin-bottom: 2px;
}
.tb-window .tb-window-digit {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Panel — the housing that groups controls */
.tb-panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 6px 18px rgba(0, 0, 0, 0.3);
}
.tb-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--panel-line);
}
.tb-panel-body {
  padding: 18px;
}

/* Lamp — small indicator light */
.tb-lamp {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--steel-dim);
  flex-shrink: 0;
}
.tb-lamp--lit {
  background: var(--vermillon);
  box-shadow: 0 0 7px rgba(239, 75, 35, 0.75);
}

/* Buttons — read as levers with visible press depth */
.tb-btn {
  font-family: var(--font-mono-label);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cream);
  background: var(--panel-raised);
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  padding: 10px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.tb-btn:hover {
  border-color: var(--steel-dim);
}
.tb-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.tb-btn--accent {
  color: var(--vermillon);
  border-color: rgba(239, 75, 35, 0.4);
}
.tb-btn--primary {
  color: var(--ink);
  background: var(--vermillon);
  border-color: var(--vermillon);
}
.tb-btn--primary:hover {
  background: #ff5a30;
}
.tb-btn--danger {
  color: var(--danger);
  border-color: rgba(199, 58, 58, 0.4);
}
.tb-btn--ghost {
  background: transparent;
  box-shadow: none;
}
.tb-btn--sm {
  padding: 6px 10px;
  font-size: 12px;
}
.tb-btn--block {
  width: 100%;
  text-align: center;
}
.tb-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Icon + label buttons — the icon reads as an engraved pictogram on the
   lever, sized to sit on the button's baseline without overpowering it. */
.tb-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.tb-btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Form fields — recessed instrument-panel inputs */
.tb-field {
  margin-bottom: 14px;
}
.tb-field label {
  display: block;
  font-family: var(--font-mono-label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 6px;
}
.tb-input,
.tb-select,
.tb-textarea {
  width: 100%;
  background: var(--graphite);
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.4);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
}
.tb-input:focus,
.tb-select:focus,
.tb-textarea:focus {
  outline: none;
  border-color: var(--vermillon);
}
.tb-input[type="file"] {
  box-shadow: none;
  padding: 8px;
}

/* Table */
.tb-table-wrap {
  overflow-x: auto;
}
.tb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tb-table th {
  text-align: left;
  font-family: var(--font-mono-label);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--steel);
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-line);
  white-space: nowrap;
}
.tb-table th a {
  color: var(--steel);
}
.tb-table th a:hover {
  color: var(--cream);
  text-decoration: none;
}
.tb-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-line);
  vertical-align: middle;
}
.tb-table tr:last-child td {
  border-bottom: none;
}
.tb-table img.tb-thumb {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--panel-line);
}

/* Matricule / code badge — mono, coded like a federation card */
.tb-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--steel);
  letter-spacing: 0.03em;
}

/* Flash messages */
.tb-flash {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid;
}
.tb-flash--success {
  background: rgba(74, 154, 92, 0.12);
  border-color: rgba(74, 154, 92, 0.35);
  color: #7fd192;
}
.tb-flash--error {
  background: var(--danger-dim);
  border-color: rgba(199, 58, 58, 0.4);
  color: #e58989;
}

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

.tb-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tb-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
