:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --line: #d7deea;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --ok: #d1fae5;
    --warn: #fee2e2;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #111827;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand a, .nav a { color: white; }
.brand { font-weight: 700; font-size: 1.1rem; }
.nav { display: flex; gap: 1rem; flex-wrap: wrap; }

.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

.hero, .split-header {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: flex-start;
}

.simple-gap { align-items: center; }
.big-gap { margin-top: .25rem; }

.section { margin-bottom: 1.5rem; }
.narrow { max-width: 820px; }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.two-column {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.card, .form-card, .disclosure {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.05);
}

.disclosure summary {
    cursor: pointer;
    font-weight: 700;
    list-style: none;
}

.disclosure summary::-webkit-details-marker { display: none; }
.disclosure > * + * { margin-top: 1rem; }

.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; border-color: #bfd2ff; }
.card-header, .history-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.stats-row, .stats-inline {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-top: .75rem;
}

.stats-row > div {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .75rem;
    background: #f8fafc;
    border-radius: 14px;
    min-width: 110px;
}

.stats-pill {
    display: inline-flex;
    align-items: center;
    padding: .35rem .7rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #1d4ed8;
    font-size: .92rem;
    font-weight: 600;
}

.tags-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .75rem;
}

.tag {
    padding: .3rem .6rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: .86rem;
}

.tag-editor {
    display: grid;
    gap: .6rem;
}

.tag-editor-selected,
.tag-editor-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.tag-editor-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .5rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .55rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: .88rem;
}

.tag-chip-suggestion {
    background: #f8fafc;
    color: #334155;
    border: 1px dashed var(--line);
}

.tag-chip-btn {
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.7);
    color: inherit;
    border: 1px solid rgba(0,0,0,.08);
    font-weight: 700;
}

.tab-switcher {
    display: inline-flex;
    gap: .5rem;
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .35rem;
    margin: 0 auto 1rem;
}

.tab-button {
    border: none;
    background: transparent;
    color: var(--muted);
    padding: .55rem 1rem;
    border-radius: 999px;
    font-weight: 700;
}

.tab-button.active {
    background: var(--accent-soft);
    color: #1d4ed8;
}

.group-card .group-count {
    display: inline-block;
    margin-bottom: .5rem;
    padding: .25rem .6rem;
    background: var(--ok);
    border-radius: 999px;
    font-weight: 700;
}

.description, .muted, .helper-text { color: var(--muted); }
.helper-text { font-size: .92rem; }
.empty-state { text-align: center; padding: 2rem; }

.form-card {
    display: grid;
    gap: .85rem;
}

.form-card label, .inline-form-grid label {
    display: grid;
    gap: .35rem;
    font-weight: 600;
    font-size: .95rem;
}

input[type="text"], input[type="url"], input[type="email"], select, textarea, input[type="file"] {
    width: 100%;
    padding: .7rem .8rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    font: inherit;
}

button, .button-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    padding: .75rem 1rem;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button.secondary, .button-link.secondary {
    background: #e5e7eb;
    color: #111827;
}

.button-link:hover, button:hover { opacity: .95; text-decoration: none; }

.kind-image {
    width: 220px;
    max-width: 100%;
    border-radius: 16px;
    border: 1px solid var(--line);
    object-fit: cover;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: 18px;
    overflow: hidden;
}

thead { background: #eef2ff; }
th, td {
    padding: .9rem .85rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.history-list, .mini-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: .8rem;
}

.history-list li, .mini-list li {
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fafcff;
}

.wide-list li { background: white; }
.inline-form-grid {
    display: grid;
    gap: .75rem;
}

.search-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .5rem;
    min-width: min(100%, 420px);
}

.stack { display: grid; gap: 1rem; }
.centered { display: flex; justify-content: center; }

@media (max-width: 960px) {
    .two-column { grid-template-columns: 1fr; }
    .hero, .split-header, .topbar { flex-direction: column; align-items: stretch; }
    .search-form { grid-template-columns: 1fr; }
    .tab-switcher { display: flex; }
    .hero-side { justify-items: stretch; min-width: 100%; }
    .inline-pair { grid-template-columns: 1fr; }
}


.hero-actions { align-items: flex-end; }
.hero-side {
    display: grid;
    gap: .75rem;
    justify-items: end;
    min-width: min(100%, 460px);
}
.centered-stack {
    display: grid;
    gap: 1rem;
    max-width: 920px;
    margin: 0 auto 1.5rem;
}
.centered-stack .disclosure {
    width: 100%;
}
.actions-row {
    margin-bottom: 1rem;
}
.groups-tools button,
.groups-tools .button-link {
    min-width: 260px;
}
.inline-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}
.disclosure summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.disclosure summary::after {
    content: '▾';
    color: var(--muted);
}
.disclosure[open] summary::after {
    transform: rotate(180deg);
}
