:root {
    color-scheme: light;
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #667085;
    --line: #d9e0ea;
    --brand: #2f6fed;
    --brand-dark: #1d54ba;
    --ok: #0f8f5f;
    --warn: #b7791f;
    --bad: #c2413c;
}

* {
    box-sizing: border-box;
}

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

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
    background: #172033;
    color: #eef4ff;
    padding: 24px 18px;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 28px;
}

.nav {
    display: grid;
    gap: 8px;
}

.nav a,
.nav button {
    width: 100%;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #dbe7fb;
    cursor: pointer;
    display: block;
    font: inherit;
    padding: 10px 12px;
    text-align: left;
}

.nav a:hover,
.nav button:hover {
    background: rgba(255, 255, 255, 0.09);
    text-decoration: none;
}

.main {
    min-width: 0;
    padding: 28px;
}

.topbar {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 22px;
}

.topbar h1 {
    font-size: 28px;
    line-height: 1.2;
    margin: 0;
}

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

.panel h2 {
    font-size: 19px;
    margin: 0 0 14px;
}

.panel-heading {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.plan-heading {
    align-items: center;
}

.panel-heading h2 {
    margin-bottom: 4px;
}

.panel-heading p {
    margin: 0;
}

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

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

.stat {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.stat strong {
    display: block;
    font-size: 30px;
}

.stat span,
.muted {
    color: var(--muted);
}

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

.field {
    display: grid;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    color: #344054;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    padding: 10px 11px;
}

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

.btn-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 700;
    min-height: 40px;
    padding: 9px 14px;
    text-decoration: none;
}

.btn.primary {
    background: var(--brand);
    color: #fff;
}

.btn.primary:hover {
    background: var(--brand-dark);
    text-decoration: none;
}

.btn.secondary {
    background: #fff;
    border-color: #cfd8e3;
    color: var(--text);
}

.btn.warning {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.btn.danger {
    background: #fff1f1;
    border-color: #fecaca;
    color: #b42318;
}

.status-tabs {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
    overflow-x: auto;
    padding: 0 0 12px;
    scrollbar-width: thin;
}

.status-tab {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #d9e0ea;
    border-radius: 999px;
    color: #344054;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
    min-height: 36px;
    padding: 7px 11px;
    text-decoration: none;
}

.status-tab:hover,
.status-tab.active {
    background: #eef4ff;
    border-color: #b7ccfb;
    color: var(--brand);
    text-decoration: none;
}

.status-tab strong {
    background: rgba(47, 111, 237, 0.12);
    border-radius: 999px;
    color: inherit;
    font-size: 12px;
    line-height: 1;
    min-width: 22px;
    padding: 5px 7px;
    text-align: center;
}

.filter-bar {
    align-items: end;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(220px, 1.4fr) minmax(135px, 0.65fr) minmax(135px, 0.65fr) minmax(180px, 0.75fr) auto;
    margin-bottom: 16px;
    padding: 14px;
}

.filter-actions {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.icon-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    justify-content: flex-end;
    min-width: 128px;
}

.icon-form {
    display: inline-flex;
    margin: 0;
}

.icon-btn {
    align-items: center;
    appearance: none;
    background: #ffffff;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    color: #344054;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 34px;
    justify-content: center;
    min-height: 34px;
    padding: 0;
    position: relative;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
    width: 34px;
}

.icon-btn:hover,
.icon-btn:focus-visible {
    background: #f8fafc;
    border-color: #b8c3d3;
    box-shadow: 0 6px 16px rgba(23, 32, 51, 0.12);
    outline: 0;
    text-decoration: none;
    transform: translateY(-1px);
}

.icon-btn svg {
    fill: none;
    height: 17px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 17px;
}

.icon-btn.primary {
    background: #eef4ff;
    border-color: #b7ccfb;
    color: var(--brand);
}

.icon-btn.warning {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.icon-btn.danger {
    background: #fff1f1;
    border-color: #fecaca;
    color: #b42318;
}

.icon-btn[data-tooltip]::after {
    background: #172033;
    border-radius: 6px;
    bottom: calc(100% + 8px);
    box-shadow: 0 8px 20px rgba(23, 32, 51, 0.18);
    color: #ffffff;
    content: attr(data-tooltip);
    font-size: 12px;
    font-weight: 700;
    left: 50%;
    line-height: 1.2;
    opacity: 0;
    padding: 7px 9px;
    pointer-events: none;
    position: absolute;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    white-space: nowrap;
    z-index: 30;
}

.icon-btn[data-tooltip]::before {
    border: 5px solid transparent;
    border-top-color: #172033;
    bottom: calc(100% - 1px);
    content: "";
    left: 50%;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 31;
}

.icon-btn[data-tooltip]:hover::after,
.icon-btn[data-tooltip]:hover::before,
.icon-btn[data-tooltip]:focus-visible::after,
.icon-btn[data-tooltip]:focus-visible::before {
    opacity: 1;
    transform: translate(-50%, 0);
}

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

.plan-table-wrap {
    overflow-x: visible;
}

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

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

th {
    color: #475467;
    font-size: 13px;
    text-transform: uppercase;
}

.data-table {
    min-width: 920px;
}

.data-table td {
    color: #344054;
}

.data-table .title-cell {
    color: var(--text);
    display: block;
    font-weight: 700;
    margin-bottom: 4px;
}

.data-table .excerpt-cell {
    color: var(--muted);
    display: block;
    max-width: 520px;
}

.data-table .actions-cell {
    text-align: right;
    white-space: nowrap;
    width: 150px;
}

.catalog-table .actions-cell {
    width: 92px;
}

.catalog-table .icon-actions {
    min-width: 76px;
}

.plan-table {
    min-width: 0;
    table-layout: fixed;
}

.plan-table .col-photo {
    width: 76px;
}

.plan-table .col-title {
    width: 30%;
}

.plan-table .col-product {
    width: 24%;
}

.plan-table .col-date {
    width: 160px;
}

.plan-table .col-status {
    width: 142px;
}

.plan-table .col-actions {
    width: 118px;
}

.plan-table th,
.plan-table td {
    padding: 10px 8px;
}

.plan-table .photo-cell {
    width: 76px;
}

.plan-table .title-column,
.plan-table .product-column {
    overflow-wrap: anywhere;
    word-break: normal;
}

.plan-table .title-cell {
    line-height: 1.35;
}

.empty-thumb {
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #cfd8e3;
    border-radius: 6px;
    display: flex;
    height: 56px;
    justify-content: center;
    width: 56px;
}

.empty-thumb::before {
    color: #98a2b3;
    content: "—";
    font-weight: 700;
}

.data-table a.title-cell {
    color: var(--brand);
}

.table-nowrap {
    white-space: nowrap;
}

.pagination-bar {
    align-items: center;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 14px;
}

.pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pagination a {
    align-items: center;
    background: #ffffff;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    color: #344054;
    display: inline-flex;
    font-weight: 700;
    min-height: 34px;
    min-width: 34px;
    justify-content: center;
    padding: 7px 10px;
}

.pagination a:hover,
.pagination a.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #ffffff;
    text-decoration: none;
}

.badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 9px;
}

.badge.ok {
    background: #e8f7ef;
    color: var(--ok);
}

.badge.warn {
    background: #fff7df;
    color: var(--warn);
}

.badge.bad {
    background: #fff0ef;
    color: var(--bad);
}

.thumb {
    border: 1px solid var(--line);
    border-radius: 6px;
    display: block;
    height: 56px;
    object-fit: cover;
    width: 56px;
}

.notice {
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.notice.ok {
    background: #e8f7ef;
    color: #075e42;
}

.notice.warn {
    background: #fff7df;
    color: #8a5b12;
}

.notice.bad {
    background: #fff0ef;
    color: #9f1d18;
}

.auth-page,
.install-page {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 28px;
}

.auth-box,
.install-box {
    max-width: 980px;
    width: 100%;
}

.install-box {
    max-width: 1120px;
}

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

    .sidebar {
        padding: 16px;
    }

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

    .main {
        padding: 18px;
    }

    .grid.stats,
    .form-grid,
    .filter-bar {
        grid-template-columns: 1fr;
    }

    .panel-heading,
    .pagination-bar {
        align-items: stretch;
        flex-direction: column;
    }

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

    .plan-table {
        min-width: 860px;
    }
}
