:root {
    --ink: #182034;
    --muted: #6d7485;
    --soft: #9298a7;
    --line: #e3e6ec;
    --surface: #ffffff;
    --surface-alt: #f5f6f8;
    --canvas: #eef0f4;
    --nav: #151b2d;
    --nav-soft: #9ca5ba;
    --accent: #d95d39;
    --accent-dark: #b84627;
    --accent-soft: #fff0ea;
    --success: #28775a;
    --success-soft: #e9f6f0;
    --danger: #b23a48;
    --danger-soft: #faeaec;
    --warning: #9c6b12;
    --warning-soft: #fff6dc;
    --shadow: 0 18px 50px rgba(29, 35, 54, 0.08);
    --radius: 18px;
    --radius-small: 11px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--canvas); }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--canvas);
    color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(2.2rem, 4vw, 3.65rem); line-height: 1.02; letter-spacing: -0.055em; }
h2 { margin-bottom: 0; font-size: 1.22rem; letter-spacing: -0.02em; }
h3 { margin-bottom: 0; font-size: 0.88rem; }
.hidden { display: none !important; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-size: 1.02rem;
    font-weight: 760;
    letter-spacing: -0.02em;
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-family: Georgia, serif;
    font-size: 1.15rem;
}

.brand-light { color: white; }

.eyebrow {
    margin-bottom: 9px;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.auth-screen {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(0, 1.2fr) minmax(390px, 0.8fr);
}

.auth-intro {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
    padding: clamp(32px, 5vw, 76px);
    overflow: hidden;
    background:
        radial-gradient(circle at 80% 85%, rgba(217, 93, 57, 0.2), transparent 35%),
        var(--nav);
    color: white;
}

.auth-intro .brand-mark { box-shadow: 0 10px 30px rgba(217, 93, 57, 0.28); }
.auth-copy { max-width: 760px; }
.auth-copy h1 { max-width: 690px; font-size: clamp(3rem, 6vw, 6.2rem); }
.auth-copy > p:last-child { max-width: 620px; margin-bottom: 0; color: #b9c0cf; font-size: 1.08rem; line-height: 1.7; }
.auth-points { display: flex; flex-wrap: wrap; gap: 10px; color: #b9c0cf; font-size: 0.82rem; }
.auth-points span { padding: 8px 12px; border: 1px solid #343b50; border-radius: 999px; }

.auth-panel { display: grid; place-items: center; padding: 36px; background: var(--surface-alt); }
.auth-card { width: min(100%, 430px); }
.auth-heading { margin: 38px 0 26px; }
.auth-heading h2 { margin-bottom: 9px; font-size: 2rem; }
.auth-heading p, .auth-footnote { color: var(--muted); line-height: 1.55; }
.auth-footnote { margin: 22px 0 0; font-size: 0.78rem; }

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #eaecf0;
}

.segment {
    padding: 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
}

.segment.active { background: white; color: var(--ink); box-shadow: 0 3px 12px rgba(28, 34, 51, 0.08); }

.stack-form { display: grid; gap: 17px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.field { display: grid; align-content: start; gap: 7px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > span, .compact-field > span {
    color: #555d6e;
    font-size: 0.74rem;
    font-weight: 760;
    letter-spacing: 0.02em;
}

input, select, textarea {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d8dce4;
    border-radius: var(--radius-small);
    outline: none;
    background: white;
    color: var(--ink);
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

input, select { padding: 0 12px; }
textarea { min-height: 74px; padding: 11px 12px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #a0a6b3; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(217, 93, 57, 0.12); }

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 17px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 760;
    transition: transform 100ms ease, background 140ms ease, border-color 140ms ease;
}

.button:active { transform: translateY(1px); }
.button:disabled { cursor: not-allowed; opacity: 0.55; }
.button-large { min-height: 50px; }
.button-primary { background: var(--accent); color: white; }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { border-color: var(--ink); background: var(--ink); color: white; }
.button-secondary:hover { background: #293047; }
.button-ghost { border-color: var(--line); background: white; color: var(--muted); }
.button-quiet { min-height: 38px; padding: 0 11px; border-color: var(--line); background: transparent; color: var(--muted); }
.button-danger { min-height: 36px; border-color: #f1c9ce; background: var(--danger-soft); color: var(--danger); }
.button-small { min-height: 34px; padding: 0 11px; font-size: 0.76rem; }
.icon-button { display: grid; min-width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: transparent; cursor: pointer; }
.form-message { margin: -5px 0 0; font-size: 0.82rem; }
.error { color: var(--danger); }

.app-shell { display: grid; min-height: 100vh; grid-template-columns: 270px minmax(0, 1fr); }

.sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    padding: 27px 20px 20px;
    background: var(--nav);
    color: white;
}

.primary-nav { display: grid; gap: 7px; margin-top: 48px; }
.nav-item {
    display: grid;
    grid-template-columns: 31px minmax(0, 1fr);
    gap: 11px;
    align-items: center;
    width: 100%;
    padding: 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--nav-soft);
    cursor: pointer;
    text-align: left;
}

.nav-item:hover { background: #1d2438; color: white; }
.nav-item.active { border-color: #343b50; background: #242b40; color: white; }
.nav-icon { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.68rem; }
.nav-item span:last-child { display: grid; gap: 3px; }
.nav-item strong { font-size: 0.88rem; }
.nav-item small { color: #7f899f; font-size: 0.69rem; }

.sidebar-user {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 10px;
    align-items: center;
    padding-top: 18px;
    border-top: 1px solid #30374b;
}

.avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: #303850; color: white; font-weight: 800; }
.sidebar-user-copy { display: grid; min-width: 0; gap: 2px; }
.sidebar-user-copy strong, .sidebar-user-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy strong { font-size: 0.8rem; }
.sidebar-user-copy span { color: #80899c; font-size: 0.67rem; }
.sidebar .icon-button { border-color: #343b50; color: #a7afc0; }

.workspace { min-width: 0; padding: clamp(26px, 4vw, 58px); }
.mobile-header { display: none; }
.view { display: none; width: min(100%, 1220px); margin: 0 auto; }
.view.active { display: block; animation: reveal 180ms ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.view-header > div { max-width: 770px; }
.view-header h1 { margin-bottom: 10px; }
.view-header > div > p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.55; }

.panel {
    margin-bottom: 26px;
    padding: clamp(20px, 3vw, 30px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.privacy-label { padding: 6px 9px; border-radius: 999px; background: var(--surface-alt); color: var(--muted); font-size: 0.69rem; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-hint { margin-right: auto; color: var(--muted); font-size: 0.76rem; }

.advanced-fields { margin-top: 17px; border-top: 1px solid var(--line); }
.advanced-fields summary { padding: 15px 0 0; color: var(--muted); cursor: pointer; font-size: 0.79rem; font-weight: 750; }
.advanced-grid { margin-top: 18px; padding: 18px; border-radius: 12px; background: var(--surface-alt); }
.recurrence-fields { align-self: end; }
.day-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.day-picker label input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.day-picker label span { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); cursor: pointer; font-size: 0.72rem; font-weight: 750; }
.day-picker label input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }

.filter-panel { margin-bottom: 27px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 255, 255, 0.68); }
.mobile-filter-toggle { display: none; width: 100%; }
.search-field { position: relative; display: block; margin-bottom: 13px; }
.search-field input { padding-left: 42px; background: white; }
.search-icon { position: absolute; top: 9px; left: 14px; z-index: 1; color: var(--soft); font-size: 1.3rem; }
.filter-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)) auto; gap: 9px; align-items: end; }
.compact-field { display: grid; gap: 5px; }
.compact-field select { min-height: 38px; padding: 0 9px; font-size: 0.76rem; }

.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 2px 13px; }
.list-heading > div { display: flex; align-items: baseline; gap: 10px; }
.count-label { color: var(--muted); font-size: 0.74rem; }
.task-list { display: grid; gap: 10px; }

.task-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 17px 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.task-card:hover { transform: translateY(-1px); border-color: #cfd3dd; box-shadow: 0 10px 30px rgba(31, 37, 55, 0.06); }
.task-check {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid #cfd4dd;
    border-radius: 50%;
    background: white;
    color: transparent;
    cursor: pointer;
    font-weight: 900;
}
.task-check:hover { border-color: var(--success); color: var(--success); }
.task-check.habit { border-radius: 10px; color: var(--success); font-size: 0.72rem; }
.task-card.completed { opacity: 0.68; }
.task-card.completed .task-title { text-decoration: line-through; }
.task-card.completed .task-check { border-color: var(--success); background: var(--success-soft); color: var(--success); cursor: default; }
.task-content { min-width: 0; }
.task-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 5px; }
.task-title { margin: 0; overflow-wrap: anywhere; font-size: 0.96rem; }
.task-description { margin: 0 0 9px; color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.task-meta { display: flex; flex-wrap: wrap; gap: 7px 13px; color: var(--muted); font-size: 0.72rem; }
.task-meta .overdue { color: var(--danger); font-weight: 750; }
.task-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tag, .badge { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border-radius: 999px; font-size: 0.66rem; font-weight: 740; }
.tag { background: var(--surface-alt); color: var(--muted); }
.badge-partner { background: #eeeafa; color: #62539c; }
.badge-urgent { background: var(--danger-soft); color: var(--danger); }
.badge-habit { background: var(--success-soft); color: var(--success); }
.task-actions { display: flex; gap: 7px; align-items: center; }
.compact-list .task-card { grid-template-columns: minmax(0, 1fr) auto; }

.task-editor {
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 26px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 30px 90px rgba(15, 20, 35, 0.28);
}
.task-editor::backdrop { background: rgba(15, 20, 35, 0.48); backdrop-filter: blur(2px); }
.task-editor .panel-heading { margin-bottom: 20px; }
.task-editor .advanced-grid { padding: 16px; }

.empty-state { padding: 48px 28px; text-align: center; }
.empty-state .empty-number { display: block; margin-bottom: 14px; color: var(--accent); font-family: ui-monospace, monospace; font-size: 0.72rem; }
.empty-state h2 { margin-bottom: 9px; font-size: 1.35rem; }
.empty-state p { max-width: 520px; margin: 0 auto 20px; color: var(--muted); line-height: 1.55; }
.empty-state.inline-empty { margin: 0; padding: 40px 20px; box-shadow: none; }

.settings-grid { display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(440px, 1.2fr); gap: 20px; align-items: start; }
.settings-panel { margin: 0; }
.settings-wide { grid-row: span 2; }
.invite-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.section-note { margin: 12px 0 19px; color: var(--muted); font-size: 0.77rem; line-height: 1.5; }
.relationship-list, .plain-list { display: grid; gap: 9px; }
.relationship-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.relationship-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.relationship-identity { display: grid; gap: 3px; min-width: 0; }
.relationship-identity strong, .relationship-identity span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relationship-identity span { color: var(--muted); font-size: 0.72rem; }
.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.toggle-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.73rem; }
.toggle-row input { width: 16px; min-height: 16px; accent-color: var(--accent); }
.split-list { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.split-list h3 { margin-bottom: 10px; color: var(--muted); }
.plain-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; }
.plain-item-copy { display: grid; min-width: 0; gap: 3px; }
.plain-item-copy strong, .plain-item-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plain-item-copy span { color: var(--muted); font-size: 0.7rem; }
.plain-item-actions { display: flex; gap: 6px; }
.muted-empty { padding: 10px 0; color: var(--soft); font-size: 0.76rem; }

.toast-region { position: fixed; z-index: 100; top: 18px; right: 18px; display: grid; width: min(390px, calc(100vw - 36px)); gap: 8px; }
.toast { padding: 13px 15px; border: 1px solid #353c4f; border-radius: 11px; background: var(--nav); color: white; box-shadow: 0 15px 45px rgba(15, 20, 35, 0.25); font-size: 0.79rem; animation: toast-in 180ms ease-out; }
.toast.error-toast { border-color: #85434b; background: #4a252c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

@media (max-width: 1180px) {
    .filter-grid { grid-template-columns: repeat(4, minmax(120px, 1fr)); }
    .settings-grid { grid-template-columns: 1fr; }
    .settings-wide { grid-row: auto; }
}

@media (max-width: 860px) {
    .auth-screen { grid-template-columns: 1fr; }
    .auth-intro { display: none; }
    .auth-panel { min-height: 100vh; padding: 24px; }
    .app-shell { display: block; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 85vw); transform: translateX(-105%); transition: transform 180ms ease; box-shadow: 20px 0 50px rgba(10, 14, 25, 0.25); }
    .sidebar.open { transform: none; }
    .workspace { padding: 0 20px 34px; }
    .mobile-header { display: flex; align-items: center; justify-content: space-between; padding: 17px 0 28px; }
    .view-header { align-items: flex-start; }
}

@media (max-width: 650px) {
    h1 { font-size: 2.45rem; }
    .view-header { display: grid; margin-bottom: 24px; }
    .form-grid, .permission-grid, .split-list { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
    .mobile-filter-toggle { display: inline-flex; }
    .filter-grid { display: none; grid-template-columns: 1fr; margin-top: 12px; }
    .filter-panel.filters-open .filter-grid { display: grid; }
    .task-card { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
    .task-actions { grid-column: 2; }
    .compact-list .task-card { grid-template-columns: 1fr; }
    .compact-list .task-actions { grid-column: 1; }
    .invite-row { grid-template-columns: 1fr; }
    .form-actions { flex-wrap: wrap; }
    .form-hint { flex-basis: 100%; }
    .panel { padding: 20px; }
}
 .google-signin { display: flex; justify-content: center; margin-top: .75rem; text-decoration: none; background: #fff; color: #222; border: 1px solid #c8c8c8; }
