:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #687386;
    --line: #dce2ea;
    --line-soft: #edf1f5;
    --accent: #0f766e;
    --accent-strong: #0b5f59;
    --accent-soft: #e5f4f2;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --sidebar: #101820;
    --sidebar-soft: #18232e;
    --shadow: 0 16px 40px rgba(23, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns 180ms ease;
}

.sidebar {
    background: var(--sidebar);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 18px;
    position: sticky;
    top: 0;
}

.sidebar-top {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.brand {
    align-items: center;
    display: flex;
    gap: 11px;
    min-width: 0;
}

.brand-mark,
.avatar,
.nav-icon {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
}

.brand-mark {
    background: #f5c542;
    border-radius: 8px;
    color: #101820;
    font-size: 13px;
    font-weight: 800;
    height: 38px;
    width: 38px;
}

.brand-text {
    font-size: 20px;
    font-weight: 800;
    white-space: nowrap;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    height: 38px;
    padding: 0;
    width: 38px;
}

.user-card {
    align-items: center;
    background: var(--sidebar-soft);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px;
}

.avatar {
    background: var(--accent);
    border-radius: 50%;
    color: #ffffff;
    font-weight: 800;
    height: 38px;
    width: 38px;
}

.user-meta {
    min-width: 0;
}

.user-meta strong,
.user-meta span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-meta strong {
    font-size: 14px;
}

.user-meta span {
    color: #a7b2c0;
    font-size: 12px;
    margin-top: 3px;
}

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

.nav a,
.ghost-button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #d7dee8;
    cursor: pointer;
    display: flex;
    font: inherit;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    text-align: left;
    transition: background 140ms ease, color 140ms ease;
    width: 100%;
}

.nav a:hover,
.ghost-button:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}

.nav a.active {
    box-shadow: inset 3px 0 0 #f5c542;
}

.nav-icon {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 800;
    height: 28px;
    width: 28px;
}

.nav-label {
    white-space: nowrap;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 18px;
}

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

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

.page-header span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.page-header h1 {
    font-size: 30px;
    line-height: 1.1;
    margin: 0;
}

.panel,
.stat {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 20px;
}

.panel {
    margin-bottom: 20px;
}

.panel h2 {
    font-size: 18px;
    margin: 0 0 16px;
}

.panel p {
    color: var(--muted);
    line-height: 1.55;
}

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

.stat strong {
    display: block;
    font-size: 38px;
    line-height: 1;
}

.stat span {
    color: var(--muted);
    display: block;
    margin-top: 8px;
}

.form,
.grid-form {
    display: grid;
    gap: 12px;
}

.wide {
    max-width: 760px;
}

.grid-form {
    align-items: center;
    grid-template-columns: 1.1fr 1.4fr 120px 120px 110px;
}

.screen-form {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: 1.1fr 1.2fr 130px 150px 130px 110px 110px;
}

label {
    color: var(--ink);
    font-weight: 700;
}

input,
select,
textarea {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    font: inherit;
    padding: 11px 12px;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

button,
.button {
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    display: inline-block;
    font: inherit;
    font-weight: 800;
    padding: 10px 14px;
}

button:hover,
.button:hover {
    background: var(--accent-strong);
}

.small {
    padding: 7px 10px;
}

.danger {
    background: var(--danger);
}

.danger:hover {
    background: #8f1d14;
}

.alert {
    background: var(--danger-soft);
    border: 1px solid #fecdca;
    border-radius: 8px;
    color: var(--danger);
    margin-bottom: 10px;
    padding: 10px 12px;
}

.notice {
    border-radius: 8px;
    font-weight: 800;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.notice.success {
    background: var(--accent-soft);
    border: 1px solid #b7e3dd;
    color: var(--accent-strong);
}

.notice.error {
    background: var(--danger-soft);
    border: 1px solid #fecdca;
    color: var(--danger);
}

.import-panel {
    align-items: center;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.85fr);
}

.import-panel p {
    margin-bottom: 0;
}

.import-actions {
    display: grid;
    gap: 12px;
}

.import-actions form {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
}

.table-wrap {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    overflow-x: auto;
}

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

th,
td {
    border-bottom: 1px solid var(--line-soft);
    padding: 13px 14px;
    text-align: left;
    vertical-align: middle;
}

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

tbody tr:hover {
    background: #fbfcfd;
}

th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

.check {
    align-items: center;
    display: flex;
    gap: 8px;
    font-weight: 700;
}

.check input {
    width: auto;
}

.toolbar {
    align-items: center;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.url-field {
    font-size: 13px;
    min-width: 420px;
}

.display-link-row {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 12px;
    padding: 12px;
}

.display-link-row span {
    color: var(--muted);
    font-weight: 800;
}

.copy-source {
    border: 0;
    height: 1px;
    opacity: 0;
    padding: 0;
    pointer-events: none;
    position: absolute;
    width: 1px;
}

.copy-status {
    color: var(--accent);
    font-weight: 800;
}

.screen-list {
    display: grid;
    gap: 16px;
}

.screen-card {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 16px;
}

.screen-card-header,
.screen-actions {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.screen-card-header {
    margin-bottom: 14px;
}

.screen-card-header strong,
.screen-card-header span {
    display: block;
}

.screen-card-header span {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.screen-card-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 12px;
}

.technical-note {
    color: var(--muted);
    font-size: 13px;
    margin: 8px 0 0;
}

.screen-actions {
    justify-content: flex-end;
    margin-top: 12px;
}

.secondary {
    background: #475467;
}

.secondary:hover {
    background: #344054;
}

.template-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 18px;
}

.template-card {
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    overflow: hidden;
}

.template-thumb {
    align-items: center;
    background: #f5c542;
    color: #101820;
    display: flex;
    font-size: 20px;
    font-weight: 800;
    height: 150px;
    justify-content: center;
    padding: 18px;
    text-align: center;
}

.template-thumb-modern_grid {
    background: #0f766e;
    color: #ffffff;
}

.template-thumb-category_bands {
    background: #243447;
    color: #ffffff;
}

.template-thumb-promo_split {
    background: #7c2d12;
    color: #ffffff;
}

.template-thumb-compact_price_list {
    background: #f2f4f7;
    color: #172033;
}

.template-thumb-cafe_espresso {
    background: #111111;
    color: #e91e63;
}

.template-thumb-clean_split {
    background: #ffffff;
    color: #51426a;
}

.template-thumb-hot_grill {
    background: #111111;
    color: #facc15;
}

.template-body {
    padding: 16px;
}

.template-body strong {
    display: block;
    font-size: 17px;
}

.template-body p {
    min-height: 48px;
}

.guest-body {
    align-items: center;
    background: radial-gradient(circle at top, #203140 0, #101820 42%, #0d1217 100%);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.login-panel {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 28px;
    width: min(420px, 92vw);
}

.login-panel h1 {
    margin: 0 0 8px;
}

.login-panel p {
    color: var(--muted);
    margin: 0 0 18px;
}

.sidebar-collapsed .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
}

.sidebar-collapsed .sidebar {
    padding: 18px 12px;
}

.sidebar-collapsed .brand-text,
.sidebar-collapsed .user-meta,
.sidebar-collapsed .nav-label {
    display: none;
}

.sidebar-collapsed .sidebar-top {
    justify-content: center;
}

.sidebar-collapsed .brand {
    display: none;
}

.sidebar-collapsed .user-card,
.sidebar-collapsed .nav a,
.sidebar-collapsed .ghost-button {
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
}

.sidebar-collapsed .nav a.active {
    box-shadow: inset 0 -3px 0 #f5c542;
}

@media (max-width: 860px) {
    .app-shell,
    .stats-grid,
    .grid-form,
    .screen-form,
    .screen-card-grid,
    .template-grid,
    .import-panel,
    .import-actions form {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: auto;
        position: static;
    }

    .sidebar-collapsed .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar-collapsed .brand {
        display: flex;
    }

    .sidebar-collapsed .brand-text,
    .sidebar-collapsed .user-meta,
    .sidebar-collapsed .nav-label {
        display: inline;
    }

    .sidebar-collapsed .nav a,
    .sidebar-collapsed .ghost-button {
        justify-content: flex-start;
    }

    .main {
        padding: 20px;
    }
}
