:root {
    color-scheme: light;
    --background: #ffffff;
    --surface: #fbfcfe;
    --text: #10131a;
    --muted: #8390a6;
    --border: #d6dde8;
    --border-strong: #bec8d7;
    --accent: #1455d9;
    --accent-hover: #0d47c1;
    --due: #ee3f22;
    --due-soft: #fff8f6;
    --radius: 12px;
    --shadow-focus: 0 0 0 3px rgba(20, 85, 217, 0.14);
    --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background: var(--background);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button {
    color: inherit;
}

.app-header {
    height: 108px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.98);
}

.header-inner {
    width: min(100% - 92px, 1412px);
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 2.6vw, 2.5rem);
    font-weight: 750;
    line-height: 1.1;
    letter-spacing: -0.045em;
}

h2 {
    margin-bottom: 36px;
    font-size: 1.65rem;
    font-weight: 720;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.push-button {
    min-height: 58px;
    padding: 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    color: var(--accent);
    background: #ffffff;
    font-size: 1rem;
    font-weight: 650;
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.push-button svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.push-button:hover:not(:disabled) {
    color: #ffffff;
    background: var(--accent);
}

.push-button:active:not(:disabled) {
    transform: translateY(1px);
}

.push-button[data-state="active"] {
    color: #ffffff;
    background: var(--accent);
}

.push-button[data-state="blocked"],
.push-button:disabled {
    border-color: var(--border-strong);
    color: #6f7c90;
    background: #f5f7fa;
    cursor: default;
}

.push-button[data-state="blocked"]:not(:disabled) {
    cursor: pointer;
}

.workspace {
    width: min(100% - 92px, 1412px);
    margin: 0 auto;
    padding: 38px 0 72px;
    display: grid;
    grid-template-columns: minmax(460px, 606px) minmax(520px, 1fr);
    align-items: start;
    gap: clamp(44px, 3.6vw, 54px);
}

.form-panel {
    padding: 34px 30px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.events-panel {
    padding-top: 18px;
}

.events-panel h2 {
    margin-bottom: 28px;
}

.field {
    margin-bottom: 32px;
}

.field label {
    margin-bottom: 9px;
    display: block;
    font-size: 1rem;
    font-weight: 580;
    line-height: 1.25;
}

input[type="text"],
input[type="date"],
input[type="time"],
select {
    width: 100%;
    height: 68px;
    padding: 0 17px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    outline: none;
    color: var(--text);
    background: #ffffff;
    font-size: 1rem;
    line-height: 1;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

input::placeholder {
    color: var(--muted);
    opacity: 1;
}

input:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}

.schedule-toggle {
    margin: 10px 0 36px;
    padding: 0;
    border: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.schedule-option {
    position: relative;
    min-height: 74px;
    padding: 0 19px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #ffffff;
    font-size: 1rem;
    font-weight: 520;
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.schedule-option:has(input:checked) {
    border: 2px solid var(--accent);
    color: var(--accent);
    box-shadow: 0 3px 12px rgba(20, 85, 217, 0.07);
}

.schedule-option:focus-within {
    box-shadow: var(--shadow-focus);
}

.schedule-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.radio-dot {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border: 2px solid var(--border-strong);
    border-radius: 50%;
    background: #ffffff;
}

.schedule-option input:checked + .radio-dot {
    border: 7px solid var(--accent);
}

.select-wrap {
    position: relative;
}

.select-wrap select {
    padding-right: 48px;
    appearance: none;
}

.select-wrap svg {
    position: absolute;
    top: 50%;
    right: 18px;
    width: 22px;
    height: 22px;
    translate: 0 -50%;
    fill: none;
    stroke: var(--text);
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.save-button {
    width: 100%;
    min-height: 76px;
    margin-top: 14px;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    background: var(--accent);
    font-size: 1.03rem;
    font-weight: 650;
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.save-button:hover:not(:disabled) {
    background: var(--accent-hover);
    box-shadow: 0 7px 18px rgba(20, 85, 217, 0.16);
}

.save-button:active:not(:disabled) {
    transform: translateY(1px);
}

.save-button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.form-message {
    min-height: 1.35em;
    margin: 12px 0 -18px;
    color: var(--due);
    font-size: 0.88rem;
}

.events-list {
    display: grid;
    gap: 18px;
}

.event-row {
    min-height: 116px;
    padding: 22px 24px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.event-row:hover {
    border-color: var(--border-strong);
    box-shadow: 0 8px 24px rgba(32, 48, 76, 0.055);
    transform: translateY(-1px);
}

.event-row.is-due {
    border-color: #ff684e;
    background: var(--due-soft);
}

.event-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    color: var(--accent);
}

.event-icon svg {
    width: 39px;
    height: 39px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.event-row.is-due .event-icon {
    color: var(--due);
}

.event-copy {
    min-width: 0;
}

.event-title {
    margin: 0 0 4px;
    overflow: hidden;
    color: var(--text);
    font-size: 1.18rem;
    font-weight: 700;
    line-height: 1.28;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-time {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.35;
}

.event-row.is-due .event-time {
    color: var(--due);
    font-weight: 540;
}

.event-actions {
    display: flex;
    align-items: center;
    gap: 22px;
}

.seen-button {
    min-width: 118px;
    min-height: 58px;
    padding: 0 22px;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    background: var(--due);
    font-size: 0.98rem;
    font-weight: 650;
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease;
}

.seen-button:hover {
    background: #d93218;
}

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

.icon-button {
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    color: #273143;
    background: transparent;
    cursor: pointer;
    transition: color 160ms ease, background-color 160ms ease;
}

.icon-button:hover {
    color: var(--due);
    background: #fff1ee;
}

.icon-button svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.empty-state,
.loading-state {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 1rem;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: max(24px, env(safe-area-inset-bottom));
    z-index: 20;
    max-width: min(360px, calc(100vw - 32px));
    padding: 13px 17px;
    border-radius: 10px;
    color: #ffffff;
    background: #172033;
    box-shadow: 0 12px 32px rgba(15, 25, 45, 0.2);
    font-size: 0.92rem;
    font-weight: 560;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

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

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 3px solid rgba(20, 85, 217, 0.25);
    outline-offset: 3px;
}

@media (max-width: 980px) {
    .workspace {
        grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
        gap: 34px;
    }

    .event-row {
        padding: 20px;
    }

    .event-actions {
        gap: 10px;
    }

    .seen-button {
        min-width: 98px;
        padding: 0 16px;
    }
}

@media (max-width: 820px) {
    .app-header {
        height: 88px;
    }

    .header-inner,
    .workspace {
        width: min(100% - 32px, 680px);
    }

    .header-inner {
        gap: 12px;
    }

    h1 {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }

    .push-button {
        min-height: 50px;
        padding: 0 15px;
        gap: 8px;
        font-size: 0.9rem;
    }

    .push-button svg {
        width: 21px;
        height: 21px;
    }

    .workspace {
        padding: 28px 0 52px;
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .events-panel {
        padding-top: 0;
    }
}

@media (max-width: 520px) {
    .header-inner,
    .workspace {
        width: calc(100% - 32px);
    }

    .form-panel {
        padding: 26px 20px 30px;
    }

    h2 {
        margin-bottom: 26px;
        font-size: 1.42rem;
    }

    .field {
        margin-bottom: 23px;
    }

    input[type="text"],
    input[type="date"],
    input[type="time"],
    select {
        height: 58px;
    }

    .schedule-toggle {
        gap: 10px;
        margin-bottom: 26px;
    }

    .schedule-option {
        min-height: 62px;
        padding: 0 12px;
        gap: 10px;
        font-size: 0.94rem;
    }

    .radio-dot {
        width: 21px;
        height: 21px;
    }

    .schedule-option input:checked + .radio-dot {
        border-width: 6px;
    }

    .save-button {
        min-height: 64px;
    }

    .events-list {
        gap: 14px;
    }

    .event-row {
        min-height: 104px;
        padding: 17px 14px;
        grid-template-columns: 38px minmax(0, 1fr) auto;
        gap: 11px;
    }

    .event-icon {
        width: 38px;
        height: 38px;
    }

    .event-icon svg {
        width: 34px;
        height: 34px;
    }

    .event-title {
        font-size: 1.03rem;
    }

    .event-time {
        font-size: 0.88rem;
    }

    .event-actions {
        gap: 4px;
    }

    .seen-button {
        min-width: auto;
        min-height: 50px;
        padding: 0 15px;
        font-size: 0.9rem;
    }

    .icon-button {
        width: 38px;
        height: 44px;
    }

    .icon-button svg {
        width: 24px;
        height: 24px;
    }

    .toast {
        right: 16px;
        bottom: max(16px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 380px) {
    .push-button span {
        max-width: 78px;
        line-height: 1.1;
    }

    .event-row.is-due {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .event-row.is-due .event-actions {
        grid-column: 2;
        justify-content: flex-end;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
