:root {
    color-scheme: light;
    font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f5f7fa;
    color: #1d2733;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.page {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 56px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.nav-spacer { flex: 1; }
.current-user { color: #526173; font-size: 14px; font-weight: 700; }
.nav form { margin: 0; }
button.nav-button { min-height: 36px; padding: 0 12px; background: #e8edf2; color: #263442; }
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eef2f6; }
.auth-panel { width: min(420px, 100%); padding: 32px; border: 1px solid #d9e0e8; border-radius: 8px; background: white; }
.auth-panel > p { margin-top: 8px; color: #627084; }
.auth-panel .notice { margin-top: 20px; }
.auth-form { display: grid; gap: 16px; margin-top: 24px; }
.auth-form button { width: 100%; margin-top: 4px; }
.auth-link { text-align: center; font-size: 14px; }
.invite-form {
    display: grid;
    grid-template-columns: minmax(280px, 520px) auto;
    gap: 14px;
    align-items: end;
    margin-top: 24px;
}
.invitations-table { min-width: 980px; }
.invitations-table code {
    color: #1d2733;
    font-size: 14px;
    font-weight: 700;
}

.nav a {
    min-height: 36px;
    padding: 8px 12px;
    border-radius: 6px;
    color: #526173;
    font-weight: 700;
}

.nav a.active,
.nav a:hover {
    background: #e8f0ef;
    color: #176b5f;
    text-decoration: none;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #d9e0e8;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 28px;
    font-weight: 700;
}

.toolbar p {
    margin-top: 8px;
    color: #627084;
}

button {
    min-height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    background: #176b5f;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

button:hover {
    background: #11554b;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 6px;
    background: #176b5f;
    color: white;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.button-link:hover {
    background: #11554b;
    color: white;
    text-decoration: none;
}

button.secondary {
    background: #e8edf2;
    color: #263442;
}

button.secondary:hover {
    background: #d9e1e9;
}

button.danger {
    background: #b44734;
}

button.danger:hover {
    background: #963827;
}

.notice,
.empty {
    margin-top: 24px;
    padding: 18px;
    border: 1px solid #cfe0dc;
    border-radius: 8px;
    background: #eef8f5;
}

.notice.error {
    border-color: #e6beb6;
    background: #fff0ed;
    color: #963827;
}

.empty h2 {
    margin-bottom: 8px;
    font-size: 20px;
}

.empty p {
    color: #627084;
}

.search-bar,
.add-form,
.batch-form,
.settings-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 180px auto;
    gap: 14px;
    align-items: end;
    margin-top: 24px;
    padding: 18px;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    background: white;
}

.add-form {
    grid-template-columns: minmax(320px, 1fr) 180px auto;
}

.batch-form {
    grid-template-columns: minmax(320px, 1fr) 180px auto;
    align-items: start;
}

.settings-form {
    grid-template-columns: 150px 170px 150px 150px 120px minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.settings-form > * {
    min-width: 0;
}

.setting-note {
    display: grid;
    grid-column: auto;
    gap: 3px;
    color: #627084;
    font-size: 13px;
}

.setting-note span {
    overflow-wrap: anywhere;
}

.setting-note strong {
    color: #1d2733;
    font-size: 15px;
}

.settings-form button {
    justify-self: end;
    min-width: 108px;
}


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

.metric {
    display: grid;
    gap: 8px;
    min-height: 120px;
    padding: 18px;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    background: white;
}

.metric span {
    color: #526173;
    font-size: 13px;
    font-weight: 700;
}

.metric strong {
    color: #1d2733;
    font-size: 30px;
    line-height: 1;
}

.metric small {
    color: #7b8898;
    font-size: 13px;
}

.section-head {
    margin-top: 28px;
}

.section-head h2 {
    font-size: 20px;
}

.logs-table {
    min-width: 1080px;
}

label {
    display: grid;
    gap: 7px;
    color: #526173;
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid #cbd5df;
    border-radius: 6px;
    background: white;
    color: #1d2733;
    font: inherit;
}

textarea {
    min-height: 140px;
    padding: 10px;
    resize: vertical;
}

.table-wrap {
    overflow-x: auto;
    margin-top: 24px;
    border: 1px solid #d9e0e8;
    border-radius: 8px;
    background: white;
}

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

.targets-table {
    min-width: 1180px;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid #edf1f5;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
    color: #526173;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

td {
    font-size: 14px;
    line-height: 1.45;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #526173;
    font-weight: 700;
    white-space: nowrap;
}

.sort-link.active,
.sort-link:hover {
    color: #176b5f;
}

.sort-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #e8edf2;
    color: #526173;
    font-size: 12px;
    line-height: 1;
}

.sort-link.active .sort-indicator {
    background: #e8f0ef;
    color: #176b5f;
}

tr:last-child td {
    border-bottom: 0;
}

.muted-row {
    background: #fafafa;
    color: #7b8898;
}

.price {
    color: #b0452c;
    font-weight: 700;
    white-space: nowrap;
}

.stock,
.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.in-stock,
.status.success {
    background: #e8f6ee;
    color: #21734c;
}

.out-stock,
.status.failed {
    background: #f8ecea;
    color: #a83d2d;
}

.unavailable {
    background: #edf1f5;
    color: #627084;
}

.status.never_run,
.status.running {
    background: #eef3fb;
    color: #335c9f;
}

a {
    color: #176b5f;
    font-weight: 600;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

time,
.subtle {
    color: #7b8898;
    font-size: 13px;
}

.subtle {
    margin-top: 6px;
    max-width: 520px;
    overflow-wrap: anywhere;
}

.inline-form {
    display: grid;
    grid-template-columns: 88px auto auto;
    gap: 8px;
    align-items: center;
}

.inline-form input[type="number"] {
    min-height: 36px;
}

.check {
    display: inline-flex;
    grid-template-columns: none;
    align-items: center;
    gap: 6px;
    color: #526173;
    white-space: nowrap;
}

.check input {
    width: 16px;
    min-height: 16px;
}

.settings-check {
    align-self: center;
}

.actions {
    display: flex;
    gap: 8px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
    color: #526173;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #cbd5df;
    border-radius: 6px;
    background: white;
}

.pagination a.disabled {
    pointer-events: none;
    color: #9aa6b2;
    background: #f3f6f8;
}

@media (max-width: 1240px) {
    .settings-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .setting-note {
        grid-column: span 2;
    }
}
@media (max-width: 760px) {
    .toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .search-bar,
    .add-form,
    .batch-form,
    .settings-form,
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    button {
        width: 100%;
    }

    .setting-note,
    .settings-form button {
        grid-column: auto;
        justify-self: stretch;
    }
}
