:root {
    color-scheme: dark;
    --online-bg: #050505;
    --online-panel: #0a0a0a;
    --online-line: #4d4d4d;
    --online-soft: #222;
    --online-text: #f3f3f3;
    --online-muted: #a8a8a8;
    --online-danger: #8e3438;
    --online-success: #2f7b4a;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body.online-page {
    margin: 0;
    color: var(--online-text);
    background:
        radial-gradient(circle at top, rgba(255,255,255,.045), transparent 38%),
        var(--online-bg);
    font-family: Baskerville, "Times New Roman", Georgia, serif;
}

button, input { font: inherit; }

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.online-card {
    border: 1px solid var(--online-line);
    background: rgba(8,8,8,.96);
    box-shadow: 0 22px 70px rgba(0,0,0,.48);
}

.login-card {
    width: min(520px, 100%);
    padding: clamp(28px, 6vw, 58px);
    text-align: center;
}

.online-eyebrow {
    margin: 0 0 8px;
    color: var(--online-muted);
    font-size: .74rem;
    letter-spacing: .18em;
}

.login-card h1,
.dashboard-header h1,
.online-card h2 {
    margin: 0;
    font-weight: 400;
    letter-spacing: .04em;
}

.online-lead {
    margin: 18px auto 28px;
    color: var(--online-muted);
    line-height: 1.55;
}

.google-login-button,
.online-button {
    border: 1px solid #777;
    background: #fff;
    color: #050505;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}

.google-login-button:hover,
.online-button:hover {
    transform: translateY(-1px);
    background: #050505;
    color: #fff;
    border-color: #fff;
}

.google-login-button {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 18px;
    font-weight: 700;
}

.google-mark {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
}

.online-status {
    min-height: 22px;
    margin: 16px 0 0;
    color: var(--online-muted);
}

.online-status[data-type="error"] { color: #e49191; }
.online-status[data-type="success"] { color: #8ad9a5; }
.online-muted { color: var(--online-muted); }

.loading-ring {
    width: 48px;
    height: 48px;
    margin: 0 auto 24px;
    border: 3px solid #242424;
    border-top-color: #fff;
    border-radius: 50%;
    animation: onlineSpin .8s linear infinite;
}

@keyframes onlineSpin { to { transform: rotate(360deg); } }

.dashboard-shell {
    width: min(1180px, calc(100% - 28px));
    margin: 0 auto;
    padding: 30px 0 60px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-header h1 { font-size: clamp(2rem, 5vw, 3.4rem); }

.online-button {
    min-height: 38px;
    padding: 8px 15px;
}

.online-button-secondary {
    background: transparent;
    color: #fff;
}

.online-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.authorization-card,
.sheets-card {
    padding: 22px;
    margin-bottom: 20px;
}

.authorize-form {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    gap: 12px;
    align-items: end;
    margin-top: 18px;
}

.authorize-form label {
    display: grid;
    gap: 6px;
}

.authorize-form label span {
    color: var(--online-muted);
    font-size: .78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.authorize-form input {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--online-soft);
    border-bottom-color: var(--online-line);
    background: #050505;
    color: #fff;
    outline: none;
}

.authorize-form input:focus { border-color: #fff; }

.dashboard-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.sheets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
}

.sheet-dashboard-card {
    padding: 18px;
    border: 1px solid var(--online-soft);
    background: #050505;
}

.sheet-dashboard-card h3 {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 400;
}

.sheet-dashboard-meta {
    min-height: 48px;
    margin: 0 0 15px;
    color: var(--online-muted);
    font-size: .88rem;
    line-height: 1.5;
}

.empty-dashboard-message {
    color: var(--online-muted);
    text-align: center;
    padding: 24px;
}

/* Barra superior da ficha online */
.online-sheet-toolbar {
    width: min(1500px, calc(100% - 24px));
    margin: 14px auto 0;
    padding: 9px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #323232;
    background: #060606;
    color: #d9d9d9;
    font-family: Baskerville, "Times New Roman", Georgia, serif;
}

.online-sheet-toolbar-group {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.online-sheet-toolbar button,
.online-sheet-toolbar a {
    min-height: 31px;
    padding: 5px 10px;
    border: 1px solid #555;
    background: #050505;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.online-sheet-toolbar button:hover,
.online-sheet-toolbar a:hover {
    background: #fff;
    color: #000;
}

.online-save-status {
    color: #a8a8a8;
    font-size: .84rem;
}

.online-save-status[data-state="saving"] { color: #d6c489; }
.online-save-status[data-state="saved"] { color: #8ad9a5; }
.online-save-status[data-state="error"] { color: #e49191; }

.sheet-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    background: #000;
    color: #fff;
    text-align: center;
}

.sheet-loading-overlay[hidden] { display: none; }

@media (max-width: 760px) {
    .authorize-form { grid-template-columns: 1fr; }
    .dashboard-header,
    .dashboard-section-heading,
    .online-sheet-toolbar { align-items: flex-start; flex-direction: column; }
}


.dashboard-heading-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 720px) {
    .dashboard-heading-actions {
        width: 100%;
        justify-content: stretch;
    }

    .dashboard-heading-actions .online-button {
        flex: 1 1 180px;
    }
}
