:root {
    --bg: #eef1f8;
    --bg-2: #e4e9f4;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #d8dee9;
    --surface: #ffffff;
    --accent: #0052fe;
    --accent-hover: #0041cb;
    --accent-soft: #e0eaff;
    --warn: #b45309;
    --warn-soft: #fef3c7;
    --ok: #047857;
    --ok-soft: #d1fae5;
    --danger: #b91c1c;
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    --radius: 18px;
}

* { box-sizing: border-box; }

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

body.skin {
    margin: 0;
    font-family: "DM Sans", ui-sans-serif, system-ui, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1200px 500px at 10% -10%, #dbe6ff 0%, transparent 55%),
        radial-gradient(900px 400px at 100% 0%, #e8f0ff 0%, transparent 50%),
        var(--bg);
}

a { color: var(--accent); }

.skin-shell { min-height: 100vh; }

.skin-nav {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(16px);
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid var(--line);
}

.skin-nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
    min-height: 64px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.03em;
    flex-shrink: 0;
    min-width: 0;
}

.brand-logo {
    display: block;
    height: 28px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0052fe, #3b7cff);
    color: white;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
}

.skin-links {
    display: none;
    gap: 6px;
    flex: 1;
    justify-content: center;
}

.skin-link {
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.skin-link:hover,
.skin-link.is-active {
    color: var(--ink);
    background: var(--accent-soft);
}

.skin-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.skin-user {
    display: none;
    border: 1px solid var(--line);
    background: white;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.skin-logout-desktop { display: none; }

.skin-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: white;
    border-radius: 12px;
    padding: 8px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
}

.skin-mobile-panel {
    display: grid;
    gap: 4px;
    padding: 8px 16px 16px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
}

.skin-mobile-link {
    display: block;
    text-decoration: none;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    padding: 12px 14px;
    border-radius: 12px;
}

.skin-mobile-link.is-active,
.skin-mobile-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.skin-mobile-user {
    margin-top: 8px;
    padding: 10px 14px 0;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.skin-mobile-logout {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 14px;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.page-head .page-title,
.page-head .page-sub {
    margin-bottom: 0;
}

.page-head .page-sub {
    margin-top: 6px;
}

.skin-main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 20px 56px;
}

.page-title {
    margin: 0 0 6px;
    font-size: 28px;
    letter-spacing: -0.04em;
}

.page-sub {
    margin: 0 0 22px;
    color: var(--muted);
    font-size: 14px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-pad { padding: 22px; }

.card-head {
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.stat {
    padding: 20px;
}

.stat-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.stat-value {
    margin-top: 8px;
    font-size: 32px;
    letter-spacing: -0.05em;
    font-weight: 700;
}

.stat-value.ok { color: var(--ok); }
.stat-value.warn { color: var(--warn); }

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

.table th,
.table td {
    text-align: left;
    padding: 13px 18px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    vertical-align: top;
}

.table th {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: #f7f9fc;
}

.table tr:last-child td { border-bottom: 0; }

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.btn,
.btn-ghost,
.btn-ok,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    border-radius: 12px;
    padding: 10px 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
}

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

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

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-ok {
    background: var(--ok-soft);
    color: var(--ok);
}

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

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
}

.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: #fee2e2; color: var(--danger); }

.alert {
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 14px;
}

.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-bad { background: #fee2e2; color: var(--danger); }

.field {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    background: #f8faff;
}

.w-full { width: 100%; }

.field:focus {
    outline: 2px solid #a8c0ff;
    border-color: var(--accent);
}

label.lbl {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 18px;
}

.cal-nav h3 {
    margin: 0;
    font-size: 18px;
    text-align: center;
    flex: 1;
}

.cal-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.cal-nav-btn:hover {
    background: #c9d9ff;
    color: var(--accent-hover);
}

.cal-nav-btn.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}

.cal-week,
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
}

.cal-week {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: center;
}

.cal-day {
    min-height: 64px;
    min-width: 0;
    border: 1px solid var(--line);
    background: white;
    border-radius: 12px;
    padding: 6px 4px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    overflow: hidden;
}

.cal-day-top {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    min-width: 0;
    flex-wrap: wrap;
}

.cal-day-num {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    flex-shrink: 0;
}

.cal-badge {
    max-width: 100%;
    padding: 1px 5px;
    font-size: 9px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.cal-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 9px;
    line-height: 1.2;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.cal-meta-ok,
.cal-meta-warn {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-meta-ok { color: var(--ok); }
.cal-meta-warn { color: var(--warn); }

.cal-day:hover {
    border-color: #a8c0ff;
    background: #f0f4ff;
}

.cal-day.is-muted {
    background: #f4f6fb;
    color: #94a3b8;
}

.cal-day.is-past {
    cursor: default;
    opacity: 0.4;
    pointer-events: none;
    background: #f4f6fb;
}

.cal-day.is-today,
.cal-day.is-today-locked {
    cursor: default;
    opacity: 1;
    pointer-events: none;
    background: #fff;
    border: 2px solid var(--accent);
    box-shadow: none;
    color: var(--accent);
    padding: 5px 3px;
}

.modal-scrim {
    position: fixed;
    inset: 0;
    background: rgba(16, 28, 22, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 50;
}

.modal {
    width: min(460px, 100%);
    background: white;
    border-radius: 20px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
}

.auth-hero {
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: white;
    background:
        linear-gradient(160deg, rgba(0, 82, 254, 0.92), rgba(0, 65, 203, 0.88)),
        url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M50 50h20v20H50zM10 10h20v20H10z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.auth-hero h1 {
    font-size: 42px;
    line-height: 1.1;
    letter-spacing: -0.05em;
    margin: 12px 0;
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.auth-card {
    width: min(420px, 100%);
    background: white;
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 28px;
    box-shadow: var(--shadow);
}

.auth-card h2 {
    margin: 0 0 6px;
    font-size: 26px;
    letter-spacing: -0.04em;
}

.hidden { display: none; }
.desktop-only { display: none; }
.mobile-only { display: block; }
@media (min-width: 640px) {
    .desktop-only { display: block; }
    .mobile-only { display: none; }
}

.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.empty { padding: 28px; color: var(--muted); text-align: center; }

.relative { position: relative; }
.menu-pop {
    position: absolute;
    top: calc(100% + 8px);
    min-width: 180px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 6px;
    z-index: 40;
}
.menu-pop.is-right { right: 0; }
.menu-link {
    display: block;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
}
.menu-link:hover { background: var(--accent-soft); }

[x-cloak] { display: none !important; }

@media (max-width: 899px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-hero { min-height: 220px; padding: 28px; }
    .stats { grid-template-columns: 1fr; }
    .skin-main { padding: 18px 12px 40px; }
    .brand-logo {
        height: 20px;
        max-width: 100px;
    }
    .skin-nav-inner {
        min-height: 56px;
        padding: 0 12px;
    }
    .card-pad { padding: 14px; }
    .page-title { font-size: 22px; }
    .row { flex-wrap: wrap; }
    .cal-nav { margin-bottom: 12px; }
    .cal-nav-btn { width: 32px; height: 32px; }
    .cal-week,
    .cal-grid { gap: 4px; }
    .cal-day {
        min-height: 56px;
        border-radius: 10px;
        padding: 4px 3px;
    }
    .cal-day.is-today,
    .cal-day.is-today-locked { padding: 3px 2px; }
    .cal-day-num { font-size: 12px; }
    .cal-badge { font-size: 8px; padding: 1px 3px; }
    .cal-meta { font-size: 8px; }
    .table thead { display: none; }
    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }
    .table tr {
        padding: 14px 16px;
        border-bottom: 1px solid var(--line);
    }
    .table tr:last-child { border-bottom: 0; }
    .table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 6px 0;
        border-bottom: 0;
        text-align: right;
        word-break: break-word;
    }
    .table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        max-width: 42%;
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--muted);
    }
    .table td.table-actions-cell {
        display: block;
        padding-top: 10px;
        text-align: left;
    }
    .table td.table-actions-cell::before { display: none; }
    .table-actions { justify-content: flex-start; }
    .table td.empty {
        display: block;
        text-align: center;
        padding: 20px 0;
    }
    .table td.empty::before { display: none; }
}

@media (min-width: 900px) {
    .skin-links { display: flex; }
    .skin-user { display: inline-block; }
    .skin-logout-desktop { display: block; }
    .skin-menu-btn { display: none; }
    .skin-mobile-panel { display: none !important; }
}

@media (min-width: 768px) {
    .cal-day {
        min-height: 88px;
        padding: 8px;
        border-radius: 14px;
    }
    .cal-day.is-today,
    .cal-day.is-today-locked { padding: 7px; }
    .cal-day-num { font-size: 14px; }
    .cal-badge { font-size: 10px; padding: 2px 6px; }
    .cal-meta { font-size: 11px; gap: 2px; }
    .cal-week,
    .cal-grid { gap: 8px; }
}
