:root {
    --bg: #f4f6fa;
    --card: #ffffff;
    --ink: #14161a;
    --muted: #6b7280;
    --line: #e3e7ee;
    --brand: #1f4ed8;
    --brand-dark: #1a3fae;
    --danger: #c62828;
    --ok: #1b7f4b;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    background: #101828;
    color: #fff;
    padding: 0 20px;
}

.topbar__inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 22px;
    height: 56px;
}

.topbar__brand {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.04em;
    color: #fff;
}

.topbar__brand:hover {
    text-decoration: none;
}

.topbar nav {
    display: flex;
    gap: 18px;
    margin-left: auto;
}

.topbar nav a {
    color: #cbd5e1;
    font-weight: 500;
}

.topbar nav a.is-active,
.topbar nav a:hover {
    color: #fff;
    text-decoration: none;
}

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 18px;
}

.page-head h1 {
    margin: 0;
    font-size: 22px;
}

.page-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.page-head__actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}

.card + .card {
    margin-top: 16px;
}

.card__title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}

.btn:hover {
    background: #f1f3f8;
    text-decoration: none;
}

.btn--primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn--primary:hover {
    background: var(--brand-dark);
}

.btn--danger {
    background: #fff;
    border-color: #f0c4c4;
    color: var(--danger);
}

.btn--danger:hover {
    background: #fdecec;
}

.btn--sm {
    padding: 5px 10px;
    font-size: 12px;
}

.alert {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert--ok {
    background: #e9f7ef;
    border-color: #bfe6cf;
    color: #15603a;
}

.alert--error {
    background: #fdecec;
    border-color: #f5c6c6;
    color: #922;
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 20px;
    max-height: 190px;
    overflow: auto;
}

.grid {
    display: grid;
    gap: 14px;
}

.grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

label.field {
    display: block;
}

.field__label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 5px;
    color: #374151;
}

.field__hint {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
}

input[type="text"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    border: 1px solid #cfd6e2;
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 13px;
    background: #fff;
    color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(31, 78, 216, 0.25);
    border-color: var(--brand);
}

textarea {
    min-height: 70px;
    resize: vertical;
}

.field__error {
    display: block;
    color: var(--danger);
    font-size: 11px;
    margin-top: 4px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 14px;
}

.toolbar input[type="text"] {
    max-width: 320px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    background: #f8fafc;
}

tbody tr:hover {
    background: #f8fafc;
}

.mono {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12.5px;
}

.pill {
    display: inline-block;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 11px;
    font-weight: 700;
}

.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.empty {
    text-align: center;
    padding: 40px 10px;
    color: var(--muted);
}

.pagination {
    margin-top: 14px;
}

.pagination svg {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
}

.pagination nav > div:first-child {
    display: none;
}

.pagination span[aria-current="page"] span,
.pagination a {
    display: inline-block;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-right: 4px;
    background: #fff;
}

.pagination span[aria-current="page"] span {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.preview-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: flex-start;
}

.preview-frame {
    background: repeating-conic-gradient(#eef1f6 0% 25%, #ffffff 0% 50%) 50% / 12px 12px;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
}

.helptext {
    color: var(--muted);
    font-size: 12.5px;
}

.helptext code {
    background: #eef1f6;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
}

td.num,
th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

td.truncate {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12.5px;
}
