/* ANZ Statistics Archive — shared styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #1a1a2e;
    line-height: 1.5;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }

/* ── Header / nav ───────────────────────────────────────── */

header { background: #0b2545; color: #fff; padding: 20px 0; }
header .hdr {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; flex-wrap: wrap;
    max-width: 1280px; margin: 0 auto; padding: 0 20px;
}
header h1 { font-size: 1.35rem; font-weight: 600; }
header h1 a { color: inherit; text-decoration: none; }
nav a { color: #9fb3c8; font-size: 0.8rem; text-decoration: none; margin-left: 16px; }
nav a:hover { color: #fff; }
nav a.active { color: #fff; font-weight: 500; }

/* ── Toolbar / filters ──────────────────────────────────── */

.toolbar { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 12px 0; }
.toolbar .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar label { font-size: 0.78rem; color: #64748b; margin-right: 4px; }

select, input[type="text"], input[type="search"], input[type="email"], input[type="password"], input[type="number"] {
    padding: 8px 11px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-size: 0.85rem; background: #fff; color: #1a1a2e; font-family: inherit;
}
select:focus, input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
input[type="search"] { min-width: 260px; }

button, .btn {
    padding: 8px 14px; background: #2563eb; color: #fff; border: none;
    border-radius: 6px; font-size: 0.85rem; cursor: pointer;
    font-family: inherit; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: #1d4ed8; }
.btn-secondary { background: #fff; color: #334155; border: 1px solid #cbd5e1; }
.btn-secondary:hover { background: #f1f5f9; }

/* ── Cards / grid ───────────────────────────────────────── */

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 20px 0; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 20px; }
.card-wide { grid-column: 1 / -1; }
.card h3 { font-size: .95rem; margin-bottom: 4px; }
.card .subtitle { font-size: .75rem; color: #64748b; margin-bottom: 12px; }
.card canvas { max-height: 320px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; padding: 20px 0 0; }
.stat { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 16px 18px; }
.stat .label { font-size: .72rem; color: #64748b; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.5rem; font-weight: 600; margin-top: 4px; }
.stat .note { font-size: .72rem; color: #94a3b8; margin-top: 2px; }

/* ── Tables ─────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
th {
    background: #f8fafc; font-weight: 600; color: #475569; font-size: .75rem;
    text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; z-index: 1;
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #eef2f7; }
th .arrow { color: #94a3b8; font-size: .7rem; }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 280px; }

.badge {
    display: inline-block; padding: 2px 7px; border-radius: 4px;
    font-size: .7rem; font-weight: 500; background: #e0e7ff; color: #3730a3;
}
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }

/* ── Pagination ─────────────────────────────────────────── */

.pagination { display: flex; gap: 6px; align-items: center; padding: 16px 0; flex-wrap: wrap; font-size: .82rem; }
.pagination a, .pagination span {
    padding: 6px 11px; border: 1px solid #cbd5e1; border-radius: 6px;
    text-decoration: none; color: #334155; background: #fff;
}
.pagination a:hover { background: #f1f5f9; }
.pagination .current { background: #2563eb; color: #fff; border-color: #2563eb; }
.pagination .disabled { color: #cbd5e1; }
.result-count { font-size: .8rem; color: #64748b; padding: 14px 0 6px; }

/* ── Tabs ───────────────────────────────────────────────── */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid #e2e8f0; margin: 18px 0 0; flex-wrap: wrap; }
.tabs a {
    padding: 9px 15px; font-size: .82rem; text-decoration: none; color: #64748b;
    border-bottom: 2px solid transparent;
}
.tabs a:hover { color: #1a1a2e; }
.tabs a.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 500; }

/* ── Expandable rows (catalogue browse) ─────────────────── */

.expand-toggle { cursor: pointer; color: #2563eb; font-size: .78rem; }
.expand-toggle:hover { text-decoration: underline; }
.detail-row { display: none; background: #f8fafc; }
.detail-row.open { display: table-row; }
.detail-row td { white-space: normal; padding: 14px 16px; }
.detail-row .notes { font-size: .8rem; color: #475569; margin-bottom: 10px; max-width: 900px; }
.res-list { display: flex; flex-direction: column; gap: 5px; }
.res-item { font-size: .78rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.res-item a { color: #2563eb; text-decoration: none; }
.res-item a:hover { text-decoration: underline; }

.sources-toggle { font-size: .75rem; color: #2563eb; cursor: pointer; margin-top: 8px; display: inline-block; }
.sources-toggle:hover { text-decoration: underline; }
.sources-list { display: none; margin-top: 6px; padding: 8px 12px; background: #f8fafc; border-radius: 4px; font-size: .75rem; }
.sources-list.open { display: block; }
.sources-list a { color: #2563eb; text-decoration: none; }

.no-data { color: #94a3b8; font-style: italic; font-size: .85rem; padding: 40px 0; text-align: center; }
.muted { color: #94a3b8; }

/* ── Forms / messages ───────────────────────────────────── */

.msg { padding: 10px 12px; border-radius: 6px; font-size: .82rem; margin-bottom: 14px; }
.msg-error { background: #fef2f2; color: #991b1b; }
.msg-ok { background: #f0fdf4; color: #166534; }
.msg-info { background: #eff6ff; color: #1e40af; }

.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-card { background: #fff; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.08); padding: 38px; width: 100%; max-width: 410px; }
.auth-card h1 { font-size: 1.22rem; margin-bottom: 4px; }
.auth-card .subtitle { font-size: .8rem; color: #64748b; margin-bottom: 22px; }
.auth-card label { display: block; font-size: .8rem; font-weight: 500; color: #334155; margin-bottom: 4px; }
.auth-card input { width: 100%; margin-bottom: 16px; }
.auth-card button { width: 100%; padding: 10px; }
.auth-card .link { display: block; text-align: center; margin-top: 16px; font-size: .8rem; color: #2563eb; text-decoration: none; }
.auth-card .link:hover { text-decoration: underline; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.form-grid label { display: block; font-size: .8rem; font-weight: 500; color: #334155; margin-bottom: 4px; }
.form-grid input, .form-grid select { width: 100%; }

.section-title { font-size: 1rem; font-weight: 600; margin: 22px 0 10px; }
.page-pad { padding-bottom: 40px; }
