@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;700&family=Sora:wght@600;700&display=swap');

:root {
    --bg: #090f17;
    --bg-soft: #101827;
    --card: #111c2d;
    --card-2: #15233a;
    --line: #26364f;
    --text: #e8f0ff;
    --muted: #a8b8d0;
    --accent: #2dd4bf;
    --accent-strong: #14b8a6;
    --warn: #f59e0b;
    --danger: #ef4444;
    --ok: #22c55e;
    --radius: 16px;
    --shadow: 0 18px 38px rgba(3, 8, 16, 0.48);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    font-family: 'IBM Plex Sans', sans-serif;
    background:
        radial-gradient(circle at 8% 12%, rgba(45, 212, 191, 0.12) 0, rgba(45, 212, 191, 0) 28%),
        radial-gradient(circle at 85% 4%, rgba(56, 189, 248, 0.14) 0, rgba(56, 189, 248, 0) 30%),
        linear-gradient(165deg, #090f17 0%, #0b1220 55%, #0a1020 100%);
    min-height: 100vh;
}

.shell {
    max-width: 1420px;
    margin: 0 auto;
    padding: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.topbar h1,
.auth-wrap h1 {
    font-family: 'Sora', sans-serif;
    margin: 0;
    letter-spacing: 0.2px;
    font-size: clamp(28px, 3.6vw, 38px);
}

.topbar-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.user-pill {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 600;
}

.layout {
    display: grid;
    grid-template-columns: minmax(300px, 360px) 1fr;
    gap: 16px;
}

.sidebar,
.content {
    display: grid;
    gap: 14px;
    align-content: start;
}

.card,
.auth-wrap {
    background: linear-gradient(160deg, var(--card) 0%, var(--card-2) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.auth-wrap {
    max-width: 520px;
    margin: 80px auto;
    padding: 24px;
}

h2,
h3,
h4,
p {
    margin-top: 0;
}

h2 {
    font-family: 'Sora', sans-serif;
    font-size: 20px;
    margin-bottom: 10px;
}

.muted {
    color: var(--muted);
}

label {
    display: block;
    margin: 7px 0 4px;
    font-weight: 600;
}

input,
select,
button,
textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--line);
    padding: 10px 12px;
    background: #0e1726;
    color: var(--text);
    font: inherit;
}

input::placeholder,
textarea::placeholder {
    color: #7f90ad;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(45, 212, 191, 0.35);
    border-color: var(--accent);
}

button {
    cursor: pointer;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #03211d;
    border-color: transparent;
}

button:hover {
    filter: brightness(1.05);
}

button.secondary {
    background: #1a2c46;
    color: #cde2ff;
    border-color: #2c4366;
}

button.warn {
    background: #3f300f;
    color: #ffdba3;
    border-color: #745719;
}

button.danger {
    background: #3f1619;
    color: #ffc9cf;
    border-color: #6f252d;
}

button.ok {
    background: #143927;
    color: #b9ffd6;
    border-color: #20603f;
}

.grid2 {
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr 1fr;
}

.plans-list {
    display: grid;
    gap: 8px;
}

.plan-pill {
    text-align: left;
    background: #102036;
    border: 1px solid #28456e;
    color: var(--text);
}

.plan-pill strong {
    display: block;
}

.plan-pill span {
    font-size: 13px;
    color: var(--muted);
}

.plan-pill.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.25) inset;
}

.day-nav {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px;
}

.nav-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chips-row {
    margin-top: 8px;
}

.nav-btn,
.chip,
.today-badge {
    border-radius: 999px;
    border: 1px solid #33527b;
    background: #10223a;
    color: #d9e8ff;
    padding: 7px 12px;
    font-weight: 600;
}

.today-badge {
    border-color: #2c746c;
    background: #103531;
}

.chip.active {
    border-color: var(--accent);
    background: #154f48;
}

.schedule-card {
    display: grid;
    gap: 12px;
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: baseline;
}

.plan-tag {
    color: var(--muted);
    font-weight: 600;
}

.schedule-lead {
    color: #cedcf4;
}

.timeline-grid {
    display: grid;
    gap: 12px;
}

.timeline-slot {
    border: 1px solid #254064;
    border-radius: 14px;
    background: #0f1d31;
    padding: 12px;
}

.slot-head h3 {
    margin: 0 0 6px;
    font-family: 'Sora', sans-serif;
    font-size: 16px;
}

.slot-head p {
    margin: 0;
    color: #c4d5ee;
}

.slot-meds {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

.med-card {
    border: 1px solid #29466d;
    border-radius: 12px;
    padding: 10px;
    background: #11243c;
}

.med-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.med-name {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.med-meta,
.med-status-line {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.status-pill {
    border: 1px solid #35587e;
    border-radius: 999px;
    font-size: 12px;
    padding: 5px 10px;
    align-self: flex-start;
    text-transform: lowercase;
}

.status-taken .status-pill {
    border-color: #327857;
    background: rgba(34, 197, 94, 0.15);
}

.status-postponed .status-pill {
    border-color: #7e6226;
    background: rgba(245, 158, 11, 0.14);
}

.status-canceled .status-pill {
    border-color: #7e2b34;
    background: rgba(239, 68, 68, 0.16);
}

.is-striked {
    text-decoration: line-through;
    opacity: 0.7;
}

.med-actions-inline {
    margin-top: 10px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rule-box {
    border: 1px dashed #5a7ea9;
    border-radius: 12px;
    background: #0f2136;
    padding: 10px;
}

.rule-box p {
    margin: 6px 0;
}

.logs-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.logs-list li {
    border-left: 3px solid #2b4f7a;
    padding-left: 10px;
}

.logs-list li p {
    margin: 3px 0 0;
    color: var(--muted);
}

.flash-host {
    margin-bottom: 12px;
}

.flash {
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid transparent;
}

.flash.success {
    background: rgba(34, 197, 94, 0.13);
    border-color: #2f7e53;
    color: #aef0ca;
}

.flash.error {
    background: rgba(239, 68, 68, 0.12);
    border-color: #7f2f38;
    color: #ffc4ca;
}

.edit-dialog {
    border: 1px solid var(--line);
    border-radius: 14px;
    color: var(--text);
    background: #0e1828;
    width: min(560px, calc(100vw - 28px));
}

.edit-dialog::backdrop {
    background: rgba(2, 5, 12, 0.72);
}

.edit-dialog menu {
    margin: 14px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 1100px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .shell {
        padding: 12px;
    }

    .grid2,
    .med-actions-inline,
    .edit-dialog menu {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }
}
