:root {
    --ink: #17212b;
    --muted: #697888;
    --line: #d9e5eb;
    --surface: #ffffff;
    --surface-soft: #f7fbfc;
    --brand: #235f8f;
    --brand-dark: #17476e;
    --accent: #2aa876;
    --amber: #d99018;
    --red: #c53b35;
    --shadow: 0 18px 50px rgba(24, 52, 71, 0.11);
}

:root[data-theme="dark"] {
    --ink: #edf6f8;
    --muted: #aab8c4;
    --line: #263b4a;
    --surface: #13222d;
    --surface-soft: #0d1820;
    --brand: #54a7df;
    --brand-dark: #2d75ac;
    --accent: #45c18c;
    --amber: #e0a02c;
    --red: #e45b54;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(42, 168, 118, 0.16), transparent 34rem),
        linear-gradient(135deg, #f7fbfc 0%, #eef6f7 48%, #f9fbf7 100%);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

:root[data-theme="dark"] body {
    background:
        radial-gradient(circle at top left, rgba(84, 167, 223, 0.16), transparent 34rem),
        linear-gradient(135deg, #09131a 0%, #0d1820 52%, #111f1c 100%);
}

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

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(217, 229, 235, 0.85);
    display: flex;
    justify-content: space-between;
    min-height: 74px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 20;
}

:root[data-theme="dark"] .topbar {
    background: rgba(13, 24, 32, 0.9);
    border-bottom-color: rgba(38, 59, 74, 0.95);
}

.brand {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    font-size: 18px;
    font-weight: 800;
    gap: 12px;
    letter-spacing: 0;
    text-decoration: none;
}

.brand img {
    display: block;
    height: 44px;
    object-fit: contain;
    width: 44px;
}

.page {
    margin: 0 auto;
    max-width: 1320px;
    padding: 28px 28px 104px;
}

.auth-panel,
.detail,
.event-form,
.calendar-panel,
.summary-panel,
.welcome-panel,
.app-panel {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(217, 229, 235, 0.95);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

:root[data-theme="dark"] .auth-panel,
:root[data-theme="dark"] .detail,
:root[data-theme="dark"] .event-form,
:root[data-theme="dark"] .calendar-panel,
:root[data-theme="dark"] .summary-panel,
:root[data-theme="dark"] .welcome-panel,
:root[data-theme="dark"] .app-panel {
    background: rgba(19, 34, 45, 0.96);
    border-color: rgba(38, 59, 74, 0.98);
}

.auth-panel,
.detail {
    margin: 48px auto;
    max-width: 480px;
    padding: 34px;
}

.detail {
    max-width: 760px;
}

.auth-logo {
    display: block;
    height: 78px;
    margin: 0 auto 18px;
    object-fit: contain;
    width: 78px;
}

.panel-logo {
    display: block;
    height: 56px;
    margin-bottom: 14px;
    object-fit: contain;
    width: 56px;
}

h1,
h2 {
    letter-spacing: 0;
    margin: 0 0 18px;
}

h1 {
    color: var(--ink);
    font-size: 30px;
    line-height: 1.12;
}

h2 {
    font-size: 20px;
}

.form {
    display: grid;
    gap: 15px;
}

label {
    color: #3f5263;
    display: grid;
    font-size: 14px;
    font-weight: 650;
    gap: 7px;
}

input,
textarea {
    background: #fbfdfe;
    border: 1px solid #cbdbe3;
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    min-height: 44px;
    padding: 11px 13px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
    width: 100%;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] textarea {
    background: #0d1820;
    border-color: #324858;
    color: var(--ink);
}

input:focus,
textarea:focus {
    background: #ffffff;
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(35, 95, 143, 0.13);
    outline: none;
}

textarea {
    resize: vertical;
}

.check {
    align-items: center;
    background: #f3f8f9;
    border: 1px solid #d9e5eb;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    padding: 12px;
}

:root[data-theme="dark"] .check,
:root[data-theme="dark"] .creator-card,
:root[data-theme="dark"] .day-number {
    background: #0d1820;
    border-color: var(--line);
}

.check input {
    accent-color: var(--brand);
    width: auto;
}

.button,
.icon-button {
    align-items: center;
    background: linear-gradient(180deg, var(--brand), var(--brand-dark));
    border: 1px solid var(--brand-dark);
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(35, 95, 143, 0.18);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 800;
    justify-content: center;
    min-height: 44px;
    padding: 0 17px;
    text-decoration: none;
    transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.button:hover,
.icon-button:hover {
    box-shadow: 0 14px 26px rgba(35, 95, 143, 0.23);
    transform: translateY(-1px);
}

.icon-button {
    background: #ffffff;
    box-shadow: none;
    color: var(--brand);
    font-size: 22px;
    min-width: 44px;
    padding: 0;
}

.button.ghost {
    background: #ffffff;
    box-shadow: none;
    color: var(--brand);
}

:root[data-theme="dark"] .button.ghost,
:root[data-theme="dark"] .icon-button {
    background: #13222d;
    border-color: var(--line);
}

.button.success {
    background: linear-gradient(180deg, var(--accent), #1f805c);
    border-color: #1f805c;
}

.button.danger {
    background: linear-gradient(180deg, var(--red), #982a26);
    border-color: #982a26;
}

.muted {
    color: var(--muted);
    line-height: 1.55;
}

.alert {
    border: 1px solid transparent;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(24, 52, 71, 0.08);
    margin-bottom: 18px;
    padding: 13px 15px;
}

.alert.success {
    background: #e8f8ef;
    border-color: #bfe7d0;
    color: #17613e;
}

.alert.error {
    background: #fff0ed;
    border-color: #f2c5bf;
    color: #8f2c27;
}

.agenda-shell {
    align-items: start;
    display: grid;
    gap: 24px;
    grid-template-columns: 360px 1fr;
}

.app-home,
.app-panel {
    margin: 0 auto;
    max-width: 1100px;
}

.welcome-panel {
    align-items: center;
    display: flex;
    gap: 16px;
    margin-bottom: 22px;
    padding: 22px;
}

.welcome-panel span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.welcome-panel h1 {
    margin: 0;
}

.summary-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-panel {
    padding: 20px;
}

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

.section-heading h2 {
    margin: 0;
}

.section-heading span {
    align-items: center;
    background: var(--amber);
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    height: 28px;
    justify-content: center;
    min-width: 28px;
    padding: 0 8px;
}

.event-list {
    display: grid;
    gap: 10px;
}

.event-row {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    grid-template-columns: 12px 1fr;
    padding: 12px;
    text-decoration: none;
}

.event-row strong {
    color: var(--ink);
    display: block;
}

.event-row small {
    color: var(--muted);
    display: block;
    margin-top: 3px;
}

.event-dot {
    border-radius: 999px;
    display: block;
    height: 12px;
    width: 12px;
}

.app-panel {
    padding: 22px;
}

.event-form,
.calendar-panel {
    padding: 22px;
}

.event-form {
    position: sticky;
    top: 98px;
}

.contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.contacts button {
    background: #edf7f4;
    border: 1px solid #bfe3d7;
    border-radius: 999px;
    color: #176b50;
    cursor: pointer;
    font-weight: 700;
    padding: 8px 11px;
}

.legend {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 9px;
    margin-top: 20px;
    padding-top: 17px;
}

.legend span {
    align-items: center;
    color: #405465;
    display: flex;
    font-size: 14px;
    gap: 9px;
}

.legend i {
    border-radius: 999px;
    display: block;
    height: 12px;
    width: 12px;
}

.blue { background: var(--brand); }
.amber { background: var(--amber); }
.green { background: var(--accent); }
.red { background: var(--red); }

.calendar-toolbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
}

.calendar-toolbar h2 {
    margin: 0;
    text-transform: capitalize;
}

.calendar {
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 1px;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    overflow: hidden;
}

.weekday,
.day {
    border: 0;
    min-height: 116px;
    padding: 9px;
}

.weekday {
    background: #edf5f7;
    color: #405465;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    min-height: 42px;
    text-align: center;
}

.day {
    background: #ffffff;
}

:root[data-theme="dark"] .day {
    background: #13222d;
}

.day.out {
    background: #f8fbfc;
    color: #9aa9b5;
}

:root[data-theme="dark"] .day.out,
:root[data-theme="dark"] .weekday {
    background: #0d1820;
    color: #718597;
}

.day-number {
    align-items: center;
    background: #f1f6f8;
    border-radius: 999px;
    display: inline-flex;
    font-size: 13px;
    font-weight: 800;
    height: 26px;
    justify-content: center;
    margin-bottom: 7px;
    min-width: 26px;
    padding: 0 7px;
}

.event-pill {
    border-radius: 7px;
    box-shadow: 0 7px 14px rgba(24, 52, 71, 0.12);
    color: #ffffff;
    display: block;
    font-size: 12px;
    font-weight: 750;
    margin-top: 6px;
    overflow: hidden;
    padding: 6px 7px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.participants {
    display: grid;
    gap: 10px;
    list-style: none;
    padding: 0;
}

.participants li {
    align-items: center;
    background: #fbfdfe;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    padding: 13px;
}

:root[data-theme="dark"] .participants li,
:root[data-theme="dark"] .event-row {
    background: #0d1820;
}

.creator-card {
    background: #f3f8f9;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 3px;
    margin: 4px 0 14px;
    padding: 12px 14px;
}

.creator-card span,
.creator-card small {
    color: var(--muted);
}

.creator-card span {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.creator-card strong {
    color: var(--ink);
}

.participant-check {
    align-items: center;
    display: flex;
    flex: 1;
    gap: 10px;
}

.participant-check input {
    accent-color: var(--brand);
    width: auto;
}

.participant-check span {
    color: var(--ink);
    font-weight: 700;
}

.button.compact {
    box-shadow: none;
    font-size: 13px;
    min-height: 34px;
    padding: 0 11px;
}

.hidden-form {
    display: none;
}

.approvers-form {
    display: grid;
    gap: 12px;
}

.detail-heading {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.detail-heading h1 {
    margin-bottom: 8px;
}

.status {
    border-radius: 999px;
    color: #ffffff;
    font-size: 12px;
    padding: 6px 10px;
}

.status.pending { background: var(--amber); }
.status.approved { background: var(--accent); }
.status.declined { background: var(--red); }
.status.private { background: var(--brand); }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.back {
    display: inline-block;
    font-weight: 700;
    margin-bottom: 18px;
    text-decoration: none;
}

.modal-backdrop {
    align-items: center;
    background: rgba(23, 33, 43, 0.48);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 18px;
    position: fixed;
    z-index: 80;
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 28px 80px rgba(23, 33, 43, 0.24);
    max-width: 420px;
    padding: 24px;
    width: 100%;
}

:root[data-theme="dark"] .modal {
    background: #13222d;
}

.modal h2 {
    margin-bottom: 10px;
}

.modal p {
    color: var(--muted);
    line-height: 1.5;
    margin: 0 0 18px;
}

.bottom-tabs {
    align-items: center;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
    bottom: 0;
    box-shadow: 0 -14px 40px rgba(24, 52, 71, 0.12);
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    left: 50%;
    max-width: 760px;
    padding: 8px;
    position: fixed;
    transform: translateX(-50%);
    width: calc(100% - 28px);
    z-index: 60;
}

:root[data-theme="dark"] .bottom-tabs {
    background: rgba(19, 34, 45, 0.96);
}

.tab-button,
.theme-option {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    min-height: 42px;
    padding: 0 10px;
}

.tab-button.active,
.tab-button:hover,
.theme-option.active,
.theme-option:hover {
    background: var(--brand);
    color: #ffffff;
}

.theme-options {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 16px;
}

.theme-option {
    background: var(--surface-soft);
    border-color: var(--line);
    color: var(--ink);
}

@media (max-width: 900px) {
    .agenda-shell {
        grid-template-columns: 1fr;
    }

    .event-form {
        position: static;
    }
}

@media (max-width: 760px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .topbar {
        min-height: 68px;
        padding: 0 14px;
    }

    .brand span {
        display: none;
    }

    .page {
        padding: 14px 14px 104px;
    }

    .auth-panel,
    .detail,
    .event-form,
    .calendar-panel {
        padding: 18px;
    }

    .weekday,
    .day {
        min-height: 88px;
        padding: 6px;
    }

    .event-pill {
        font-size: 11px;
        padding: 5px;
    }

    .bottom-tabs {
        width: 100%;
    }

    .tab-button {
        font-size: 12px;
        padding: 0 5px;
    }
}
