:root {
    --paper: #e7f6f4;
    --paper-deep: #d3eeea;
    --surface: #f8fffe;
    --ink: #0e2422;
    --ink-soft: #3d5c58;
    --line: #c5e3de;
    --teal: #0f9a8c;
    --teal-deep: #0a655c;
    --teal-soft: #dff4f1;
    --brass: #0f9a8c;
    --ok: #0c7a55;
    --ok-soft: #e3f6ee;
    --danger: #8f2d2d;
    --danger-soft: #fdeeee;
    --shadow: 0 18px 40px rgba(14, 36, 34, 0.08);
    --rail: rgba(248, 255, 254, 0.86);
    --placeholder: #6a8884;
    --admin-input-bg: #f8fafb;
    --admin-input-border: #dfe5ea;
    --admin-chip-count: #8aa0b0;
    --serif: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
    --font: "Segoe UI", "Helvetica Neue", sans-serif;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --paper: #071916;
    --paper-deep: #0e2421;
    --surface: #102825;
    --ink: #f3fbf9;
    --ink-soft: #b7d0cb;
    --line: #1e3d38;
    --teal: #0f9a8c;
    --teal-deep: #7ee0d4;
    --teal-soft: #123632;
    --brass: #7ee0d4;
    --ok: #8ee0c0;
    --ok-soft: #12362c;
    --danger: #ffb4b0;
    --danger-soft: #3a1d1c;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
    --rail: #0a1f1c;
    --placeholder: #8eada7;
    --admin-input-bg: #102825;
    --admin-input-border: #1e3d38;
    --admin-chip-count: #7a9690;
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #071916;
        --paper-deep: #0e2421;
        --surface: #102825;
        --ink: #f3fbf9;
        --ink-soft: #b7d0cb;
        --line: #1e3d38;
        --teal: #0f9a8c;
        --teal-deep: #7ee0d4;
        --teal-soft: #123632;
        --brass: #7ee0d4;
        --ok: #8ee0c0;
        --ok-soft: #12362c;
        --danger: #ffb4b0;
        --danger-soft: #3a1d1c;
        --shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
        --rail: #0a1f1c;
        --placeholder: #8eada7;
        --admin-input-bg: #102825;
        --admin-input-border: #1e3d38;
        --admin-chip-count: #7a9690;
        color-scheme: dark;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    font-size: 16px;
}

body {
    --page-bg:
        radial-gradient(circle at top left, rgba(15, 154, 140, 0.36), transparent 34rem),
        linear-gradient(180deg, rgba(15, 154, 140, 0.16), transparent 28rem),
        var(--paper);
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--page-bg);
    background-attachment: fixed;
}

img,
svg {
    display: block;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

::placeholder {
    color: var(--placeholder);
}

::selection {
    background: #b7ebe4;
    color: #04221f;
}

@supports selector(:focus-visible) {
    :focus:not(:focus-visible) {
        outline: none;
    }
}

:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 3px;
}

h1,
h2,
p {
    margin-top: 0;
}

.skip {
    position: absolute;
    left: 12px;
    top: -48px;
    z-index: 20;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
}

.skip:focus {
    top: 12px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-name,
.brand-kicker {
    display: block;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.brand-sub,
.brand-kicker {
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 600;
}

.brand-rule {
    width: 36px;
    height: 3px;
    margin: 18px 0;
    border: 0;
    border-radius: 999px;
    background: var(--brass);
}

.logo-mark {
    flex: 0 0 auto;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--teal-deep);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.lede,
.hint,
.fine-print,
.rail-meta,
.rail-intro,
.search-hint,
.result-count,
.cell-note,
.who {
    color: var(--ink-soft);
}

.lede {
    margin-bottom: 0;
}

.hint,
.fine-print,
.search-hint,
.rail-meta {
    font-size: 0.82rem;
}

.hint,
.fine-print {
    margin: 0;
}

.text-link {
    color: var(--teal-deep);
    font-weight: 700;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.btn-primary {
    background: #0f9a8c;
    color: #04221f;
}

.btn-primary:hover {
    background: #14b5a5;
}

.btn-ghost {
    border-color: var(--line);
    background: var(--surface);
}

.btn-ghost:hover {
    border-color: #8ecfc6;
    background: var(--teal-soft);
}

.btn-danger {
    background: #8f2d2d;
    color: #fff8f7;
}

.btn-danger:hover {
    filter: brightness(0.95);
}

.btn-small {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.85rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
}

.btn-icon .icon {
    width: 18px;
    height: 18px;
}

.btn-block {
    width: 100%;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.theme-toggle .theme-icon,
.theme-toggle .theme-label {
    display: none;
}

.theme-toggle .icon {
    width: 18px;
    height: 18px;
}

:root .theme-icon-moon,
:root .theme-label-to-dark {
    display: inline;
}

:root .theme-icon-moon {
    display: grid;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-icon-moon,
    :root:not([data-theme="light"]) .theme-label-to-dark {
        display: none;
    }

    :root:not([data-theme="light"]) .theme-icon-sun {
        display: grid;
    }

    :root:not([data-theme="light"]) .theme-label-to-light {
        display: inline;
    }
}

:root[data-theme="dark"] .theme-icon-moon,
:root[data-theme="dark"] .theme-label-to-dark {
    display: none;
}

:root[data-theme="dark"] .theme-icon-sun {
    display: grid;
}

:root[data-theme="dark"] .theme-label-to-light {
    display: inline;
}

:root[data-theme="light"] .theme-icon-sun,
:root[data-theme="light"] .theme-label-to-light {
    display: none;
}

:root[data-theme="light"] .theme-icon-moon {
    display: grid;
}

:root[data-theme="light"] .theme-label-to-dark {
    display: inline;
}

.rail-footer .theme-toggle {
    width: 100%;
}

.setup-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 22px;
}

.setup-bar .brand {
    margin-bottom: 0;
}

.login-card .theme-toggle {
    margin-bottom: 18px;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.flash {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.flash-ok {
    background: var(--ok-soft);
}

.flash-error {
    background: var(--danger-soft);
}

.flash ul {
    margin: 0;
    padding-left: 18px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field > span:first-child,
legend {
    font-size: 0.92rem;
    font-weight: 700;
}

input[type="text"]:not(.admin-pill-input):not(.admin-search-input),
input[type="password"]:not(.admin-pill-input),
input[type="url"]:not(.admin-pill-input),
input[type="number"]:not(.admin-pill-input),
input[type="search"]:not(.admin-search-input),
textarea,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input[type="color"] {
    width: 64px;
    padding: 6px;
}

.check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 12px;
}

.check input {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
}

fieldset {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
}

legend {
    padding: 0 6px;
}

.form-grid,
.settings-grid,
.editor {
    display: grid;
    gap: 14px;
}

.form-grid {
    grid-template-columns: 1fr 1fr;
}

.span-2 {
    grid-column: span 2;
}

.stack-form {
    display: grid;
    gap: 16px;
}

.panel {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
}

.panel h2,
.section-head h2,
.empty-panel h2 {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.technical {
    padding: 10px 12px;
    overflow-wrap: anywhere;
    border-radius: 12px;
    background: var(--paper-deep);
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.82rem;
}

code {
    font-family: Consolas, "Courier New", monospace;
}

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

.rail {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 28px 22px;
    border-right: 1px solid var(--line);
    background: var(--rail);
}

.rail-intro {
    margin: 0 0 18px;
}

.rail-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

@media (min-width: 901px) {
    .rail-nav {
        flex: 1;
        overflow: auto;
    }
}

.cat-link {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 12px;
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}

.cat-link:hover {
    background: var(--paper-deep);
}

.cat-link[aria-current="page"] {
    background: var(--teal-soft);
    color: var(--teal-deep);
}

.cat-count,
.count-pill,
.stats strong {
    font-variant-numeric: tabular-nums;
}

.cat-count {
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 700;
}

.cat-link[aria-current="page"] .cat-count {
    color: inherit;
}

.rail-footer {
    display: grid;
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
}

.main {
    padding: 8px 32px 64px;
}

.main-top,
.catalog {
    width: min(1120px, 100%);
}

.main-top {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-end;
    padding: 28px 0 18px;
    background: var(--page-bg);
    background-attachment: fixed;
}

.page-public h1,
.page-public .section-head h2,
.login-panel h1,
.setup-card h1,
.page-simple h1 {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: -0.03em;
}

.page-public h1,
.setup-card h1,
.page-simple h1 {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    line-height: 0.95;
}

.result-count {
    margin: 8px 0 0;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(220px, 360px) auto;
    gap: 8px 10px;
    justify-content: end;
    margin: 0;
}

.search-box {
    position: relative;
}

.search-box input {
    padding-left: 40px;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    color: var(--ink-soft);
    transform: translateY(-50%);
    pointer-events: none;
}

.search-hint {
    grid-column: 1 / -1;
    margin: 0;
    text-align: right;
}

.section {
    margin: 8px 0 28px;
}

.section-head {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.section-head h2 {
    margin: 0;
}

.count-pill {
    min-width: 28px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--paper-deep);
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 176px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(28, 25, 21, 0.03);
}

.tool-card:hover {
    border-color: #8ecfc6;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.tool-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 13px;
    background: var(--teal-soft);
    background: color-mix(in srgb, var(--accent, var(--teal)) 16%, var(--surface));
    color: var(--accent, var(--teal));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, var(--teal)) 30%, transparent);
}

.tool-card:hover .tool-icon {
    background: var(--accent, var(--teal));
    color: #f7fffe;
}

.tool-icon-sm {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex: 0 0 auto;
}

.tool-ext {
    color: var(--ink-soft);
}

.tool-card:hover .tool-ext {
    color: var(--teal-deep);
}

.tool-name {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tool-desc {
    display: -webkit-box;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: 0.92rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.tool-host {
    margin-top: auto;
    color: var(--ink-soft);
    font-size: 0.8rem;
}

.empty-panel {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 56px 16px;
    text-align: center;
}

.empty-panel p,
.panel-empty p {
    max-width: 42ch;
    margin-bottom: 8px;
    color: var(--ink-soft);
}

.page-admin {
    background: var(--page-bg);
    background-attachment: fixed;
}

.row-actions,
.inline-search,
.color-row,
.rename-form,
.category-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.admin-main {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 72px;
}

.page-admin h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.page-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.stats li {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

.stats strong {
    display: block;
    font-size: 1.7rem;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.admin-filter-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(160px, 200px);
    gap: 12px 20px;
    align-items: center;
    margin-bottom: 16px;
}

.admin-filter-groups {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.admin-filters-sub .admin-chip {
    font-size: 0.88rem;
    font-weight: 600;
}

.admin-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.admin-filters:not(.admin-filters-sub) .admin-chip:not([aria-current="true"]) {
    font-weight: 400;
}

.admin-chip {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    background: var(--surface);
    font-size: 0.92rem;
    font-weight: 650;
    text-decoration: none;
}

.admin-chip span {
    color: var(--admin-chip-count);
    font-variant-numeric: tabular-nums;
}

.admin-chip[aria-current="true"] {
    border-color: var(--line);
    color: var(--ink);
    font-weight: 800;
    box-shadow: var(--shadow);
    background: #ffffff;
}

:root[data-theme="dark"] .admin-chip[aria-current="true"] {
    background: var(--surface);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .admin-chip[aria-current="true"] {
        background: var(--surface);
    }
}

.admin-toolbar-search {
    justify-self: end;
    width: 100%;
    max-width: 200px;
    margin: 0;
    min-width: 0;
}

.admin-search {
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--admin-input-border);
    border-radius: 999px;
    background: #ffffff;
}

.admin-search:focus-within {
    outline: 2px solid var(--teal);
    outline-offset: 1px;
    border-color: var(--teal);
    background: #ffffff;
}

:root[data-theme="dark"] .admin-search,
:root[data-theme="dark"] .admin-search:focus-within {
    background: var(--admin-input-bg);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .admin-search,
    :root:not([data-theme="light"]) .admin-search:focus-within {
        background: var(--admin-input-bg);
    }
}

.admin-search .admin-search-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--ink);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
}

.admin-search .admin-search-input::placeholder {
    color: var(--muted);
    font-weight: 500;
}

.admin-search .admin-search-input:focus {
    outline: none;
}

.admin-search-icon {
    flex: 0 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    color: var(--muted);
    pointer-events: none;
}

.admin-search-glyph {
    display: block;
    width: 15px;
    height: 15px;
}

@media (max-width: 720px) {
    .admin-filter-bar {
        grid-template-columns: 1fr;
    }

    .admin-toolbar-search {
        justify-self: stretch;
        max-width: none;
    }
}

.inline-search {
    margin-bottom: 16px;
}

.inline-search.rename-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-search input:not(.admin-pill-input) {
    width: min(420px, 100%);
}

.admin-pill-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    min-height: 36px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--admin-input-border);
    border-radius: 999px;
    background: var(--admin-input-bg);
    color: inherit;
    font-size: 0.875rem;
    font-weight: 600;
}

.admin-pill-input::placeholder {
    color: var(--placeholder);
    font-weight: 500;
}

.admin-pill-input:focus {
    outline: 2px solid var(--teal);
    outline-offset: 1px;
    border-color: var(--teal);
    background: var(--surface);
}

textarea.admin-pill-input {
    height: auto;
    min-height: 96px;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.5;
    resize: vertical;
}

select.admin-pill-input {
    appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c6e7e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 10l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

.add-form {
    margin-bottom: 8px;
}

.settings-form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.field .admin-pill-input {
    width: 100%;
    flex: none;
}

.import-upload-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.import-upload-row .admin-pill-file {
    flex: 1 1 220px;
    min-width: 0;
    width: auto;
}

.admin-pill-file {
    width: min(420px, 100%);
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid var(--admin-input-border);
    border-radius: 999px;
    background: var(--admin-input-bg);
    color: inherit;
    font-size: 0.875rem;
    font-weight: 600;
}

.admin-pill-file:focus {
    outline: 2px solid var(--teal);
    outline-offset: 1px;
    border-color: var(--teal);
    background: var(--surface);
}

.admin-pill-file::file-selector-button {
    margin-right: 12px;
    padding: 6px 12px;
    border: 1px solid var(--admin-input-border);
    border-radius: 999px;
    background: var(--surface);
    color: inherit;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}


.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

th,
td {
    padding: 14px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--paper);
    color: var(--ink-soft);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.admin-table-sort {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-decoration: none;
    text-transform: inherit;
}

.admin-table-sort:hover {
    color: var(--ink);
}

.admin-table-sort.is-active {
    color: var(--ink);
}

.admin-table-sort-indicator {
    font-size: 0.85rem;
    line-height: 1;
}

td {
    border-top: 1px solid var(--line);
}

.group-row th {
    padding-top: 18px;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 1.05rem;
    letter-spacing: 0;
    text-transform: none;
}

.category-col {
    color: var(--muted);
    font-size: 0.92rem;
    white-space: nowrap;
}

.page-admin .admin-tools-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.page-admin .admin-tools-table .col-tool {
    width: 34%;
}

.page-admin .admin-tools-table .col-category,
.page-admin .admin-tools-table .col-subcategory {
    width: 12%;
}

.page-admin .admin-tools-table .col-link {
    width: 22%;
}

.page-admin .admin-tools-table .col-status {
    width: 5%;
}

.page-admin .admin-tools-table .col-actions {
    width: 15%;
}

.page-admin .admin-tools-table th,
.page-admin .admin-tools-table td {
    padding-inline: 10px;
}

.page-admin .admin-tools-table .category-col,
.page-admin .admin-tools-table .link-col {
    overflow: hidden;
    max-width: 0;
    text-overflow: ellipsis;
}

.page-admin .admin-tools-table .name-cell {
    min-width: 0;
}

.page-admin .admin-tools-table .name-cell > span:last-child {
    min-width: 0;
    overflow: hidden;
}

.page-admin .admin-tools-table .cell-note,
.page-admin .admin-tools-table .url-clip {
    max-width: 100%;
}

.page-admin .admin-tools-table .status-col {
    white-space: nowrap;
}

.actions-col,
.row-actions {
    text-align: right;
}

.row-actions {
    justify-content: flex-end;
}

.row-actions form {
    display: inline-flex;
}

.name-cell {
    display: flex;
    gap: 10px;
    align-items: center;
}

.drag-handle {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    cursor: grab;
}

.drag-handle:hover {
    background: var(--teal-soft);
    color: var(--teal-deep);
}

.drag-handle:active {
    cursor: grabbing;
}

.sortable-row.is-dragging {
    opacity: 0.55;
}

.sortable-row.is-drop-target {
    box-shadow: inset 0 2px 0 var(--teal);
}

.cell-note,
.url-clip {
    display: block;
    max-width: 320px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-clip {
    color: var(--teal-deep);
    text-decoration: none;
}

.url-clip:hover {
    text-decoration: underline;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-ok {
    background: var(--ok-soft);
    color: var(--ok);
}

.badge-muted {
    background: var(--paper-deep);
    color: var(--ink-soft);
}


.import-columns {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--ink-soft);
}

.import-columns li + li {
    margin-top: 6px;
}

.reorder-note {
    margin: -6px 0 12px;
}

.editor {
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.7fr);
    align-items: start;
}

.preview-sticky {
    position: sticky;
    top: 92px;
}

.icon-picker,
.swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.icon-option {
    position: relative;
}

.icon-option input {
    position: absolute;
    opacity: 0;
}

.icon-option span {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.icon-option input:checked + span {
    border-color: var(--teal);
    background: var(--teal-soft);
    color: var(--teal-deep);
}

.icon-option input:focus-visible + span {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

.swatch {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid var(--surface);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--line);
    cursor: pointer;
}

.category-list {
    display: grid;
}

.category-row {
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.rename-form,
.add-form {
    flex: 1;
    min-width: 0;
}

.rename-form .admin-pill-input {
    flex: 1;
    min-width: 0;
}

.move-spacer {
    width: 46px;
    flex: 0 0 auto;
}

.settings-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
}

.confirm-panel {
    margin-bottom: 16px;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(280px, 1.05fr) minmax(320px, 0.95fr);
    min-height: 100vh;
}

.login-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 48px;
    background:
        radial-gradient(circle at 20% 20%, rgba(15, 154, 140, 0.55), transparent 24rem),
        #063632;
    color: #f4fffd;
}

.login-panel h1 {
    max-width: 11ch;
    margin: 28px 0 12px;
    color: #f4fffd;
    font-size: clamp(2.6rem, 6vw, 4.4rem);
}

.login-panel p {
    max-width: 36ch;
    color: #d4eeea;
}

.brand-on-dark .brand-kicker {
    color: #d4eeea;
}

.login-note {
    margin: 0;
    color: #7ee0d4;
    font-weight: 700;
}

.login-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.login-card {
    width: min(420px, 100%);
}

.login-card h2 {
    margin: 0 0 18px;
    font-size: 1.8rem;
    letter-spacing: -0.03em;
}

.login-lede {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.login-card .hub-google-signin {
    position: relative;
    width: 100%;
    max-width: 320px;
    min-height: 44px;
    margin: 0 auto 16px;
}

.login-card .hub-google-signin-face {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 0 22px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-card .hub-google-signin-face:hover {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15, 154, 140, 0.12);
}

.login-card .hub-google-signin-face:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 3px;
}

.login-card .hub-google-signin-face:disabled {
    cursor: wait;
    opacity: 0.72;
}

.login-card .hub-google-signin-mark {
    flex: 0 0 auto;
}

.login-card .hub-google-signin-proxy {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 320px;
    height: 44px;
    overflow: hidden;
}

.login-card .hub-google-signin-proxy > div,
.login-card .hub-google-signin-proxy iframe {
    width: 320px !important;
    min-height: 44px !important;
    height: 44px !important;
    margin: 0 !important;
}

.login-card .hub-google-signin.is-google-fallback-visible .hub-google-signin-face {
    display: none;
}

.login-card .hub-google-signin.is-google-fallback-visible .hub-google-signin-proxy {
    position: static;
    left: auto;
    width: 100%;
    max-width: 320px;
    height: auto;
    min-height: 44px;
    margin: 0 auto;
    overflow: visible;
}

:root[data-theme="dark"] .login-card {
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .login-card {
        color-scheme: dark;
    }
}

.login-note {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.admin-email-list {
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.admin-email-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
}

.admin-email-row:first-child {
    border-top: 0;
}

.inline-form {
    margin: 0;
}

.setup {
    width: min(760px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 64px;
}

.setup-bar {
    margin-bottom: 22px;
}

.setup-card {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.setup-card .button-row,
.simple-main .btn {
    margin-top: 18px;
}

.simple-main {
    width: min(680px, calc(100% - 32px));
    margin: 0 auto;
    padding: 64px 0;
}

.simple-main .setup-bar {
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .shell,
    .login-shell,
    .editor,
    .settings-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

    .rail {
        position: relative;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .rail-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .cat-link {
        flex: 0 0 auto;
    }

    .rail-footer {
        margin-top: 16px;
    }

    .main {
        padding: 8px 16px 48px;
    }

    .main-top,
    .page-head,
    .search-form {
        display: grid;
        grid-template-columns: 1fr;
        justify-content: stretch;
    }

    .search-hint {
        display: none;
    }

    .login-panel {
        min-height: auto;
        padding: 28px 20px;
    }

    .preview-sticky {
        position: static;
    }

    .stats {
        grid-template-columns: 1fr;
    }
}

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

    .tool-card:hover {
        transform: none;
    }
}

@media print {
    .rail,
    .search-form,
    .skip,
    .hub-header {
        display: none !important;
    }

    .shell {
        display: block;
    }

    .tool-card {
        break-inside: avoid;
        box-shadow: none;
    }
}
