/* Geneticker Usage — storage & data dashboard (usage.geneticker.com)
 * Vanilla CSS, no build step. Lives at /var/www/usage on the prod host.
 * Talks to /api/vault/* on the same origin (host nginx → docker nginx → backend). */

:root {
    --body-font: 'Google Sans Text', 'Google Sans', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --display-font: 'Google Sans', 'Google Sans Text', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    --mono-font: 'Roboto Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    --text: #202124;
    --text-2: #5f6368;
    --text-3: #80868b;
    --border: #dadce0;
    --border-soft: #e8eaed;
    --surface: #f8f9fa;
    --surface-2: #f1f3f4;
    --blue: #1a73e8;
    --blue-strong: #1557b0;
    --green: #0d904f;
    --amber: #e37400;
    --red: #d93025;
    --purple: #8b5cf6;
    --teal: #00897b;
    --indigo: #5e35b1;
    --ipfs: #1a73e8;     /* off-server / Pinata */
    --server: #e37400;   /* our servers */
    --shadow: 0 1px 3px rgba(60,64,67,0.10), 0 4px 12px rgba(60,64,67,0.06);
    --shadow-lg: 0 8px 28px rgba(60,64,67,0.16);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--body-font);
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 50%, #f5f0ff 100%);
    background-attachment: fixed;
    min-height: 100vh; color: var(--text); line-height: 1.5;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { font-family: var(--display-font); letter-spacing: -0.4px; }
b { font-weight: 600; }
code { font-family: var(--mono-font); font-size: 0.85em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.material-icons-outlined { font-size: 20px; line-height: 1; vertical-align: middle; }

/* ═══════ TOP BAR ═══════ */
.top-bar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 60px;
    background: rgba(255,255,255,0.85); backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border);
}
.logo-area { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-area img { width: 30px; height: 30px; border-radius: 7px; }
.logo-area span { font-size: 1.05rem; font-weight: 500; font-family: var(--display-font); }
.logo-area em { font-style: normal; color: var(--amber); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.acct-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 50px; background: var(--surface);
    border: 1px solid var(--border-soft); font-size: 0.82rem; font-weight: 500; color: var(--text-2);
}
.acct-badge .material-icons-outlined { font-size: 18px; color: var(--amber); }
.icon-btn {
    width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: transparent; border: none; cursor: pointer; color: var(--text-2);
    transition: background 0.12s ease;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }

/* ═══════ AUTH VIEW ═══════ */
.auth-view { display: flex; align-items: flex-start; justify-content: center; padding: 64px 20px 80px; }
.auth-card {
    width: 100%; max-width: 520px; background: rgba(255,255,255,0.9); backdrop-filter: blur(12px);
    border: 1px solid var(--border); border-radius: 20px; padding: 40px; box-shadow: var(--shadow-lg);
}
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 50px;
    background: rgba(227,116,0,0.08); color: var(--amber); font-size: 0.78rem; font-weight: 500;
    margin-bottom: 22px; border: 1px solid rgba(227,116,0,0.18);
}
.chip .material-icons-outlined { font-size: 16px; }
.auth-card h1 { font-size: 1.9rem; font-weight: 500; line-height: 1.18; margin-bottom: 16px; letter-spacing: -1px; }
.auth-sub { font-size: 0.92rem; color: var(--text-2); line-height: 1.65; margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.78rem; font-weight: 600; color: var(--text-2); }
.field input, .field textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px;
    font-family: var(--body-font); font-size: 0.9rem; color: var(--text); background: white;
    transition: border-color 0.15s ease, box-shadow 0.15s ease; resize: vertical;
}
.field textarea { font-family: var(--mono-font); font-size: 0.82rem; line-height: 1.5; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,115,232,0.12); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 22px; border-radius: 10px; font-size: 0.92rem; font-weight: 500;
    font-family: var(--display-font); border: none; cursor: pointer; text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.btn-primary { background: var(--blue); color: white; box-shadow: 0 2px 10px rgba(26,115,232,0.25); }
.btn-primary:hover { background: var(--blue-strong); box-shadow: 0 4px 18px rgba(26,115,232,0.35); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.login-error {
    font-size: 0.82rem; color: var(--red); background: rgba(217,48,37,0.07);
    border: 1px solid rgba(217,48,37,0.2); border-radius: 8px; padding: 9px 12px;
}
.auth-fineprint {
    display: flex; align-items: flex-start; gap: 8px; margin-top: 24px; padding-top: 20px;
    border-top: 1px solid var(--border-soft); font-size: 0.78rem; color: var(--text-3); line-height: 1.6;
}
.auth-fineprint .material-icons-outlined { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.auth-fineprint code { font-size: 0.74rem; }

/* ═══════ LOADING ═══════ */
.loading-view { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 120px 20px; color: var(--text-2); }
.spinner {
    width: 44px; height: 44px; border-radius: 50%;
    border: 4px solid rgba(26,115,232,0.18); border-top-color: var(--blue); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════ DASHBOARD SCAFFOLD ═══════ */
.dash { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 22px; }

.acct-strip {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
    background: rgba(255,255,255,0.82); border: 1px solid var(--border); border-radius: 16px; padding: 18px 22px; box-shadow: var(--shadow);
}
.acct-id { display: flex; align-items: center; gap: 14px; }
.acct-avatar { font-size: 44px !important; color: var(--amber); }
.acct-name { font-size: 1.15rem; font-weight: 600; font-family: var(--mono-font); color: var(--text); }
.acct-meta { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 4px; font-size: 0.8rem; color: var(--text-2); }
.acct-meta span { display: inline-flex; align-items: center; gap: 5px; }
.acct-meta .material-icons-outlined { font-size: 15px; color: var(--text-3); }
.acct-generated { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-2); }
.acct-generated .material-icons-outlined { font-size: 16px; color: var(--text-3); }

/* KPI row */
.kpi-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.kpi {
    background: rgba(255,255,255,0.86); border: 1px solid var(--border); border-radius: 14px;
    padding: 16px 16px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--blue)); }
.kpi-ico { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.kpi-ico .material-icons-outlined { font-size: 18px; }
.kpi-val { font-size: 1.35rem; font-weight: 600; font-family: var(--display-font); line-height: 1.1; letter-spacing: -0.5px; }
.kpi-val small { font-size: 0.62em; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.kpi-label { font-size: 0.74rem; color: var(--text-2); margin-top: 3px; }
.kpi-sub { font-size: 0.68rem; color: var(--text-3); margin-top: 4px; }

/* Panels */
.panel { background: rgba(255,255,255,0.82); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.panel-head { margin-bottom: 18px; }
.panel-head h2 { font-size: 1.15rem; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.panel-head h2 .material-icons-outlined { font-size: 20px; color: var(--blue); }
.panel-head p { font-size: 0.84rem; color: var(--text-2); margin-top: 6px; line-height: 1.55; max-width: 760px; }

/* Storage split */
.split-body { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: center; }
.split-donut { display: flex; align-items: center; justify-content: center; }
.split-legend { display: flex; flex-direction: column; gap: 12px; }
.legend-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--surface); }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.legend-text { flex: 1; }
.legend-name { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.legend-desc { font-size: 0.74rem; color: var(--text-3); margin-top: 1px; }
.legend-val { text-align: right; }
.legend-bytes { font-size: 0.95rem; font-weight: 600; font-family: var(--display-font); }
.legend-pct { font-size: 0.74rem; color: var(--text-3); }

/* Mini cards */
.mini-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.mini { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; padding: 13px 15px; }
.mini-val { font-size: 1.15rem; font-weight: 600; font-family: var(--display-font); letter-spacing: -0.4px; }
.mini-val small { font-size: 0.6em; font-weight: 500; color: var(--text-3); }
.mini-label { font-size: 0.72rem; color: var(--text-2); margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.mini-label .material-icons-outlined { font-size: 13px; color: var(--text-3); }

/* Account usage / quota ring */
.account-usage { border-top: 1px dashed var(--border); padding-top: 18px; }
.account-usage-head h3 { font-size: 0.98rem; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.account-usage-head h3 .material-icons-outlined { font-size: 18px; color: var(--ipfs); }
.account-usage-head p { font-size: 0.8rem; color: var(--text-2); margin-top: 5px; }
.account-usage-body { display: flex; align-items: center; gap: 28px; margin-top: 16px; flex-wrap: wrap; }
.quota-ring { flex-shrink: 0; }
.quota-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; flex: 1; min-width: 240px; }
.qstat { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; padding: 11px 13px; }
.qstat-val { font-size: 1.05rem; font-weight: 600; font-family: var(--display-font); }
.qstat-label { font-size: 0.71rem; color: var(--text-2); margin-top: 2px; }

/* Server grid */
.server-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 26px; margin-top: 6px; }
.server-grid h3, .global-context h3 { font-size: 0.95rem; font-weight: 500; display: flex; align-items: center; gap: 7px; margin-bottom: 14px; }
.server-grid h3 .material-icons-outlined { font-size: 17px; color: var(--server); }

/* Horizontal bars */
.bar-row { margin-bottom: 11px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.bar-name { font-size: 0.8rem; color: var(--text); display: flex; align-items: center; gap: 6px; }
.bar-name .swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.bar-val { font-size: 0.78rem; font-weight: 600; color: var(--text-2); font-family: var(--mono-font); }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; min-width: 2px; }
.bar-sub { font-size: 0.68rem; color: var(--text-3); margin-top: 3px; }

/* Global context */
.global-context { border-top: 1px dashed var(--border); padding-top: 18px; margin-top: 18px; }
.gctx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.gctx-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 12px; padding: 14px 16px; }
.gctx-title { font-size: 0.78rem; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; margin-bottom: 9px; }
.gctx-title .material-icons-outlined { font-size: 15px; color: var(--text-3); }
.gctx-line { display: flex; justify-content: space-between; font-size: 0.76rem; padding: 3px 0; color: var(--text-2); }
.gctx-line b { font-family: var(--mono-font); color: var(--text); font-weight: 500; }

/* Files table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 12px; }
.files-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.files-table thead th {
    text-align: left; padding: 11px 14px; background: var(--surface); color: var(--text-2);
    font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.files-table th.num, .files-table td.num { text-align: right; }
.files-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.files-table tbody tr:last-child td { border-bottom: none; }
.files-table tbody tr:hover { background: rgba(26,115,232,0.03); }
.file-name { font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 7px; max-width: 230px; }
.file-name .material-icons-outlined { font-size: 16px; color: var(--text-3); }
.file-name .fn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-build { font-size: 0.68rem; color: var(--text-3); margin-top: 2px; }
.deleted-row { opacity: 0.6; }
.ipfs-cell { min-width: 140px; }
.ipfs-bytes { font-family: var(--mono-font); font-size: 0.78rem; font-weight: 500; }
.ipfs-bar { height: 5px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.ipfs-bar > span { display: block; height: 100%; background: var(--ipfs); border-radius: 4px; }
.mono { font-family: var(--mono-font); }
.cid {
    font-family: var(--mono-font); font-size: 0.74rem; color: var(--blue); cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px; max-width: 150px;
}
.cid:hover { text-decoration: underline; }
.cid .material-icons-outlined { font-size: 13px; opacity: 0.6; }
.cid-none { color: var(--text-3); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 50px; font-size: 0.68rem; font-weight: 600; white-space: nowrap; }
.badge .material-icons-outlined { font-size: 12px; }
.badge-green { background: rgba(13,144,79,0.1); color: var(--green); }
.badge-amber { background: rgba(227,116,0,0.12); color: var(--amber); }
.badge-red { background: rgba(217,48,37,0.1); color: var(--red); }
.badge-grey { background: var(--surface-2); color: var(--text-2); }
.badge-blue { background: rgba(26,115,232,0.1); color: var(--blue); }

.files-empty { text-align: center; color: var(--text-3); padding: 28px; font-size: 0.88rem; }

/* Methodology */
.methodology ul { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.methodology li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.83rem; color: var(--text-2); line-height: 1.6; }
.methodology li .material-icons-outlined { font-size: 17px; color: var(--green); flex-shrink: 0; margin-top: 1px; }
.methodology li b { color: var(--text); font-weight: 600; }

.dash-footer { text-align: center; font-size: 0.76rem; color: var(--text-3); padding: 12px; line-height: 1.6; }

/* Toast */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: #202124; color: white; padding: 11px 20px; border-radius: 10px;
    font-size: 0.84rem; box-shadow: var(--shadow-lg); z-index: 200; max-width: 90vw;
}
.toast.success { background: #0d652d; }
.toast.error { background: #b3261e; }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 1000px) {
    .kpi-row { grid-template-columns: repeat(3, 1fr); }
    .server-grid { grid-template-columns: 1fr; }
    .split-body { grid-template-columns: 1fr; }
    .split-donut { margin: 0 auto; }
}
@media (max-width: 620px) {
    .top-bar { padding: 0 14px; }
    .logo-area span { font-size: 0.95rem; }
    .dash { padding: 18px 14px 48px; }
    .panel { padding: 18px 16px; }
    .auth-card { padding: 28px 22px; }
    .auth-card h1 { font-size: 1.5rem; }
    .kpi-row { grid-template-columns: repeat(2, 1fr); }
    .acct-meta { gap: 10px; }
}
