* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #65737e;
    --border: #d9e0e7;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #b42318;
    --success-bg: #ecfdf3;
    --success-text: #027a48;
    --error-bg: #fef3f2;
    --error-text: #b42318;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

.topbar {
    background: #17202a;
    color: white;
    padding: 24px;
}

.topbar h1,
.topbar p {
    margin: 0;
}

.topbar p {
    margin-top: 4px;
    opacity: .8;
}

.container {
    width: min(1400px, calc(100% - 32px));
    margin: 24px auto 48px;
}

.grid {
    display: grid;
    gap: 20px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.compact {
    gap: 12px;
}

.card {
    margin-bottom: 20px;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, .05);
}

.card h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

label {
    display: block;
    margin-bottom: 14px;
    font-weight: 700;
}

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

input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
select,
textarea {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
}

textarea {
    resize: vertical;
}

button,
.button {
    display: inline-block;
    padding: 10px 14px;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    text-decoration: none;
}

button:hover,
.button:hover {
    background: var(--primary-dark);
}

.button.secondary {
    background: #e9eef3;
    color: var(--text);
}

.actions,
.filters,
.inline-form,
.section-head,
.row-actions,
.tag {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inline-form input {
    margin: 0;
}

.filters {
    flex-wrap: wrap;
}

.filters input {
    min-width: 240px;
}

.filters input,
.filters select {
    width: auto;
    margin: 0;
}

.section-head {
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.section-head h2,
.section-head p {
    margin: 0;
}

.section-head p,
.hint,
small {
    color: var(--muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.stats div {
    padding: 18px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.stats strong,
.stats span {
    display: block;
}

.stats strong {
    font-size: 28px;
}

.tags,
.checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 7px 10px;
    background: #eef3f8;
    border-radius: 999px;
}

.tag form,
.row-actions form {
    margin: 0;
}

fieldset {
    margin: 0 0 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.check {
    margin: 0;
    font-weight: 400;
}

.check input {
    width: auto;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    white-space: nowrap;
}

.row-actions {
    align-items: flex-start;
    flex-direction: column;
}

.row-actions a,
.link-danger {
    border: 0;
    padding: 0;
    background: none;
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

.link-danger {
    color: var(--danger);
}

.link-danger:hover {
    background: none;
    text-decoration: underline;
}

.flash {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 8px;
}

.flash.success {
    background: var(--success-bg);
    color: var(--success-text);
}

.flash.error {
    background: var(--error-bg);
    color: var(--error-text);
}

@media (max-width: 900px) {
    .grid.two,
    .stats {
        grid-template-columns: 1fr;
    }

    .section-head {
        display: block;
    }

    .filters {
        margin-top: 14px;
    }
}


.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logout-link {
    color: white;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, .45);
    padding: 9px 12px;
    border-radius: 8px;
}

.logout-link:hover {
    background: rgba(255, 255, 255, .1);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-box {
    width: min(420px, 100%);
    padding: 28px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
}

.login-box h1 {
    margin-top: 0;
}

.login-box button {
    width: 100%;
}
