* {
    box-sizing: border-box
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #eef6ff 100%);
    color: #111827;
    line-height: 1.5
}

a {
    color: #b91c1c;
    text-decoration: none
}

a:hover {
    text-decoration: underline
}

.admin-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh
}

.side {
    background: #0f172a;
    color: #fff;
    padding: 18px
}

.side strong {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 14px
}

.side a {
    display: block;
    color: #fff;
    padding: 9px 10px;
    border-radius: 6px;
    margin-bottom: 5px
}

.side a:hover, .side a.active {
    background: #1e293b;
    text-decoration: none
}

.admin-main {
    padding: 18px
}

.topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px
}

.admin-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 14px;
    padding: 10px;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: #eff6ff
}

.admin-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 7px 11px;
    border-radius: 6px;
    background: #fff;
    color: #0f172a;
    font-weight: 900;
    border: 1px solid #dbeafe
}

.admin-tabs a.active {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8
}

.panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .05)
}

.admin-main>.panel:nth-of-type(4n+1) {
    background: #ffffff;
    border-color: #dbeafe
}

.admin-main>.panel:nth-of-type(4n+2) {
    background: #f0fdf4;
    border-color: #bbf7d0
}

.admin-main>.panel:nth-of-type(4n+3) {
    background: #fff7ed;
    border-color: #fed7aa
}

.admin-main>.panel:nth-of-type(4n) {
    background: #f5f3ff;
    border-color: #ddd6fe
}

.panel h1, .panel h2 {
    margin: 0 0 12px;
    color: #0f172a
}

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

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr))
}

label {
    font-weight: 800;
    font-size: .9rem
}

input, select, textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px;
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, .03)
}

.result-input-box {
    display: grid;
    gap: 7px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    font-size: .95rem
}

.result-input-box input {
    min-height: 48px;
    font-size: 1.35rem;
    font-weight: 900;
    text-align: center;
    letter-spacing: 0
}

.result-input-box.old-box {
    border-color: #f59e0b;
    background: #fff6d1;
    color: #92400e
}

.result-input-box.new-box {
    border-color: #22c55e;
    background: #c6ffd7;
    color: #166534
}

textarea {
    min-height: 130px
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 0;
    border-radius: 6px;
    padding: 8px 12px;
    background: #111827;
    color: #fff;
    font-weight: 900;
    cursor: pointer
}

.btn.warn {
    background: #b91c1c
}

.btn.alt {
    background: #00ff0d;
    color: #111827
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 8px;
    background: #fff
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff
}

th, td {
    padding: 9px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

tr.nearest-admin-result td {
    background: #fff1f2
}

tr.nearest-admin-result td:first-child {
    box-shadow: inset 4px 0 0 #dc2626
}

tr.nearest-admin-result .admin-time-cell {
    color: #dc2626;
    font-weight: 900
}

.admin-result-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px
}

.admin-result-card {
    position: relative;
    overflow: hidden;
    display: grid;
    gap: 12px;
    min-height: 170px;
    padding: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .08)
}

.admin-result-card:before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: #0f172a
}

.admin-result-game {
    display: block;
    margin-top: 4px;
    padding: 10px 11px;
    border-radius: 7px;
    background: #0f172a;
    color: #fff;
    font-size: 1.08rem;
    line-height: 1.15
}

.admin-result-time {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    background: #fff;
    border: 1px solid #e2e8f0
}

.admin-result-time span,
.admin-result-values small {
    color: #64748b;
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase
}

.admin-result-time b {
    color: #0f172a;
    font-size: 1.15rem
}

.admin-result-values {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 7px;
    background: rgb(255, 255, 203);
    border: 1px solid #e2e8f0
}

.admin-result-values span {
    display: grid;
    gap: 4px;
    text-align: center
}

.admin-result-values b {
    font-size: 1.4rem;
    line-height: 1
}

.admin-result-values em {
    color: #64748b;
    font-style: normal;
    font-weight: 900
}

.admin-result-actions {
    align-self: end
}

.admin-result-card.nearest-admin-result {
    border-color: #dc2626;
    background: linear-gradient(180deg, #fff7ed 0%, #fff1f2 100%)
}

.admin-result-card.nearest-admin-result:before,
.admin-result-card.nearest-admin-result .admin-result-game {
    background: #dc2626
}

.admin-result-card.nearest-admin-result .admin-result-values span:last-child b {
    display: inline-flex;
    justify-content: center;
    min-width: 42px;
    padding: 5px 8px;
    border-radius: 6px;
    background: #dc2626;
    color: #fff
}

th {
    background: #111827;
    color: #fff
}

tbody tr:nth-child(even) td {
    background: rgba(248, 250, 252, .86)
}

.msg {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #f0fdf4;
    border-left: 4px solid #16a34a
}

.error {
    background: #fef2f2;
    border-left-color: #dc2626
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.admin-link-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.admin-site-links .btn {
    background: #0f766e;
    color: #fff
}

.admin-site-links .btn:hover {
    background: #115e59;
    text-decoration: none
}

.forum-status {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: .78rem;
    font-weight: 900;
    text-transform: capitalize
}

.forum-status.pending,
.forum-status.open {
    background: #fef3c7;
    color: #92400e
}

.forum-status.hidden,
.forum-status.deleted,
.forum-status.blocked {
    background: #fee2e2;
    color: #991b1b
}

.forum-status.resolved {
    background: #dbeafe;
    color: #1d4ed8
}

.backup-warning {
    background: #fff7ed !important;
    border-color: #f97316 !important
}

.backup-table-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    margin: 12px 0
}

.backup-select-tools {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px
}

.backup-select-tools .btn {
    min-height: 34px;
    padding: 7px 12px
}

.backup-table-picker label {
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    padding: 8px;
    font-weight: 700
}

.backup-actions form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap
}

.backup-actions input {
    width: 110px;
    min-height: 38px;
    padding: 8px
}

.backup-actions .btn {
    min-width: 86px
}

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

.login .panel {
    width: min(420px, 100%)
}

.small {
    font-size: .85rem;
    color: #64748b
}

.quick-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 14px
}

.quick-tabs a {
    background: #e2e8f0;
    color: #0f172a;
    border-radius: 6px;
    padding: 8px 10px;
    font-weight: 900
}

.chart-editor {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin-top: 14px;
    background: #fff;
    padding: 14px;
    max-width: 560px
}

.chart-editor table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0
}

.chart-editor th, .chart-editor td {
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    text-align: center
}

.chart-editor tbody th {
    background: #f1f5f9;
    color: #111827;
    width: 120px;
    padding: 8px
}

.chart-editor input {
    height: 42px;
    width: 100%;
    max-width: 180px;
    padding: 6px;
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    text-transform: uppercase;
    border-radius: 5px
}

.chart-editor input:focus {
    outline: 2px solid #f59e0b;
    border-color: #f59e0b
}

.chart-editor .today-mark {
    background: #b91c1c !important;
    color: #fff !important
}

.chart-editor .today-row td {
    background: #fff1f2;
    padding: 3px;
}

.chart-editor .today-col {
    background: #d8b2b2
}

.chart-editor .today-cell {
    background: #b91c1c !important
}

.chart-editor .today-cell input {
    background: #fff;
    color: #b91c1c;
    border-color: #b91c1c
}

.chart-preview-block {
    margin-top: 18px
}

.chart-preview table {
    min-width: 760px
}

.chart-preview th, .chart-preview td {
    text-align: center;
    font-weight: 800
}

.chart-preview thead th {
    background: #0f172a;
    color: #fff
}

.chart-preview tbody th {
    background: #f8fafc
}

.chart-preview .day-link {
    display: inline-flex;
    width: 34px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #e2e8f0;
    color: #0f172a;
    font-weight: 900
}

.chart-preview .selected-day th,
.chart-preview .selected-day td {
    background: #fef3c7
}

.chart-preview .today-mark,
.chart-preview .today-cell {
    background: #b91c1c !important;
    color: #fff !important
}

.chart-preview .today-col {
    background: #fee2e2
}

@media (max-width:800px) {
    .admin-shell {
        grid-template-columns: 1fr
    }

    .side {
        position: static
    }

    .side nav {
        display: flex;
        gap: 6px;
        flex-wrap: wrap
    }

    .side a {
        margin: 0
    }

    .admin-main {
        padding: 12px
    }

    .chart-editor input {
        max-width: none
    }
}
