:root {
    --ink: #14213d;
    --muted: #64748b;
    --line: #dbe2ea;
    --surface: #ffffff;
    --background: #f3f6f9;
    --accent: #f59e0b;
    --danger: #b91c1c;
    --success: #166534;
    --radius: 14px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); }
a { color: inherit; }
button, input { font: inherit; }
input {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
}
input:focus { outline: 3px solid rgba(245, 158, 11, .22); border-color: var(--accent); }
label span { display: block; margin-bottom: 7px; font-weight: 700; font-size: .92rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.08; }
h2 { margin-top: 24px; }
.muted { color: var(--muted); line-height: 1.6; }
.eyebrow { color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .11em; font-size: .74rem; margin-bottom: 7px; }
.topbar {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 4vw;
    background: var(--ink);
    color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 850; }
.brand-small, .brand-mark {
    display: inline-grid;
    place-items: center;
    background: var(--accent);
    color: var(--ink);
    font-weight: 950;
    border-radius: 10px;
}
.brand-small { width: 40px; height: 40px; }
.brand-mark { width: 64px; height: 64px; margin-bottom: 18px; font-size: 1.25rem; }
.user-menu { display: flex; align-items: center; gap: 16px; }
.user-menu strong, .user-menu small { display: block; }
.user-menu small { opacity: .75; margin-top: 2px; }
.container { width: min(1180px, 92vw); margin: 0 auto; padding: 34px 0 60px; }
.page-header { display: flex; justify-content: space-between; gap: 22px; align-items: flex-start; margin-bottom: 26px; }
.status-chip, .badge { display: inline-flex; border-radius: 999px; font-weight: 800; font-size: .78rem; }
.status-chip { background: #dcfce7; color: var(--success); padding: 9px 13px; }
.badge { background: #eef2ff; color: #3730a3; padding: 5px 9px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card, .panel, .module-card, .auth-card, .installer-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(15, 23, 42, .055);
}
.stat-card { padding: 20px; }
.stat-card span { display: block; color: var(--muted); font-weight: 700; }
.stat-card strong { display: block; margin-top: 10px; font-size: 2rem; }
.panel { padding: 24px; }
.panel.narrow { max-width: 720px; }
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.module-card { padding: 20px; }
.module-card h3 { margin: 16px 0 8px; }
.module-card p { color: var(--muted); line-height: 1.55; margin-bottom: 0; }
.button {
    border: 0;
    border-radius: 10px;
    min-height: 42px;
    padding: 10px 16px;
    font-weight: 850;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.button.primary { background: var(--accent); color: var(--ink); }
.button.subtle { background: rgba(255,255,255,.12); color: #fff; }
.button.full { width: 100%; min-height: 50px; }
.stack { display: grid; gap: 16px; }
.auth-shell, .installer-shell { min-height: calc(100vh - 55px); display: grid; place-items: center; padding: 28px; }
.auth-card { width: min(440px, 100%); padding: clamp(25px, 5vw, 42px); }
.installer-card { width: min(850px, 100%); padding: clamp(25px, 5vw, 42px); }
.form-grid { display: grid; gap: 16px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.span-two { grid-column: span 2; }
.alert { width: min(1180px, 92vw); margin: 16px auto 0; border-radius: 10px; padding: 12px 14px; font-weight: 700; }
.auth-card .alert, .installer-card .alert { width: 100%; margin: 0 0 16px; }
.alert.error { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.alert.success { background: #dcfce7; color: var(--success); border: 1px solid #bbf7d0; }
.footer { text-align: center; color: var(--muted); padding: 20px; font-size: .85rem; }
.health-table { width: 100%; border-collapse: collapse; }
.health-table th, .health-table td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--line); }
.health-table th { width: 40%; }
@media (max-width: 850px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .module-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
    .brand > span:last-child, .user-menu > div { display: none; }
    .page-header { display: block; }
    .status-chip { margin-top: 12px; }
    .stat-grid, .module-grid, .form-grid.two { grid-template-columns: 1fr; }
    .span-two { grid-column: auto; }
    .container { width: min(94vw, 1180px); padding-top: 22px; }
    .panel { padding: 18px; }
}


/* v0.2 asset management */
select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}
select { min-height: 46px; }
textarea { resize: vertical; min-height: 110px; }
select:focus, textarea:focus { outline: 3px solid rgba(245, 158, 11, .22); border-color: var(--accent); }
.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav a { color: rgba(255,255,255,.78); text-decoration: none; font-weight: 800; padding: 9px 11px; border-radius: 9px; }
.main-nav a:hover, .main-nav a.active { color: #fff; background: rgba(255,255,255,.12); }
.button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.button.compact { min-height: 34px; padding: 6px 10px; font-size: .84rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.panel-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 18px; }
.panel-heading h2 { margin: 0; }
.module-link { text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.module-link:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(15,23,42,.10); }
.badge.success { background: #dcfce7; color: var(--success); }
.badge.neutral { background: #eef2f7; color: #475569; }
.filter-grid { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 14px; align-items: end; }
.filter-action { display: flex; gap: 8px; }
.table-panel { margin-top: 22px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 780px; }
.data-table th, .data-table td { text-align: left; padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table th { color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-size: .74rem; }
.data-table td small { display: block; color: var(--muted); margin-top: 4px; }
.data-table tr:last-child td { border-bottom: 0; }
.strong-link { font-weight: 850; text-decoration: none; }
.strong-link:hover { text-decoration: underline; }
.actions-cell { white-space: nowrap; text-align: right !important; }
.empty-state { text-align: center; padding: 38px 18px; border: 1px dashed var(--line); border-radius: 12px; background: #f8fafc; }
.empty-state p { color: var(--muted); }
.compact-empty { padding: 24px 15px; }
.split-layout { display: grid; grid-template-columns: minmax(330px, .8fr) minmax(520px, 1.2fr); gap: 22px; align-items: start; }
.checkbox-label { display: flex; align-items: center; gap: 10px; padding-top: 29px; }
.checkbox-label input { width: 20px; min-height: 20px; }
.checkbox-label span { margin: 0; }
.asset-detail-grid { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(420px, 1.2fr); gap: 22px; }
.qr-panel { display: flex; flex-direction: column; align-items: center; text-align: center; }
.qr-code { display: grid; place-items: center; margin: 0 auto 14px; }
.qr-code svg { display: block; width: 100%; height: auto; }
.qr-asset-number { font-size: clamp(1.55rem, 4vw, 2.25rem); letter-spacing: .04em; }
.qr-panel small { color: var(--muted); margin-top: 4px; }
.scan-url { max-width: 100%; font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; margin-top: 14px; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list div { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-weight: 750; }
.detail-list dd { margin: 0; font-weight: 700; }
.pre-line { white-space: pre-line; line-height: 1.6; }
.label-page { background: #fff; padding: 24px; }
.print-toolbar { display: flex; justify-content: center; gap: 10px; margin-bottom: 22px; }
.asset-label {
    width: 3in;
    min-height: 3in;
    margin: 0 auto;
    border: 2px solid #000;
    padding: .12in;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #fff;
    color: #000;
}
.asset-label .qr-code { width: 2.05in !important; margin: .04in auto; }
.label-company { font-size: 10pt; font-weight: 800; line-height: 1.1; }
.label-number { font-size: 19pt; font-weight: 950; line-height: 1.05; letter-spacing: .03em; }
.label-type { font-size: 10pt; font-weight: 800; margin-top: 2px; }
.label-instruction { font-size: 7pt; font-weight: 900; margin-top: 5px; letter-spacing: .08em; }

@media (max-width: 980px) {
    .topbar { flex-wrap: wrap; }
    .main-nav { order: 3; width: 100%; overflow-x: auto; }
    .filter-grid { grid-template-columns: 1fr 1fr; }
    .filter-action { align-self: end; }
    .split-layout, .asset-detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .filter-grid { grid-template-columns: 1fr; }
    .filter-action .button { flex: 1; }
    .actions-cell .button { margin: 2px 0; }
    .detail-list div { grid-template-columns: 1fr; gap: 4px; }
    .main-nav a { white-space: nowrap; }
}
@media print {
    .print-toolbar { display: none !important; }
    .label-page { margin: 0; padding: 0; }
    .asset-label { margin: 0; page-break-inside: avoid; }
    @page { margin: .15in; }
}
