/*
 * The design file's 02 · Components, for the browser: Button, Chip, Tab, Badge, Icon, Nav Item,
 * Stat Card, and the pieces every screen is built from. Each rule gives its Figma component.
 */

/* Button 16:13 — primary, secondary, ghost, danger. 12px Semi Bold, radius 10, padding 9/14. */
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 14px;
    border: 1px solid transparent; border-radius: var(--radius-md);
    font: 600 12px/15px "Inter", sans-serif;
    cursor: pointer; white-space: nowrap; text-decoration: none;
    background: none; color: var(--text-primary);
}
.button:hover { text-decoration: none; filter: brightness(1.08); }
.button:disabled { opacity: 0.5; cursor: default; }
.button--primary { background: var(--accent-primary); color: var(--text-inverse); }
.button--secondary { background: var(--bg-raised); border-color: var(--border-subtle); }
.button--ghost { background: none; color: var(--text-primary); }
.button--ghost:hover { background: var(--bg-hover); }
.button--danger { background: none; color: var(--status-loss); }
.button--danger:hover { background: var(--bg-hover); }
.button--wide { width: 100%; }

/* Chip 16:18 — on, off. 10px Semi Bold, radius 7, padding 5/10. */
.chip {
    display: inline-flex; align-items: center;
    padding: 5px 10px; border-radius: 7px;
    font: 600 10px/13px "Inter", sans-serif;
    background: var(--bg-raised); color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    cursor: pointer; text-decoration: none;
}
.chip:hover { text-decoration: none; color: var(--text-primary); }
.chip--on { background: var(--accent-dim); color: var(--accent-primary); border-color: transparent; }

/* Tab 16:28 — active, inactive, in a strip of tabs. 11px Semi Bold, radius 8, padding 6/14. */
.tabs {
    display: inline-flex; gap: 2px; padding: 3px;
    background: var(--bg-sidebar); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
}
.tab {
    padding: 6px 14px; border-radius: 8px; border: 0;
    font: 600 11px/14px "Inter", sans-serif;
    background: none; color: var(--text-secondary); cursor: pointer; text-decoration: none;
}
.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab--active { background: var(--bg-raised); color: var(--text-primary); }

/* Badge 16:23 — a count on a Nav Item. */
.badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 21px; padding: 2px 7px; border-radius: 20px;
    font: 600 10px/13px "Inter", sans-serif;
    background: var(--bg-raised); color: var(--text-secondary);
}
.badge--accent { background: var(--accent-primary); color: var(--text-inverse); }

/* The Top Bar's live pill: radius 20, a 7px dot, 10–11px Semi Bold. */
.pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 11px 5px 9px; border-radius: 20px;
    font: 600 10px/13px "Inter", sans-serif; white-space: nowrap;
    background: var(--bg-raised); color: var(--text-muted);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--accent { background: var(--accent-dim); color: var(--accent-primary); }
.pill--warn { color: var(--status-warn); }
.pill--blue { color: var(--accent-blue); }
.pill--loss { color: var(--status-loss); }
.pill--large { padding: 7px 13px 7px 11px; font-size: 11px; }

/* Icon 18:140 — twenty pixels, stroked in the color of the text round it. */
.icon { width: 20px; height: 20px; flex: none; color: var(--text-secondary); }
.icon--small { width: 14px; height: 14px; color: var(--text-muted); }
.icon--accent { color: var(--accent-primary); }
.icon-tile {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 36px; height: 36px; border-radius: var(--radius-md);
    background: var(--accent-dim);
}
.icon-tile .icon { color: var(--accent-primary); }
.icon-tile--quiet { background: var(--bg-raised); }
.icon-tile--quiet .icon { color: var(--text-secondary); }

/* Logo Mark — the spade on the accent, radius 9. */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text-primary); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand__mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 9px;
    background: var(--accent-primary); color: var(--text-inverse); font: 700 17px "Inter", sans-serif;
}
.brand__name { font-weight: 600; font-size: 14px; }
.brand__sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); }

/* A card, as the Stat Card and the dashboard's panels draw one: surface, subtle border, radius 14. */
.card {
    display: flex; flex-direction: column; gap: var(--space-3);
    padding: 14px 16px; border-radius: var(--radius-lg);
    background: var(--bg-surface); border: 1px solid var(--border-subtle);
}
.card--raised { background: var(--bg-raised); }
.card--chosen { background: var(--bg-raised); border-color: var(--accent-primary); }
.card--dashed { background: none; border: 1px dashed var(--border-strong); }

/* Stat Card 23:237. */
.stat { display: flex; flex-direction: column; gap: 8px; }
.stat__row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.stat__value { font-size: 22px; font-weight: 600; }
.stat__delta { padding: 2px 7px; border-radius: 20px; font: 600 10px "Inter", sans-serif; background: var(--accent-dim); color: var(--accent-primary); }
.stat__delta--down { background: var(--bg-raised); color: var(--status-loss); }

/* Input / Search and the fields of the HUD editor: a 9px label over an input, radius 8–9. */
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.input, .select, .textarea {
    width: 100%; padding: 8px 10px;
    border: 1px solid var(--border-subtle); border-radius: 8px;
    background: var(--bg-raised); color: var(--text-primary);
    font: 500 12px/18px "Inter", sans-serif;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent-primary); }
.textarea { resize: vertical; min-height: 64px; line-height: 1.6; }
.input--tall { padding: 8px 12px; min-height: 36px; border-radius: 9px; }
.search {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 10px; border-radius: 9px;
    background: var(--bg-raised); border: 1px solid var(--border-subtle);
}
.search input { flex: 1; border: 0; background: none; color: var(--text-primary); font: 400 12px "Inter", sans-serif; }
.search input:focus { outline: none; }
.kbd { padding: 2px 6px; border-radius: 5px; background: var(--bg-hover); font: 600 10px "Inter", sans-serif; color: var(--text-muted); }

/* Toggle, as Settings draws it: 32×18, radius 20, a 14px knob. */
.toggle { position: relative; display: inline-block; width: 32px; height: 18px; flex: none; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle span { position: absolute; inset: 0; border-radius: 20px; background: var(--bg-hover); pointer-events: none; transition: background 120ms; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-secondary); transition: transform 120ms; }
.toggle input:checked + span { background: var(--accent-primary); }
.toggle input:checked + span::after { transform: translateX(14px); background: var(--text-inverse); }
.toggle:has(input:focus-visible) span { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

/* The link past the navigation: the first thing a keyboard reaches, seen only while it has focus. */
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 100; padding: 10px 14px; border-radius: var(--radius-md); background: var(--accent-primary); color: var(--text-inverse); font-weight: 600; }
.skip-link:focus { top: 16px; }

/* A table, as the reports draw one. */
.table { width: 100%; border-collapse: collapse; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
.table-frame { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-surface); }
.table-frame .table { border: 0; border-radius: 0; }
.table th { height: 36px; padding: 0 16px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border-subtle); }
.table td { height: 44px; padding: 0 16px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); }
.table tr:last-child td { border-bottom: 0; }
.table td:first-child { color: var(--text-primary); font-weight: 500; }
.table .number { text-align: right; font-weight: 600; color: var(--text-primary); }
.table .end { text-align: right; }
.table tr.table__row--open td { background: var(--bg-hover); }

/* A menu: raised, strong border, radius 10. */
.menu {
    display: flex; flex-direction: column; gap: 2px; padding: 6px; min-width: 210px;
    background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
    box-shadow: var(--shadow-menu);
}
.menu__item {
    display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 0; border-radius: 8px;
    background: none; color: var(--text-secondary); font: 500 12px "Inter", sans-serif; text-align: left; cursor: pointer;
}
.menu__item:hover { background: var(--bg-hover); color: var(--text-primary); }
.menu__item--danger { color: var(--status-loss); }

/* A message a form answers with. */
.notice { padding: 10px 14px; border-radius: var(--radius-md); background: var(--bg-surface); border: 1px solid var(--border-subtle); font-weight: 500; font-size: 12px; color: var(--text-secondary); }
.notice--good { background: var(--accent-dim); border-color: transparent; color: var(--text-primary); }
.notice--bad { border-color: var(--status-loss); color: var(--text-primary); }
.validation-message { color: var(--status-loss); font-size: 11px; font-weight: 500; }

/* Across the top of every page while an admin impersonates an account, with the way back. */
.impersonating { background: var(--accent-dim); border-bottom: 1px solid var(--accent-primary); color: var(--text-primary); font-size: 13px; font-weight: 500; }
.impersonating__inner { display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.impersonating form { margin: 0; }

.row { display: flex; align-items: center; gap: var(--space-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.stack--tight { gap: 4px; }
.stack--loose { gap: 20px; }
.grow { flex: 1; min-width: 0; }
.divider { height: 1px; background: var(--border-subtle); border: 0; margin: 0; }

/* The skip link lands here; the landmark itself draws no ring. */
main:focus { outline: none; }
