:root {
    --bg-start: #0f172a;
    --bg-end: #1e293b;
    --panel: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --accent: #0f766e;
    --accent-hover: #115e59;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --ring: rgba(15, 118, 110, 0.35);
    --home-bg: #f5f5f5;
    --home-border: #6b4;
}

* {
    box-sizing: border-box;
}

.home-body {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 800px;
    margin: 50px auto;
    padding: 20px;
    background: var(--home-bg);
}

.home-container {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.home-container h1 {
    color: #333;
    border-bottom: 3px solid var(--home-border);
    padding-bottom: 10px;
}

.home-container code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.home-info {
    color: #666;
    margin-top: 20px;
}

.home-time {
    color: var(--home-border);
    font-weight: bold;
}

.nav {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.nav a,
.nav button {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #334155;
    border-radius: 8px;
    padding: 7px 12px;
    text-decoration: none;
    font-size: 0.88rem;
    cursor: pointer;
}

.nav a:hover,
.nav button:hover {
    background: #f8fafc;
}

.nav form {
    margin: 0;
}

.login-body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 20%, rgba(45, 212, 191, 0.15), transparent 45%),
        radial-gradient(circle at 80% 10%, rgba(56, 189, 248, 0.12), transparent 40%),
        linear-gradient(165deg, var(--bg-start), var(--bg-end));
    padding: 24px;
}

.login-panel {
    width: min(420px, 100%);
    background: var(--panel);
    border-radius: 18px;
    padding: 30px;
    box-shadow: 0 18px 60px rgba(2, 6, 23, 0.35);
    animation: appear 220ms ease-out;
}

.login-panel h1 {
    margin: 0 0 8px;
    font-size: 1.55rem;
    letter-spacing: -0.01em;
}

.login-subtitle {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.45;
}

.alert {
    margin-bottom: 16px;
    border: 1px solid #fecaca;
    background: var(--danger-bg);
    color: var(--danger);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.login-form label {
    display: block;
    margin: 0 0 6px;
    font-size: 0.86rem;
    font-weight: 600;
    color: #334155;
}

.login-form input {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 11px 12px;
    margin: 0 0 14px;
    font-size: 0.95rem;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

.login-form button {
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 12px;
    font-size: 0.96rem;
    font-weight: 700;
    color: white;
    background: var(--accent);
    cursor: pointer;
    transition: background 120ms ease, transform 120ms ease;
}

.login-form button:hover {
    background: var(--accent-hover);
}

.login-form button:active {
    transform: translateY(1px);
}

.foot {
    margin-top: 14px;
    color: #64748b;
    font-size: 0.8rem;
    text-align: center;
}

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dash-body, .admin-body {
    margin: 0;
    min-height: 100vh;
    background: var(--home-bg);
    font-family: system-ui, -apple-system, sans-serif;
    color: var(--text);
}

.dash-nav {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 24px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.dash-nav a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.dash-nav-logout {
    margin-left: auto;
}

.dash-nav-logout button, .admin-widget-form button, .todo-add button, .invite-result button, .login-form button {
    border: 0;
    border-radius: 8px;
    padding: 7px 12px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
}

.dash-main, .admin-main {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 24px;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.widget {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.widget-card {
    padding: 16px;
}

.widget-card h2 {
    margin: 0 0 10px;
    font-size: 1.05rem;
    color: #334155;
}

.widget-status {
    font-weight: 700;
    font-size: 1.2rem;
    margin: 4px 0;
}

.widget-ok { color: #047857; }
.widget-bad { color: var(--danger); }
.widget-warn { color: var(--muted); font-style: italic; }
.widget-meta { color: var(--muted); font-size: 0.82rem; }

.todo-add {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.todo-add input[name="text"] {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 10px;
}

.todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
}

.todo-item.todo-done .todo-text {
    text-decoration: line-through;
    color: var(--muted);
}

.todo-text { flex: 1; }

.todo-toggle button, .todo-del button {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 6px;
    padding: 2px 8px;
    cursor: pointer;
}

.todo-empty { color: var(--muted); padding: 6px 0; }

.ha-table {
    width: 100%;
    border-collapse: collapse;
}

.ha-table td {
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}

.ha-table td:last-child {
    text-align: right;
    color: var(--accent);
}

.admin-card {
    background: #fff;
    padding: 18px;
    margin-bottom: 18px;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.admin-users, .admin-invites {
    width: 100%;
    border-collapse: collapse;
}

.admin-users th, .admin-users td, .admin-invites th, .admin-invites td {
    padding: 8px 6px;
    border-bottom: 1px solid #f1f5f9;
    text-align: left;
    font-size: 0.9rem;
}

.admin-widget-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.admin-widget-form label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
}

.invite-result {
    margin-top: 10px;
    padding: 10px;
    background: #ecfeff;
    border-radius: 8px;
    word-break: break-all;
}

.invite-result code {
    display: block;
    font-family: monospace;
    margin-top: 4px;
    color: #0e7490;
}

.dash-empty, .admin-empty {
    color: var(--muted);
    font-style: italic;
}

