:root {
    --ink: #17221d;
    --muted: #66736c;
    --paper: #f7f5ee;
    --white: #fffef9;
    --green: #235f4b;
    --green-dark: #174536;
    --sage: #dce8df;
    --line: #d9ddd8;
    --danger: #9c3434;
    --success: #276344;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 12% 4%, rgba(35, 95, 75, .08), transparent 27rem), var(--paper);
}

button, input, textarea { font: inherit; }

.header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 4.5rem;
    padding: .75rem clamp(1.25rem, 5vw, 4rem);
    color: #f6f4eb;
    background: var(--green-dark);
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    color: inherit;
    font-weight: 700;
    letter-spacing: -.02em;
    text-decoration: none;
}

.brand-mark {
    display: block;
    width: 2.25rem;
    height: 2.25rem;
}

.header-actions { display: flex; align-items: center; gap: .5rem; }
.header-link {
    padding: .4rem .7rem;
    color: inherit;
    border-radius: .45rem;
    font-size: .88rem;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s;
}
.header-link:hover { background: rgba(255, 255, 255, .1); }

.profile-menu { position: relative; }
.profile-menu summary {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .4rem .55rem;
    border-radius: .45rem;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 700;
    list-style: none;
    transition: background .15s;
}
.profile-menu summary::-webkit-details-marker { display: none; }
.profile-menu summary:hover, .profile-menu[open] summary { background: rgba(255, 255, 255, .1); }
.profile-avatar {
    display: grid;
    place-items: center;
    width: 1.9rem;
    aspect-ratio: 1;
    color: var(--green-dark);
    background: #e7dbac;
    border-radius: 50%;
    font-size: .75rem;
}
.menu-caret { color: #bfd4c8; font-size: .68rem; transition: transform .15s; }
.profile-menu[open] .menu-caret { transform: rotate(180deg); }
.profile-popover {
    position: absolute;
    top: calc(100% + .65rem);
    right: 0;
    width: 12rem;
    padding: .4rem;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: .55rem;
    box-shadow: 0 1rem 2.5rem rgba(23, 34, 29, .16);
}
.profile-popover a, .profile-popover button {
    display: block;
    width: 100%;
    padding: .7rem .8rem;
    color: inherit;
    background: none;
    border: 0;
    border-radius: .35rem;
    cursor: pointer;
    font-size: .86rem;
    text-align: left;
    text-decoration: none;
}
.profile-popover a:hover, .profile-popover button:hover { background: var(--sage); }
.profile-popover form { margin: 0; border-top: 1px solid var(--line); }

.shell { min-height: calc(100vh - 4.5rem); }
.panel {
    display: grid;
    grid-template-rows: 1fr auto;
    place-items: center;
    gap: 1.5rem;
    min-height: calc(100vh - 4.5rem);
    padding: clamp(2rem, 6vw, 5.25rem) clamp(1.25rem, 5.25vw, 3.75rem) 1.125rem;
}

.card {
    width: min(100%, 31rem);
    padding: clamp(1.5rem, 4vw, 2.125rem);
    background: rgba(255, 254, 249, .84);
    border: 1px solid rgba(217, 221, 216, .85);
    border-radius: .8rem;
    box-shadow: 0 1.25rem 4rem rgba(23, 34, 29, .07);
}
.card-wide { width: min(100%, 48rem); }
.form-header { margin-bottom: 2rem; }
.eyebrow { margin: 0 0 .85rem; color: var(--green); font-size: .75rem; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.65rem, 3vw, 2.5rem); font-weight: 500; letter-spacing: -.035em; line-height: 1.05; }
.form-header > p:last-child, .lede { margin: 1rem 0 0; color: var(--muted); line-height: 1.6; }

.auth-form { display: grid; gap: 1.35rem; }
.field { display: grid; gap: .45rem; }
.label-row { display: flex; align-items: center; justify-content: space-between; }
label { font-size: .88rem; font-weight: 700; }
input, textarea {
    width: 100%;
    padding: .57rem .67rem;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: .45rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(35, 95, 75, .13); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
textarea { min-height: 7rem; line-height: 1.5; resize: vertical; }
small { color: var(--muted); font-size: .75rem; line-height: 1.4; }
.field-error { color: var(--danger); }
.text-button { padding: 0; color: var(--green); background: none; border: 0; cursor: pointer; font-size: .78rem; font-weight: 700; }

.button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: .3rem;
    padding: .95rem 1.15rem;
    color: white;
    background: var(--green);
    border: 1px solid var(--green);
    border-radius: .45rem;
    cursor: pointer;
    font-weight: 700;
    transition: background .15s, transform .15s;
}
.button:hover { background: var(--green-dark); }
.button:active { transform: translateY(1px); }
.button-danger { background: #7a2020; border-color: #7a2020; }
.button-danger:hover { background: #5f1717; }

a.button { text-decoration: none; }
.button-secondary { color: var(--ink); background: var(--white); border-color: var(--line); }
.button-secondary:hover { background: var(--sage); }
.button-small {
    display: inline-flex;
    justify-content: center;
    width: auto;
    margin: 0;
    padding: .5rem .85rem;
    border-radius: .4rem;
    font-size: .82rem;
}
.form-actions { display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: center; }
.form-actions .button { margin-top: 0; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.page-header > div { min-width: 0; }
.page-title { font-size: clamp(1.8rem, 3.4vw, 2.5rem); overflow-wrap: anywhere; }
.page-title a { color: inherit; text-decoration-color: var(--line); text-underline-offset: .15em; }
.page-title a:hover { color: var(--green); text-decoration-color: currentColor; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 1.5rem; color: var(--muted); font-size: .8rem; }
.breadcrumb a { color: var(--green); font-weight: 700; text-underline-offset: .2em; }
.breadcrumb span:last-child { overflow-wrap: anywhere; }
.empty-state { display: grid; justify-items: start; gap: 1rem; padding: 1.5rem; background: var(--sage); border-radius: .45rem; }
.empty-state p { margin: 0; color: var(--muted); line-height: 1.6; }

.feed-list, .item-list { display: grid; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.feed-row, .item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}
.item-row { align-items: flex-start; }
.feed-summary, .item-summary { display: grid; gap: .3rem; min-width: 0; }
.feed-title { color: var(--ink); font-weight: 750; overflow-wrap: anywhere; text-underline-offset: .2em; }
.item-title { overflow-wrap: anywhere; }
.item-summary a { color: var(--green); font-weight: 700; }
.item-excerpt { margin: .2rem 0 0; color: var(--muted); font-size: .86rem; line-height: 1.5; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
.row-actions form { margin: 0; }

.item-form { margin-bottom: 2rem; padding: 1.4rem; background: rgba(220, 232, 223, .45); border: 1px solid var(--line); border-radius: .55rem; }
.item-form h3, .list-heading { margin: 0 0 1.1rem; font-family: Georgia, "Times New Roman", serif; font-size: 1.4rem; font-weight: 500; }
.list-heading { margin-bottom: .75rem; }

.slug-address { margin: -.7rem 0 0; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.slug-address code, .feed-summary code { color: var(--green-dark); font-weight: 700; }

.feed-address { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.feed-address h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; font-weight: 500; }
.feed-address p { margin: .75rem 0 1rem; color: var(--muted); font-size: .88rem; line-height: 1.6; }
.copy-field { display: flex; gap: .5rem; align-items: center; }
.copy-field input { min-width: 0; font-size: .85rem; }

.account-deletion { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.account-deletion h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.55rem; font-weight: 500; }
.account-deletion p { margin: .75rem 0 1.25rem; color: var(--muted); font-size: .88rem; line-height: 1.6; }

.notice { margin: 0 0 1.25rem; padding: .8rem 1rem; border-radius: .4rem; font-size: .85rem; line-height: 1.45; }
.notice-error { color: #772626; background: #f8e6e3; border: 1px solid #ebc8c2; }
.notice-success { color: var(--success); background: #e5f1e9; border: 1px solid #c8dfd0; }
.switch-auth { margin: 1.5rem 0 0; color: var(--muted); text-align: center; font-size: .87rem; }
.switch-auth a { color: var(--green); font-weight: 750; text-underline-offset: .2em; }
.footer-copy { align-self: end; margin: 0; color: #8b948f; font-size: .74rem; text-align: center; }

.workspace-path { display: grid; gap: .35rem; margin: 2rem 0 0; padding: 1rem; background: var(--sage); border-radius: .45rem; }
.workspace-path span { color: var(--muted); font-size: .75rem; }
.workspace-path code { color: var(--green-dark); font-weight: 700; }

@media (max-width: 520px) {
    .header { padding-inline: 1rem; }
    .profile-menu summary { gap: .4rem; }
    .profile-avatar { display: none; }
    .panel { place-items: start center; padding-top: 2rem; }
    .card { padding: 1.4rem; }
    h2 { font-size: 1.65rem; }
    .page-title { font-size: 1.8rem; }
    .page-header, .feed-row, .item-row { flex-direction: column; align-items: stretch; }
    .row-actions { justify-content: flex-start; }
    .item-form { padding: 1rem; }
    .form-actions { grid-template-columns: 1fr; }
}

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