:root {
    color-scheme: light;
    --blue: #245da8;
    --blue-dark: #17457f;
    --border: #d8dee8;
    --muted: #647184;
    --soft: #f5f7fa;
    --danger: #a52a2a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: #fff;
    color: #202630;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
    outline: 3px solid #82b7f4;
    outline-offset: 2px;
}

.container { width: min(100% - 2rem, 900px); margin: 0 auto; padding: 1.25rem 0 3rem; }
.narrow { max-width: 520px; }
.site-header, .section-heading, .filter-summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
h1 { margin: 0; color: var(--blue-dark); font-size: 1.75rem; }
h2 { margin: 0; font-size: 1.25rem; }
.muted, .domain, .note-dates, .admin-main span { color: var(--muted); font-size: .9rem; }

.search-form { margin: 1.5rem 0; }
.search-form > label { display: block; margin-bottom: .4rem; font-weight: 650; }
.search-row { display: flex; gap: .6rem; }
input, textarea, select, button, .button {
    border: 1px solid #aeb8c7;
    border-radius: .45rem;
    font: inherit;
}
input, textarea, select { width: 100%; padding: .7rem .75rem; background: #fff; color: inherit; }
textarea { resize: vertical; }
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: .6rem 1rem;
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}
button:hover, .button:hover { background: var(--blue-dark); color: #fff; }
.secondary { border-color: var(--border); background: #fff; color: var(--blue); }
.secondary:hover { background: var(--soft); color: var(--blue-dark); }
.danger { border-color: var(--danger); background: #fff; color: var(--danger); }
.danger:hover { background: var(--danger); color: #fff; }
.small { min-height: 2.3rem; padding: .35rem .7rem; font-size: .9rem; }

.filter-summary { margin: 1rem 0; border-bottom: 1px solid var(--border); }
.category-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .25rem 0; }
.sort-controls, .category-controls { display: flex; align-items: center; gap: .75rem; }
.sort-controls { color: var(--muted); font-size: .9rem; }
.sort-controls a[aria-current="page"] { color: #202630; font-weight: 700; text-decoration: none; }
.category-controls button { min-height: auto; padding: .25rem; border: 0; background: transparent; color: var(--blue); font-weight: 400; text-decoration: underline; }
.category-controls button:hover { background: transparent; color: var(--blue-dark); }
.category { border-bottom: 1px solid var(--border); }
.category summary { padding: 1rem .25rem; color: var(--blue-dark); cursor: pointer; font-size: 1.15rem; font-weight: 700; }
.note-list { padding: 0 .25rem .5rem; }
.note { padding: .85rem 0; overflow-wrap: anywhere; }
.note + .note { border-top: 1px solid #edf0f4; }
.note h2 { font-size: 1.05rem; }
.note h2 a { text-decoration: none; }
.description { margin: .35rem 0; }
.domain { margin: .25rem 0; overflow-wrap: anywhere; }
.note-dates { margin: .2rem 0; }
.tags { display: flex; flex-wrap: wrap; gap: .25rem .75rem; }
.tags a { text-decoration: none; }
.hashtag { direction: ltr; unicode-bidi: isolate; }
.empty { padding: 1rem; background: var(--soft); border-radius: .45rem; }

.admin-nav { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem 1rem; margin: 1.25rem 0; padding-bottom: .8rem; border-bottom: 1px solid var(--border); }
.admin-nav a[aria-current="page"] { color: #202630; font-weight: 750; text-decoration: none; }
.admin-nav form { margin-left: auto; }
.link-button { min-height: auto; padding: 0; border: 0; background: transparent; color: var(--blue); font-weight: 400; text-decoration: underline; }
.link-button:hover { background: transparent; color: var(--blue-dark); }
.section-heading { margin: 1.25rem 0 .75rem; }
.panel { padding: 1rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--soft); }
.form { display: grid; gap: .45rem; }
.form label, legend { font-weight: 650; }
.form input + label, .form textarea + label, .form select + label, .form fieldset + label { margin-top: .55rem; }
fieldset { margin: .6rem 0; padding: .75rem; border: 1px solid var(--border); border-radius: .45rem; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; }
.check { display: flex; align-items: center; gap: .45rem; font-weight: 400 !important; }
.check input { width: auto; }
.form-actions, .row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.form-actions { margin-top: .75rem; }

.admin-list { border: 1px solid var(--border); border-radius: .55rem; overflow: hidden; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem; }
.admin-row + .admin-row { border-top: 1px solid var(--border); }
.admin-main { min-width: 0; display: grid; overflow-wrap: anywhere; }
.row-actions { flex-shrink: 0; }
.row-actions form { margin: 0; }
.flash { margin: 1rem 0; padding: .75rem 1rem; border: 1px solid var(--border); border-radius: .45rem; }
.flash-success { border-color: #8ab99a; background: #f1faf4; }
.flash-error { border-color: #d8a2a2; background: #fff5f5; }
.flash ul { margin-bottom: 0; }

@media (max-width: 600px) {
    .container { width: min(100% - 1.25rem, 900px); padding-top: .85rem; }
    .search-row { align-items: stretch; flex-direction: column; }
    .search-row button { width: 100%; }
    .site-header { align-items: baseline; }
    .admin-nav form { margin-left: 0; }
    .category-toolbar { align-items: flex-start; flex-direction: column; gap: .35rem; }
    .admin-row { align-items: stretch; flex-direction: column; }
    .row-actions { width: 100%; }
    .row-actions > *, .row-actions form, .row-actions button { flex: 1; }
}
