:root {
    --ink: #22221f;
    --muted: #77766f;
    --line: #e5e3dc;
    --paper: #fffefb;
    --canvas: #f5f4ef;
    --primary: #272823;
    --danger: #bd4a4a;
    --radius: 18px;
    --shadow: 0 12px 35px rgba(40, 39, 33, .07), 0 2px 7px rgba(40, 39, 33, .04);
    --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--ink);
    background: var(--canvas);
    font-family: var(--font);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 21px;
    font-weight: 760;
    letter-spacing: -.6px;
    text-decoration: none;
}

.brand__mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 11px;
    color: white;
    background: var(--primary);
    font-family: Georgia, serif;
    font-size: 19px;
    font-style: italic;
    box-shadow: 0 5px 12px rgba(39, 40, 35, .18);
}

.brand--large { font-size: 25px; }
.brand--large .brand__mark { width: 42px; height: 42px; border-radius: 13px; font-size: 23px; }

.eyebrow {
    margin: 0 0 8px;
    color: #848279;
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 1.7px;
    text-transform: uppercase;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 9px 17px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    font-size: 14px;
    font-weight: 680;
    text-decoration: none;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button--primary { color: #fff; background: var(--primary); box-shadow: 0 5px 14px rgba(39, 40, 35, .16); }
.button--primary:hover { background: #11120f; box-shadow: 0 8px 18px rgba(39, 40, 35, .2); }
.button--secondary { border-color: var(--line); background: #fff; }
.button--secondary:hover { background: #f8f7f3; }
.button--danger { color: #fff; background: var(--danger); }
.button--danger-ghost { color: var(--danger); border-color: #e8cccc; background: #fffafa; }
.button--wide { width: 100%; min-height: 49px; justify-content: space-between; padding-inline: 20px; }
.button__plus { font-size: 20px; font-weight: 400; line-height: 0; transform: translateY(-1px); }

.icon-button {
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--paper);
    cursor: pointer;
    transition: border-color .18s ease, color .18s ease, background .18s ease;
}

.icon-button svg { width: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.icon-button:hover { border-color: #c9c7c0; background: #f9f8f4; }
.icon-button--danger { width: 32px; height: 32px; border: 0; opacity: 0; background: transparent; color: var(--danger); }
.icon-button--danger:hover { background: #fff0f0; }

/* Login */
.login-page { background: #efeee8; }

.login-shell {
    display: grid;
    width: min(1180px, calc(100% - 48px));
    min-height: min(720px, calc(100vh - 48px));
    grid-template-columns: 1.08fr .92fr;
    margin: 24px auto;
    overflow: hidden;
    border: 1px solid rgba(48, 48, 41, .08);
    border-radius: 28px;
    background: var(--paper);
    box-shadow: 0 30px 80px rgba(45, 44, 38, .11);
}

.login-intro {
    position: relative;
    display: flex;
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    padding: 45px 52px;
    background: #dfead5;
}

.login-intro::before {
    position: absolute;
    width: 500px;
    height: 500px;
    right: -270px;
    top: -220px;
    border: 1px solid rgba(39, 40, 35, .08);
    border-radius: 50%;
    box-shadow: 0 0 0 70px rgba(255,255,255,.08), 0 0 0 140px rgba(255,255,255,.06);
    content: "";
}

.login-intro__content { position: relative; z-index: 1; max-width: 470px; margin: 80px 0 165px; }
.login-intro__content h1 { margin: 0 0 22px; font-size: clamp(42px, 4.5vw, 66px); font-weight: 630; letter-spacing: -3.1px; line-height: 1.04; }
.login-intro__content > p:last-child { max-width: 410px; margin: 0; color: #5e6757; font-size: 17px; line-height: 1.7; }

.login-preview { position: absolute; right: 50px; bottom: 45px; left: 52px; height: 150px; }
.preview-card { position: absolute; display: block; width: 56%; height: 95px; border-radius: 17px; background: rgba(255, 254, 251, .78); box-shadow: 0 12px 30px rgba(44, 52, 39, .09); backdrop-filter: blur(8px); }
.preview-card::before, .preview-card::after { position: absolute; left: 20px; height: 8px; border-radius: 8px; background: rgba(49, 55, 45, .16); content: ""; }
.preview-card::before { width: 48%; top: 26px; }
.preview-card::after { width: 70%; top: 48px; opacity: .55; }
.preview-card--one { left: 0; bottom: 3px; transform: rotate(-4deg); }
.preview-card--two { right: 2%; bottom: 23px; background: rgba(249, 224, 198, .86); transform: rotate(4deg); }
.preview-card--three { left: 22%; bottom: 50px; background: rgba(213, 224, 246, .9); transform: rotate(-.5deg); }

.login-panel { display: grid; padding: 50px; place-items: center; }
.login-form { width: min(100%, 380px); }
.login-form__heading { margin-bottom: 34px; }
.login-form__heading h2 { margin: 0 0 10px; font-size: 34px; letter-spacing: -1.3px; }
.login-form__heading > p:last-child { margin: 0; color: var(--muted); }

.field { display: grid; gap: 8px; margin-bottom: 19px; }
.field > span:first-child, .color-field legend { color: #4d4c47; font-size: 13px; font-weight: 680; }
.field small { margin-left: 5px; color: #9a9890; font-size: 11px; font-weight: 500; }
.field b { color: var(--danger); }
.field input, .field textarea {
    width: 100%;
    border: 1px solid #dcdad3;
    border-radius: 12px;
    outline: 0;
    background: #fff;
    color: var(--ink);
    transition: border-color .18s ease, box-shadow .18s ease;
}
.field input { height: 48px; padding: 0 14px; }
.field textarea { min-height: 104px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #aaa8a0; }
.field input:focus, .field textarea:focus { border-color: #85877b; box-shadow: 0 0 0 3px rgba(67, 69, 62, .09); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 50px; }
.password-toggle { position: absolute; width: 40px; height: 40px; right: 4px; top: 4px; padding: 0; border: 0; background: transparent; color: #8f8e87; cursor: pointer; }
.password-toggle svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.alert { margin-bottom: 22px; padding: 12px 14px; border-radius: 10px; font-size: 13px; }
.alert--error { color: #963d3d; background: #fff0f0; }
.alert--success { color: #39724b; background: #edf8ef; }

/* App layout */
.topbar { position: sticky; z-index: 20; top: 0; border-bottom: 1px solid rgba(220, 218, 209, .85); background: rgba(245, 244, 239, .88); backdrop-filter: blur(18px); }
.topbar__inner { display: flex; width: min(1440px, calc(100% - 64px)); height: 76px; align-items: center; justify-content: space-between; margin: 0 auto; }
.topbar__actions { display: flex; align-items: center; gap: 11px; }
.topbar__actions form { display: flex; }
.user-name { margin: 0 6px 0 12px; color: #77766f; font-size: 13px; }
.content { position: relative; width: min(1440px, calc(100% - 64px)); margin: 0 auto; padding: 54px 0 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.page-heading h1 { margin: 0 0 8px; font-size: clamp(31px, 4vw, 44px); font-weight: 650; letter-spacing: -1.8px; line-height: 1.12; }
.page-heading > div > p:last-child { margin: 0; color: var(--muted); font-size: 15px; }
.page-heading--detail { align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 20px; color: #6f6e68; font-size: 13px; font-weight: 630; text-decoration: none; }
.back-link:hover { color: var(--ink); }
.title-with-dot { display: flex; align-items: center; gap: 13px; }
.title-with-dot h1 { margin-bottom: 6px; }
.color-dot { width: 14px; height: 14px; flex: none; border: 3px solid white; border-radius: 50%; background: var(--dot-color); box-shadow: 0 0 0 1px rgba(0,0,0,.09); }
.heading-actions { display: flex; align-items: center; gap: 10px; }
.box-total { padding: 6px 11px; border: 1px solid var(--line); border-radius: 99px; background: rgba(255,255,255,.55); color: var(--muted); font-size: 12px; font-weight: 650; }

.boxes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 22px; }
.box-card {
    position: relative;
    overflow: visible;
    border: 1px solid rgba(42, 42, 36, .08);
    border-top: 4px solid var(--box-color);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease;
    animation: card-in .42s both;
}
.box-card:hover { transform: translateY(-2px); box-shadow: 0 16px 42px rgba(40, 39, 33, .09), 0 3px 8px rgba(40, 39, 33, .04); }
.box-card::before { position: absolute; z-index: 0; inset: 0; border-radius: 14px 14px 0 0; background: linear-gradient(180deg, color-mix(in srgb, var(--box-color) 14%, white), transparent 125px); pointer-events: none; content: ""; }
.box-card__header { position: relative; display: flex; min-height: 95px; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 20px 17px 22px; }
.box-card__header h2 { margin: 3px 0 0; font-size: 20px; font-weight: 690; letter-spacing: -.55px; line-height: 1.25; }
.box-card__header h2 a { text-decoration: none; }
.box-card__header h2 a::after { position: absolute; inset: 0 55px 0 0; content: ""; }
.box-card__count { color: #85837b; font-size: 10px; font-weight: 730; letter-spacing: 1px; text-transform: uppercase; }
.box-card__body { position: relative; padding: 0 12px 10px; }
.box-card__footer { position: relative; padding: 5px 20px 17px; text-align: right; }
.box-card__footer a { display: inline-flex; gap: 7px; color: #55544f; font-size: 12px; font-weight: 700; text-decoration: none; }
.box-card__footer a:hover { color: #000; }

.card-menu { position: relative; z-index: 4; }
.card-menu summary { display: grid; width: 34px; height: 32px; place-items: center; border-radius: 9px; color: #77766f; font-size: 15px; letter-spacing: 2px; list-style: none; cursor: pointer; }
.card-menu summary::-webkit-details-marker { display: none; }
.card-menu summary:hover, .card-menu[open] summary { background: rgba(255,255,255,.7); }
.card-menu__panel { position: absolute; z-index: 10; width: 145px; right: 0; top: 38px; overflow: hidden; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 12px 28px rgba(32,31,27,.13); }
.card-menu__panel button { width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; font-size: 12px; text-align: left; cursor: pointer; }
.card-menu__panel button:hover { background: #f3f2ed; }
.card-menu__panel .danger-text { color: var(--danger); }

.box-empty { display: flex; width: 100%; min-height: 90px; align-items: center; justify-content: center; gap: 9px; border: 1px dashed #d7d5cd; border-radius: 11px; background: rgba(250,249,245,.6); color: #929089; font-size: 12px; cursor: pointer; transition: border-color .18s, color .18s, background .18s; }
.box-empty span { font-size: 20px; font-weight: 300; }
.box-empty:hover { border-color: var(--box-color); background: color-mix(in srgb, var(--box-color) 7%, white); color: #595852; }
.box-empty--compact { min-height: 54px; margin-top: 8px; }
.box-empty--compact span { font-size: 17px; }

/* Items */
.item { position: relative; display: flex; min-width: 0; justify-content: space-between; gap: 15px; padding: 19px 19px 18px 22px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper); box-shadow: 0 5px 18px rgba(40,39,33,.035); transition: border-color .18s, box-shadow .18s; }
.item:hover { border-color: #d1cfc7; box-shadow: 0 8px 24px rgba(40,39,33,.06); }
.item:hover .icon-button--danger { opacity: 1; }
.item__main { min-width: 0; flex: 1; }
.item__title { margin: 0; font-size: 16px; font-weight: 680; letter-spacing: -.22px; line-height: 1.4; overflow-wrap: anywhere; }
.item__description { margin-top: 6px; color: #7c7a73; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.item__description a { display: flex; max-width: 100%; align-items: center; gap: 6px; color: #506678; text-decoration-color: #b9c4cc; text-underline-offset: 3px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__date-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 13px; }
.item__date-row time { color: #52514c; font-size: 12px; font-weight: 400; letter-spacing: .65px; }
.countdown { padding: 3px 7px; border-radius: 6px; font-size: 10px; font-weight: 700; }
.countdown--future { color: #476350; background: #e9f3e9; }
.countdown--today { color: #8b5a28; background: #fff0cd; }
.countdown--past { color: #8b7777; background: #f2eded; }
.item__delete { flex: none; }
.item--compact { min-height: 66px; padding: 14px 9px 14px 11px; border: 0; border-top: 1px solid #eeece6; border-radius: 0; background: transparent; box-shadow: none; }
.item--compact:first-child { border-top: 0; }
.item--compact:hover { border-color: #eeece6; background: rgba(255,255,255,.55); box-shadow: none; }
.item--compact .item__title { font-size: 13px; }
.item--compact .item__description { font-size: 11px; }
.item--compact .item__date-row { margin-top: 8px; gap: 6px; }
.item--compact .item__date-row time { font-size: 10px; }
.item--compact .countdown { font-size: 8px; }
.item--compact .icon-button--danger { width: 28px; height: 28px; }
.item--compact .icon-button--danger svg { width: 16px; }
.items-list { display: grid; max-width: 980px; gap: 12px; }

/* Empty states */
.empty-state { display: flex; max-width: 630px; min-height: 390px; flex-direction: column; align-items: center; justify-content: center; margin: 25px auto; padding: 40px; text-align: center; }
.empty-state h2 { margin: 25px 0 8px; font-size: 24px; letter-spacing: -.7px; }
.empty-state p { max-width: 510px; margin: 0 0 24px; color: var(--muted); line-height: 1.65; }
.empty-boxes { position: relative; width: 180px; height: 100px; }
.empty-boxes span { position: absolute; width: 105px; height: 74px; border: 1px solid rgba(50,50,45,.08); border-radius: 13px; box-shadow: 0 10px 26px rgba(40,39,33,.07); }
.empty-boxes span:nth-child(1) { left: 0; bottom: 0; background: #f7cfaf; transform: rotate(-8deg); }
.empty-boxes span:nth-child(2) { right: 0; bottom: 0; background: #bddfe7; transform: rotate(8deg); }
.empty-boxes span:nth-child(3) { left: 37px; bottom: 13px; background: #d1e5bc; }
.empty-state--detail { align-items: flex-start; min-height: 290px; margin: 10px 0; padding: 40px 0; text-align: left; }
.empty-state__icon { display: grid; width: 55px; height: 55px; place-items: center; border-radius: 16px; background: var(--empty-color); font-size: 24px; box-shadow: 0 8px 22px color-mix(in srgb, var(--empty-color) 60%, transparent); }

/* Toast */
.toast { position: fixed; z-index: 50; display: flex; max-width: min(410px, calc(100% - 32px)); align-items: center; gap: 10px; top: 92px; right: 24px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 13px 34px rgba(34,33,29,.14); font-size: 13px; animation: toast-in .35s ease both; }
.toast > span { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: #fff; font-size: 11px; }
.toast--success > span { background: #5b8a64; }
.toast--error > span { background: var(--danger); }
.toast button { margin-left: 5px; border: 0; background: transparent; color: #99978f; font-size: 20px; cursor: pointer; }
.toast.is-leaving { animation: toast-out .25s ease forwards; }

/* Modals */
.modal { width: min(540px, calc(100% - 30px)); max-height: calc(100vh - 30px); padding: 0; overflow: visible; border: 0; border-radius: 20px; background: transparent; color: var(--ink); }
.modal::backdrop { background: rgba(28, 28, 25, .48); backdrop-filter: blur(4px); animation: backdrop-in .2s ease; }
.modal[open] .modal__panel { animation: modal-in .25s ease both; }
.modal__panel { overflow: auto; max-height: calc(100vh - 30px); border: 1px solid rgba(255,255,255,.4); border-radius: 20px; background: var(--paper); box-shadow: 0 25px 70px rgba(24,24,21,.2); }
.modal__header { display: flex; align-items: flex-start; justify-content: space-between; padding: 25px 27px 18px; }
.modal__header h2 { margin: 0; font-size: 25px; letter-spacing: -.7px; }
.modal__close { display: grid; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 9px; background: #f1f0eb; color: #77766f; font-size: 22px; line-height: 1; cursor: pointer; }
.modal__close:hover { background: #e8e7e1; }
.modal__content { padding: 3px 27px 15px; }
.modal__content--fields { padding-top: 5px; }
.modal__footer { display: flex; justify-content: flex-end; gap: 9px; padding: 17px 27px 24px; border-top: 1px solid #eeece6; }
.color-field { margin: 2px 0 4px; padding: 0; border: 0; }
.color-field legend { margin-bottom: 11px; }
.color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px 8px; }
.color-option { display: grid; justify-items: center; gap: 4px; cursor: pointer; }
.color-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.color-option > span { display: grid; width: 43px; height: 43px; place-items: center; border: 3px solid var(--paper); border-radius: 13px; background: var(--swatch); box-shadow: 0 0 0 1px rgba(45,45,40,.08); transition: transform .16s ease, box-shadow .16s ease; }
.color-option:hover > span { transform: scale(1.06); }
.color-option i { opacity: 0; color: #3e443b; font-size: 14px; font-style: normal; font-weight: 800; transform: scale(.5); transition: opacity .15s, transform .15s; }
.color-option input:checked + span { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px #464741; transform: scale(.95); }
.color-option input:checked + span i { opacity: 1; transform: scale(1); }
.color-option em { color: #85837c; font-size: 8px; font-style: normal; }
.modal--confirm { width: min(410px, calc(100% - 30px)); text-align: center; }
.modal--confirm .modal__panel { padding: 31px 28px 26px; }
.modal--confirm h2 { margin: 15px 0 7px; font-size: 23px; }
.modal--confirm p { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.confirm-icon { display: grid; width: 48px; height: 48px; place-items: center; margin: 0 auto; border-radius: 14px; color: var(--danger); background: #fbe9e9; font-size: 22px; font-weight: 800; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

@keyframes card-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes backdrop-in { from { opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

@media (max-width: 1100px) {
    .boxes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .login-intro { padding: 40px; }
    .login-intro__content { margin-top: 70px; }
}

@media (max-width: 800px) {
    .login-shell { width: calc(100% - 28px); min-height: calc(100vh - 28px); grid-template-columns: 1fr; margin: 14px auto; }
    .login-intro { min-height: 260px; padding: 28px; }
    .login-intro__content { margin: 45px 0 0; }
    .login-intro__content h1 { max-width: 550px; font-size: 40px; letter-spacing: -2px; }
    .login-intro__content > p:last-child { display: none; }
    .login-preview { display: none; }
    .login-panel { min-height: 470px; padding: 38px 28px; }
    .topbar__inner, .content { width: calc(100% - 36px); }
    .content { padding-top: 36px; }
    .page-heading--detail { align-items: flex-end; }
    .heading-actions { flex-direction: column; align-items: stretch; }
    .heading-actions .button { width: 100%; }
}

@media (max-width: 640px) {
    .boxes-grid { grid-template-columns: 1fr; }
    .topbar__inner { width: calc(100% - 28px); height: 68px; }
    .content { width: calc(100% - 28px); padding: 30px 0 50px; }
    .brand > span:last-child { display: none; }
    .topbar__actions { gap: 7px; }
    .topbar__actions .button { min-height: 40px; padding-inline: 13px; }
    .user-name { display: none; }
    .page-heading, .page-heading--detail { align-items: flex-start; flex-direction: column; gap: 18px; }
    .page-heading h1 { font-size: 33px; }
    .heading-actions { width: 100%; flex-direction: row; }
    .heading-actions form { flex: 1; }
    .heading-actions .button { padding-inline: 11px; font-size: 12px; }
    .box-total { display: none; }
    .item { padding: 16px 10px 15px 16px; }
    .icon-button--danger { opacity: .6; }
    .empty-state { min-height: 340px; margin: 0 auto; padding: 28px 10px; }
    .empty-state--detail { align-items: flex-start; min-height: 260px; padding-inline: 0; }
    .modal__header { padding: 22px 20px 15px; }
    .modal__content { padding: 3px 20px 12px; }
    .modal__footer { padding: 15px 20px 20px; }
    .color-grid { grid-template-columns: repeat(4, 1fr); }
    .color-option em { display: none; }
    .toast { top: 78px; right: 14px; }
}

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