.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: var(--ink);
    color: #fbf9f2;
    font-size: 12.5px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.btn:hover {
    background: #36352e;
}

.btn:active {
    transform: scale(0.985);
}

.btn svg {
    opacity: 0.9;
}

.btn--secondary {
    background: var(--card);
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn--secondary:hover {
    background: var(--surface);
    border-color: var(--faint);
}

.btn--ghost {
    background: transparent;
    color: var(--muted);
}

.btn--ghost:hover {
    background: rgba(34, 33, 29, 0.05);
    color: var(--ink);
}

.btn--danger {
    background: var(--danger);
    color: var(--white);
}

.btn--danger:hover {
    background: #8c352b;
}

.btn--sm {
    min-height: 33px;
    padding: 0 11px;
    font-size: 11.5px;
}

.btn--sm svg {
    width: 15px;
    height: 15px;
}

.btn--block {
    width: 100%;
}

.btn--link {
    min-height: auto;
    padding: 0;
    background: transparent;
    color: var(--ink);
    border: 0;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 31px;
    height: 31px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.icon-btn:hover {
    background: var(--card);
    border-color: var(--line);
    color: var(--ink);
}

.icon-btn--danger:hover {
    background: var(--danger-soft);
    border-color: #eed4ce;
    color: var(--danger);
}

.icon-btn.is-copied {
    background: var(--sage);
    border-color: #d5e1d0;
    color: var(--sage-ink);
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.card--flush {
    overflow: hidden;
}

.card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px 16px;
    border-bottom: 1px solid var(--line);
}

.card__head--plain {
    border-bottom: 0;
    padding-bottom: 0;
}

.card__title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card__hint {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.7;
}

.card__body {
    padding: 20px 22px;
}

.card__body--flush {
    padding: 0;
}

.card__footer {
    padding: 14px 22px;
    border-top: 1px solid var(--line);
    background: rgba(250, 248, 243, 0.55);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    position: relative;
    min-width: 0;
    padding: 18px 19px 17px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.stat__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.stat__label {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 550;
}

.stat__icon {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-soft);
}

.stat--sage .stat__icon { background: var(--sage); color: var(--sage-ink); }
.stat--clay .stat__icon { background: var(--clay); color: var(--clay-ink); }
.stat--sky .stat__icon { background: var(--sky); color: var(--sky-ink); }
.stat--sand .stat__icon { background: var(--sand); color: var(--sand-ink); }

.stat__value {
    margin-top: 12px;
    font-size: clamp(26px, 2.4vw, 34px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.045em;
}

.stat__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 10.5px;
}

.stat__meta .dot-sep {
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: var(--faint);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 21px;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 650;
    line-height: 1.4;
    white-space: nowrap;
}

.badge--success { background: var(--sage); color: var(--sage-ink); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--muted { background: #efede6; color: #5d594f; }
.badge--info { background: var(--sky); color: var(--sky-ink); }
.badge--warning { background: var(--sand); color: var(--sand-ink); }

.badge--dot::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 10.5px;
    line-height: 1.5;
}

.chip svg {
    opacity: 0.7;
}

a.chip:hover {
    border-color: var(--line-strong);
    color: var(--ink);
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    padding: 11px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--card);
    color: var(--ink-soft);
    font-size: 12.5px;
    animation: flash-in 320ms var(--ease) both;
}

.flash__icon {
    margin-top: 2px;
}

.flash__text {
    flex: 1;
    padding-top: 1px;
}

.flash__close {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin: -2px -4px 0 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
}

.flash__close:hover {
    background: rgba(34, 33, 29, 0.06);
    color: var(--ink);
}

.flash--success { background: #f0f4ec; border-color: #dbe5d5; }
.flash--success .flash__icon { color: var(--sage-ink); }
.flash--error { background: #fbf0ed; border-color: #efd8d2; }
.flash--error .flash__icon { color: var(--danger); }
.flash--info { background: #eef3f5; border-color: #dce7eb; }
.flash--info .flash__icon { color: var(--sky-ink); }

.flash.is-leaving {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 240ms ease, transform 240ms ease;
}

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.callout {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 11.5px;
    line-height: 1.85;
}

.callout svg {
    margin-top: 2px;
    color: var(--muted);
}

.callout--warning { background: #fbf6e9; border-color: #ece0c2; }
.callout--warning svg { color: var(--sand-ink); }
.callout--danger { background: var(--danger-soft); border-color: #ecd5cf; }
.callout--danger svg { color: var(--danger); }

.form-grid {
    display: grid;
    gap: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    min-width: 0;
}

.field > label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 650;
}

.field__optional {
    color: var(--faint);
    font-size: 10px;
    font-weight: 400;
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 43px;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--ink);
    font-size: 13px;
    line-height: 1.7;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: #c3bbae;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: 0;
    border-color: var(--ink-soft);
    box-shadow: 0 0 0 3px rgba(34, 33, 29, 0.055);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
    background: var(--surface);
    color: var(--muted);
}

.textarea {
    min-height: 122px;
    resize: vertical;
}

.input--ltr {
    direction: ltr;
    text-align: left;
    font-family: var(--mono);
    font-size: 12px;
}

.input--slug {
    font-family: var(--mono);
    font-size: 12px;
}

.select {
    padding-inline-end: 34px;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(0% + 15px) calc(50% + 1px), calc(0% + 10px) calc(50% + 1px);
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
}

.field__hint {
    margin-top: 6px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.8;
}

.field__error {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    color: var(--danger);
    font-size: 10.5px;
}

.has-error .input,
.has-error .select,
.has-error .textarea {
    border-color: #cb8379;
    background: #fffbfa;
}

.input-affix {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--white);
    overflow: hidden;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.input-affix:focus-within {
    border-color: var(--ink-soft);
    box-shadow: 0 0 0 3px rgba(34, 33, 29, 0.055);
}

.input-affix__prefix {
    display: flex;
    align-items: center;
    max-width: 55%;
    padding: 0 11px;
    border-inline-end: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.input-affix .input {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    min-height: 41px;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 12px;
    cursor: pointer;
}

.check input[type='checkbox'] {
    width: 16px;
    height: 16px;
    margin: 3px 0 0;
    accent-color: var(--ink);
}

.check__text {
    line-height: 1.8;
}

.check__hint {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    padding-top: 4px;
}

.quick-create {
    padding: 18px 20px;
    margin-bottom: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.quick-create__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.quick-create__title {
    font-size: 12.5px;
    font-weight: 650;
}

.quick-create__form {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(160px, 0.7fr) auto;
    gap: 9px;
    align-items: center;
}

.quick-create__form .btn {
    height: 43px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(250, 248, 243, 0.78);
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
    text-align: right;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: rgba(250, 248, 243, 0.55);
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}

.table-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1px;
    white-space: nowrap;
}

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

.table-primary {
    display: block;
    max-width: 230px;
    color: var(--ink);
    font-weight: 600;
    line-height: 1.5;
}

.table-secondary {
    display: block;
    max-width: 260px;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-date {
    color: var(--muted);
    font-size: 10.5px;
    white-space: nowrap;
}

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 44px 22px;
    color: var(--muted);
    text-align: center;
}

.empty__icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink-soft);
}

.empty__title {
    color: var(--ink);
    font-size: 13px;
    font-weight: 650;
}

.empty__text {
    max-width: 42ch;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.9;
}

.empty .btn {
    margin-top: 14px;
}

.chart {
    padding: 4px 0 0;
}

.chart svg {
    width: 100%;
    height: auto;
    overflow: visible;
}

.chart__grid {
    stroke: var(--line);
    stroke-width: 1;
    stroke-dasharray: 2 5;
}

.chart__baseline {
    stroke: var(--line-strong);
    stroke-width: 1;
}

.chart__bar {
    fill: #64755d;
    opacity: 0.82;
    transition: fill 140ms ease, opacity 140ms ease;
}

.chart__bar:hover {
    fill: var(--ink);
    opacity: 1;
}

.chart__label {
    fill: var(--faint);
    font-family: var(--font);
    font-size: 9px;
}

.chart__empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding-top: 24px;
    color: var(--muted);
    font-size: 11px;
    pointer-events: none;
}

.chart-wrap {
    position: relative;
}

.chart-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 10.5px;
}

.chart-caption strong {
    color: var(--ink);
    font-weight: 700;
}

.breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.breakdown__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
}

.breakdown__label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breakdown__value {
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

.breakdown__track {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #efece4;
}

.breakdown__fill {
    height: 100%;
    border-radius: inherit;
    background: #75866d;
}

.breakdown__fill--clay { background: #b78772; }
.breakdown__fill--sky { background: #7e9aa5; }
.breakdown__fill--sand { background: #b79a63; }
.breakdown__fill--ink { background: #5f5b52; }

.breakdown__empty {
    padding: 10px 0;
    color: var(--faint);
    font-size: 11px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 10.5px;
}

.pagination__pages {
    display: flex;
    align-items: center;
    gap: 3px;
}

.page-link {
    display: grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.page-link:hover {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

.page-link.is-active {
    background: var(--ink);
    color: var(--white);
}

.copy-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 6px 7px 6px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
}

.copy-field code {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    text-align: left;
}

.copy-field .icon-btn {
    background: var(--card);
    border-color: var(--line);
}

.meta-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.meta-list > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line);
}

.meta-list > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.meta-list dt {
    color: var(--muted);
    font-size: 10.5px;
    white-space: nowrap;
}

.meta-list dd {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    font-size: 11.5px;
    text-overflow: ellipsis;
    text-align: left;
}

.progress {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #efebe2;
}

.progress__fill {
    height: 100%;
    border-radius: inherit;
    background: var(--sage-ink);
}

.code-block {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f4f1e9;
    color: var(--ink-soft);
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.9;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message-template {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 12.5px;
    line-height: 2;
}

.inline-details summary {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
    font-size: 10.5px;
    cursor: pointer;
    list-style: none;
}

.inline-details summary::-webkit-details-marker {
    display: none;
}

.inline-details[open] summary {
    color: var(--ink);
}

.inline-details__body {
    margin-top: 7px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 10.5px;
    line-height: 1.9;
    white-space: pre-wrap;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.filter-bar .input,
.filter-bar .select {
    min-height: 37px;
    font-size: 12px;
}

.filter-search {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.filter-search svg {
    position: absolute;
    top: 50%;
    inset-inline-start: 11px;
    color: var(--faint);
    transform: translateY(-50%);
    pointer-events: none;
}

.filter-search .input {
    padding-inline-start: 35px;
}

.filter-bar .select {
    width: auto;
    min-width: 138px;
}

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 9px;
}

.flag {
    font-size: 13px;
    line-height: 1;
}

.country-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--line-strong);
}

.reveal {
    animation: reveal-up 600ms var(--ease) both;
    animation-delay: calc(var(--index, 0) * 55ms);
}

@keyframes reveal-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .quick-create__form {
        grid-template-columns: 1fr;
    }

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

    .filter-bar {
        padding: 12px;
    }

    .filter-search {
        flex-basis: 100%;
    }

    .filter-bar .select {
        flex: 1;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .card__head {
        padding: 16px 16px 13px;
    }

    .card__body {
        padding: 16px;
    }
}
