/* CSS VARIABLES */
:root {
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --primary: #16A34A;
    --primary-hover: #117837;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --border: #e0e0e0;
    --radius: 8px;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);

    /* E-Ink Specific Colors */
    --ink-blue: #2980b9;
    --ink-red: #c0392b;
    --ink-green: #27ae60;
    --ink-yellow: #f1c40f;
}

html {
    scrollbar-gutter: stable;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    padding: 20px;
    line-height: 1.6;
}

/* LAYOUT */
.container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 20px;
}

@media (max-width: 900px) {
    .container {
        grid-template-columns: minmax(0, 1fr);
    }

    .top-bar {
        order: -2;
    }

    .preview-column {
        order: -1;
    }
}

@media (max-width: 600px) {
    .container .top-bar {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .top-bar .top-bar-title {
        justify-content: center;
    }

    .top-bar .top-bar-actions {
        justify-content: center;
    }

    .top-bar-actions .device-switcher {
        flex-basis: 100%;
    }

    .top-bar-actions .device-switcher select {
        max-width: none;
    }

    .btn-add-device,
    .btn-logout {
        flex: 1;
        justify-content: center;
    }
}

/* COMPONENTS */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 10px;
}

h3 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    margin-top: 15px;
}

/* TABS */
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: #dfe6e9;
    color: var(--text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    flex: 1 1 120px;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* FORMS */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 5px;
    font-weight: 500;
}

input[type="text"],
input[type="url"],
input[type="number"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 1rem;
}

/* Color Selection Radio */
.color-selector {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    position: relative;
    transition: all 0.2s;
}

.color-option.selected {
    border-color: var(--primary);
    transform: scale(1.1);
}

/* Disabled state for used colors */
.color-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    border-color: #ccc;
}

.color-option.disabled::after {
    content: "✕";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    font-size: 1.2rem;
}

.c-red {
    background-color: var(--ink-red);
}

.c-green {
    background-color: var(--ink-green);
}

.c-yellow {
    background-color: var(--ink-yellow);
}

.c-blue {
    background-color: var(--ink-blue);
}

/* Buttons */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-block {
    width: 100%;
    margin-bottom: 10px;
}

/* CALENDAR LIST */
.calendar-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fff;
}

.cal-toggle {
    margin-right: 15px;
    transform: scale(1.2);
    cursor: pointer;
}

.cal-info {
    flex-grow: 1;
    overflow: hidden;
    min-width: 0;
}

.cal-name {
    font-weight: bold;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cal-url {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* PREVIEW IMAGE */
.preview-container {
    position: relative;
    width: 100%;
    aspect-ratio: 800/480;
    background: #eee;
    border: 2px solid var(--text-main);
    border-radius: 4px;
    overflow: hidden;
    cursor: zoom-in;
}

.preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

.preview-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #fff;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: default;
}

.preview-empty-state .ph {
    font-size: 28px;
}

.preview-paired-state,
.preview-generic-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 18px;
    text-align: center;
}

.preview-paired-state {
    color: var(--text-main);
}

.preview-paired-state strong {
    margin-bottom: 4px;
    font-size: clamp(1.05rem, 2.7vw, 1.55rem);
}

.preview-paired-state span {
    font-size: clamp(0.7rem, 1.5vw, 0.95rem);
}

.preview-paired-state small {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: clamp(0.6rem, 1.25vw, 0.8rem);
}

.preview-container.preview-unavailable {
    cursor: default;
}

.preview-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding: 8px 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.stat-box {
    flex: 1;
    text-align: center;
}

.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    font-weight: 600;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}

.stat-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-content {
    max-width: 95%;
    max-height: 95%;
    border: 4px solid white;
}

/* UPLOAD AREA */
.upload-area {
    border: 2px dashed var(--border);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f0f8ff;
}

/* LOADING OVERLAY */
.loader-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(244, 247, 246, 0.8);
    z-index: 9999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: sans-serif;
}

.loader-container.visible {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e3e3e3;
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    color: #555;
    font-size: 14px;
    letter-spacing: 1px;
    font-weight: bold;
}

.add-calendar-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.add-calendar-title {
    color: var(--text-main);
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 15px;
}

#colorMsg {
    color: var(--danger);
    display: none;
    margin-top: 5px;
}

.photo-upload-desc {
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.controls-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.blank-control {
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
    margin: 4px 0;
    padding: 12px 0;
}

.blank-control .btn {
    width: 100%;
}

.blank-control .blank-control-active {
    background: var(--primary);
    color: #fff;
}

/* LOADING ANIMATION */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ─── LOGIN PAGE ─────────────────────────────────────────── */

.login-body {
    background: linear-gradient(135deg, #e8f0f2 0%, var(--bg-color) 50%, #e2eaed 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    padding: 36px 32px 32px;
    width: 100%;
    animation: loginFadeIn 0.4s ease-out;
}

@keyframes loginFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Login Header */
.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-icon {
    color: var(--primary);
    margin-bottom: 12px;
    display: inline-flex;
    font-size: 48px;
    line-height: 1;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    border-bottom: none;
    padding-bottom: 0;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* Login Error */
.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.25s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    margin-bottom: 0;
    padding: 0 14px;
}

.login-error .ph {
    font-size: 16px;
    flex-shrink: 0;
}

.login-error.visible {
    opacity: 1;
    max-height: 60px;
    margin-bottom: 20px;
    padding: 10px 14px;
}

/* Input with Icon */
.input-with-icon {
    position: relative;
}

.input-with-icon input {
    width: 100%;
    padding: 10px 10px 10px 40px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-with-icon input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
    font-size: 18px;
    line-height: 1;
}

.input-with-icon input:focus ~ .input-icon,
.input-with-icon input:focus + .input-icon {
    color: var(--primary);
}

/* The icon is a sibling before the input, so we reverse the selector */
.input-with-icon:has(input:focus) .input-icon {
    color: var(--primary);
}

/* Login Button */
.login-btn {
    margin-top: 8px;
    padding: 12px 20px;
    font-size: 1rem;
    border-radius: 6px;
    position: relative;
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.login-btn-spinner {
    display: none;
    align-items: center;
    color: white;
}

.login-btn-spinner:not([hidden]) {
    display: inline-flex;
}

.login-spinner-icon {
    font-size: 18px;
    line-height: 1;
    animation: spin 0.8s linear infinite;
}

/* Login Footer */
.login-footer {
    margin-top: 24px;
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

/* Shake Animation for invalid login */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-6px); }
    30% { transform: translateX(5px); }
    45% { transform: translateX(-4px); }
    60% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* ─── LOGOUT BUTTON ──────────────────────────────────────── */

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    grid-column: 1 / -1;
}

.top-bar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-title .ph {
    color: var(--primary);
    font-size: 24px;
    line-height: 1;
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: #fef2f2;
}

/* ─── DASHBOARD HIDDEN UNTIL AUTH ─────────────────────────── */

.container.auth-pending {
    opacity: 0;
    pointer-events: none;
}

/* --- SECONDARY BUTTON --- */
.btn-secondary {
    background: #f1f5f9;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 100%;
}

.btn-secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

/* --- CARD HEADER STATUS & BADGES --- */
.card-header-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header-status h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.header-badges {
    display: flex;
    gap: 8px;
    align-items: center;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: var(--primary);
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background-color: var(--text-muted);
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(22, 163, 74, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

/* --- DEVICE DETAILS MODAL --- */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal-card.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1), 
                0 1px 3px rgba(0, 0, 0, 0.05),
                inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    width: 90%;
    max-width: 440px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.open .modal-card.glass {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.btn-close-modal {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-close-modal:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

.modal-body {
    padding: 24px;
}

/* SPECIFICATION GRID */
.device-spec-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.03);
    border-radius: 8px;
}

.spec-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.spec-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

/* OTA SECTION */
.ota-section {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding-top: 20px;
}

.ota-section h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    font-weight: 650;
    color: var(--text-main);
}

.ota-status-container {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.ota-status-label {
    color: var(--text-muted);
}

.ota-status-value {
    font-weight: 600;
    color: var(--primary);
}

.btn-ota {
    font-size: 0.9rem;
    padding: 10px;
}
/* ─── ADDED: real-data dashboard components ───────────────────────────── */

/* Utility */
[hidden] { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Top bar actions + device switcher */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.device-switcher select {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    max-width: 220px;
    cursor: pointer;
}

.btn-add-device {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: var(--primary);
    background: none;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-add-device:hover {
    background: var(--primary);
    color: #fff;
}

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 60px 24px;
    text-align: center;
}

.empty-state-icon {
    font-size: 56px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 12px;
}

.empty-state h2 { border: none; }
.empty-state p { color: var(--text-muted); margin-bottom: 20px; }
.empty-state-btn { max-width: 260px; margin: 0 auto; text-decoration: none; }

.empty-cal-note { text-align: center; color: #999; padding: 8px 0; }

/* Settings extras */
.quiet-hours-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quiet-hours-inputs input[type="time"] {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
}

.quiet-hours-sep { color: var(--text-muted); font-size: 0.85rem; }
.label-hint { color: var(--text-muted); font-weight: 400; font-size: 0.8rem; }

.settings-hint, .controls-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.4;
}

.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.btn-cal-delete {
    padding: 5px 10px;
    margin-left: 20px;
    font-size: 0.8rem;
}

.btn-disabled { opacity: 0.5; cursor: not-allowed; }

/* Photo upload progress */
.upload-progress {
    height: 8px;
    background: var(--bg-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 14px;
}

.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.2s ease;
}

/* Details modal: danger + mono */
.danger-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.danger-section h4 { margin-bottom: 6px; color: var(--danger); }
.danger-desc { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }
.spec-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }

.confirmation-modal-card { max-width: 400px; }

.confirmation-copy {
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-actions .btn { width: auto; }

/* Controls layout */
.controls-group { display: flex; flex-direction: column; gap: 8px; }

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-main);
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 2000;
    max-width: 90vw;
    text-align: center;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-error { background: var(--danger); }

/* Login: notice, links, mode toggle */
.login-notice {
    display: none;
    align-items: center;
    gap: 8px;
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.login-notice.visible { display: flex; }

.login-links { text-align: right; margin-bottom: 16px; }

.login-toggle {
    text-align: center;
    margin-top: 18px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}

.link-btn:hover { text-decoration: underline; }
