/* UAA / SAA Data — shared styles.
   Matches the Build Data dashboard palette so the two feel like one system. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue:       #1565C0;
    --blue-dark:  #0d47a1;
    --ink:        #1a1a2e;
    --muted:      #6b7280;
    --line:       #e3e6eb;
    --bg:         #f0f2f5;
    --pass:       #2e7d32;
    --pass-bg:    #e8f5e9;
    --fail:       #c62828;
    --fail-bg:    #fdecea;
    --uaa:        #7E57C2;
    --saa:        #26A69A;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: #333;
    min-height: 100vh;
    font-size: 14px;
}

/* ---------- Login ---------- */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 36px 32px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-card h1 { font-size: 1.35rem; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.login-card p  { font-size: 0.88rem; color: var(--muted); margin-bottom: 22px; }
.login-card input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    outline: none;
    margin-bottom: 14px;
    transition: border-color 0.2s;
}
.login-card input[type="password"]:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
}
.login-card button {
    width: 100%;
    padding: 11px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--blue);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.login-card button:hover { background: var(--blue-dark); }
.error-box {
    font-size: 0.85rem;
    color: var(--fail);
    background: var(--fail-bg);
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 14px;
    text-align: left;
}

/* ---------- Shell ---------- */
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 20;
    flex-wrap: wrap;
}
.topbar .brand {
    font-weight: 700;
    color: var(--ink);
    font-size: 1.02rem;
    padding: 14px 0;
    white-space: nowrap;
}
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a {
    padding: 15px 12px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.topbar nav a:hover   { color: var(--ink); }
.topbar nav a.active  { color: var(--blue); border-bottom-color: var(--blue); }
.topbar .spacer { flex: 1; }
.link-btn {
    background: none;
    border: none;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 4px;
}
.link-btn:hover { color: var(--fail); }

.container { max-width: 1500px; margin: 0 auto; padding: 22px 24px 60px; }

.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 1.4rem; color: var(--ink); margin-bottom: 4px; }
.page-head p  { color: var(--muted); font-size: 0.88rem; }

/* ---------- Cards / tiles ---------- */
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 18px;
}
.card h2 {
    font-size: 0.95rem;
    color: var(--ink);
    margin-bottom: 14px;
    font-weight: 700;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.tile {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--blue);
    border-radius: 10px;
    padding: 16px 18px;
}
.tile.uaa  { border-left-color: var(--uaa); }
.tile.saa  { border-left-color: var(--saa); }
.tile.pass { border-left-color: var(--pass); }
.tile.fail { border-left-color: var(--fail); }
.tile .label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 6px;
}
.tile .value {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.tile .sub { font-size: 0.78rem; color: var(--muted); margin-top: 5px; }

/* ---------- Filters ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    font-weight: 700;
}
.field input, .field select {
    padding: 8px 10px;
    border: 1px solid #ccd1d9;
    border-radius: 6px;
    font: inherit;
    font-size: 0.88rem;
    outline: none;
    background: #fff;
    min-width: 130px;
}
.field input:focus, .field select:focus { border-color: var(--blue); }
.field.grow { flex: 1; min-width: 200px; }
.field.grow input { width: 100%; }

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--blue-dark); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.ghost {
    background: #fff;
    color: var(--muted);
    border: 1px solid #ccd1d9;
}
.btn.ghost:hover:not(:disabled) { background: #f5f7fa; color: var(--ink); }
.btn.danger { background: var(--fail); }
.btn.danger:hover:not(:disabled) { background: #a01d1d; }

/* ---------- Table ---------- */
.table-wrap {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: auto;
    max-height: 68vh;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
table.data th {
    position: sticky;
    top: 0;
    background: #f7f9fc;
    text-align: left;
    padding: 10px 12px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    z-index: 1;
}
table.data th:hover { color: var(--ink); }
table.data th .arrow { color: var(--blue); margin-left: 3px; }
table.data td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f2f5;
    white-space: nowrap;
}
table.data tbody tr:hover { background: #f7fbff; }
table.data td.num { text-align: right; }
table.data td.dim { color: #b0b6bf; }

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}
.pill.pass { background: var(--pass-bg); color: var(--pass); }
.pill.fail { background: var(--fail-bg); color: var(--fail); }
.pill.none { background: #eceff1; color: #78909c; }
.pill.sheet   { background: #e3f2fd; color: #1565C0; }
.pill.manual  { background: #fff3e0; color: #e65100; }
.pill.machine { background: #e0f2f1; color: #00695c; }

/* ---------- Entry modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 22, 32, 0.55);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    z-index: 50;
}
.modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 1.05rem; color: var(--ink); }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
}
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 18px 20px; }
.modal-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    background: #fafbfc;
    border-radius: 0 0 12px 12px;
}
.modal-foot .spacer { flex: 1; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.form-grid .field input,
.form-grid .field select { width: 100%; min-width: 0; }
.form-grid .field.full { grid-column: 1 / -1; }
.form-section {
    grid-column: 1 / -1;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--blue);
    font-weight: 700;
    border-bottom: 1px solid var(--line);
    padding-bottom: 5px;
    margin-top: 4px;
}
.field .hint { font-size: 0.72rem; color: var(--muted); font-weight: 400; }
.field input:disabled { background: #f4f6f8; color: var(--muted); }

table.data tbody tr.clickable { cursor: pointer; }

/* ---------- API docs page ---------- */
.doc { max-width: 900px; }
.doc h2 {
    font-size: 1.05rem;
    color: var(--ink);
    margin: 0 0 12px;
    font-weight: 700;
}
.doc h3 {
    font-size: 0.9rem;
    color: var(--ink);
    margin: 20px 0 8px;
    font-weight: 700;
}
.doc p, .doc li { line-height: 1.65; margin-bottom: 10px; }
.doc ul { margin: 0 0 12px 20px; }
.doc code {
    background: #eef1f5;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: 'Cascadia Mono', Consolas, 'Courier New', monospace;
    font-size: 0.85em;
    color: #b02a37;
}

.codeblock { position: relative; margin: 0 0 16px; }
.codeblock pre {
    background: #1e2430;
    color: #e6edf3;
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: 'Cascadia Mono', Consolas, 'Courier New', monospace;
    font-size: 0.82rem;
    line-height: 1.55;
}
.codeblock pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
.codeblock .copy {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.12);
    color: #e6edf3;
    border: none;
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}
.codeblock .copy:hover { background: rgba(255,255,255,0.24); }

table.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 16px;
}
table.doc-table th {
    text-align: left;
    padding: 8px 10px;
    background: #f7f9fc;
    border-bottom: 1px solid var(--line);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
table.doc-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: top;
}
table.doc-table td:first-child { white-space: nowrap; }

.doc-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.doc-toc a {
    background: #eef3fa;
    color: var(--blue);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}
.doc-toc a:hover { background: #dce8f7; }

.verb {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 2px 7px;
    margin-right: 6px;
    font-family: 'Cascadia Mono', Consolas, monospace;
}
.verb.post { background: #e8f5e9; color: #2e7d32; }
.verb.get  { background: #e3f2fd; color: #1565C0; }

.table-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 12px 0;
    color: var(--muted);
    font-size: 0.85rem;
}

/* ---------- Stats table ---------- */
table.stats {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
table.stats th, table.stats td {
    padding: 7px 10px;
    border-bottom: 1px solid #f0f2f5;
    text-align: right;
}
table.stats th:first-child, table.stats td:first-child { text-align: left; color: var(--muted); }
table.stats thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
}

.muted  { color: var(--muted); }
.empty  { padding: 40px 20px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

.notice {
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.88rem;
    margin-bottom: 14px;
    line-height: 1.5;
}
.notice.info { background: #e3f2fd; color: #0d47a1; border: 1px solid #bbdefb; }
.notice.warn { background: #fff8e1; color: #8a6d00; border: 1px solid #ffe6a0; }
.notice.ok   { background: var(--pass-bg); color: var(--pass); border: 1px solid #c8e6c9; }
.notice.err  { background: var(--fail-bg); color: var(--fail); border: 1px solid #f5c6cb; }
.notice ul { margin: 6px 0 0 18px; }

@media (max-width: 700px) {
    .container { padding: 16px 12px 40px; }
    .topbar { padding: 0 12px; gap: 12px; }
}
