:root {
    --admin-bg: #f5f6f8;
    --admin-surface: #ffffff;
    --admin-sidebar: #17191f;
    --admin-sidebar-soft: #22252e;
    --admin-text: #20232d;
    --admin-muted: #7b8190;
    --admin-border: #e7e9ef;
    --admin-primary: #3e79f7;
    --admin-primary-dark: #2f65dd;
    --admin-success: #168a5b;
    --admin-success-bg: #e8f7f0;
    --admin-danger: #d14343;
    --admin-danger-bg: #fff0f0;
    --admin-warning: #9a6700;
    --admin-warning-bg: #fff7dc;
    --admin-shadow: 0 1px 2px rgba(23, 25, 31, .04),
        0 8px 24px rgba(23, 25, 31, .04);
    --admin-sidebar-width: 264px;
    --admin-topbar-height: 72px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body.admin-shell {
    background: var(--admin-bg);
    color: var(--admin-text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    min-height: 100vh;
}

.admin-shell button,
.admin-shell input,
.admin-shell select,
.admin-shell textarea {
    font-family: inherit;
}

.admin-shell a {
    color: var(--admin-primary);
    text-decoration: none;
}

.admin-shell a:hover {
    color: var(--admin-primary-dark);
    text-decoration: none;
}

.admin-layout {
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--admin-sidebar);
    bottom: 0;
    color: #c8ccd6;
    display: flex;
    flex-direction: column;
    left: 0;
    position: fixed;
    top: 0;
    width: var(--admin-sidebar-width);
    z-index: 900;
}

.admin-brand {
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    color: #fff !important;
    display: flex;
    flex: 0 0 var(--admin-topbar-height);
    gap: 12px;
    padding: 0 22px;
}

.admin-brand-mark {
    align-items: center;
    background: var(--admin-primary);
    border-radius: 7px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 38px;
    font-size: 13px;
    font-weight: 800;
    height: 38px;
    justify-content: center;
}

.admin-brand-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-brand-copy strong {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.admin-brand-copy small {
    color: #888e9d;
    font-size: 11px;
    margin-top: 2px;
}

.admin-sidebar-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 14px 24px;
    scrollbar-color: #343844 transparent;
    scrollbar-width: thin;
}

.admin-sidebar-scroll::-webkit-scrollbar {
    width: 5px;
}

.admin-sidebar-scroll::-webkit-scrollbar-thumb {
    background: #353944;
    border-radius: 5px;
}

.admin-nav-group + .admin-nav-group {
    margin-top: 22px;
}

.admin-nav-label {
    color: #6f7583;
    font-size: 10px;
    font-weight: 700;
    padding: 0 12px 8px;
    text-transform: uppercase;
}

.admin-nav-link {
    align-items: center;
    border-radius: 6px;
    color: #aeb3bf !important;
    display: flex;
    font-size: 13px;
    font-weight: 500;
    min-height: 40px;
    padding: 9px 12px;
    position: relative;
}

.admin-nav-link + .admin-nav-link {
    margin-top: 3px;
}

.admin-nav-link::before {
    background: #555c6b;
    border-radius: 50%;
    content: "";
    flex: 0 0 6px;
    height: 6px;
    margin-right: 12px;
    transition: background-color .18s ease, transform .18s ease;
    width: 6px;
}

.admin-nav-link:hover {
    background: rgba(255, 255, 255, .045);
    color: #fff !important;
}

.admin-nav-link:hover::before {
    background: #8facff;
}

.admin-nav-link.is-active {
    background: var(--admin-sidebar-soft);
    color: #fff !important;
    font-weight: 600;
}

.admin-nav-link.is-active::before {
    background: var(--admin-primary);
    box-shadow: 0 0 0 4px rgba(62, 121, 247, .16);
    transform: scale(1.08);
}

.admin-sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, .07);
    flex: 0 0 auto;
    padding: 11px 14px 12px;
}

.admin-sidebar-footer a {
    align-items: center;
    border-radius: 6px;
    color: #aeb3bf !important;
    display: flex;
    font-size: 12px;
    font-weight: 600;
    height: 40px;
    justify-content: space-between;
    padding: 0 12px;
}

.admin-sidebar-footer a:hover {
    background: rgba(255, 255, 255, .045);
    color: #fff !important;
}

.admin-sidebar-version {
    align-items: center;
    color: #777f90;
    display: flex;
    font-size: 10px;
    justify-content: space-between;
    padding: 7px 12px 0;
}

.admin-sidebar-version strong {
    color: #aeb3bf;
    font-size: 10px;
    font-weight: 600;
}

.admin-workspace {
    display: flex;
    flex-direction: column;
    margin-left: var(--admin-sidebar-width);
    min-height: 100vh;
    min-width: 0;
}

.admin-topbar {
    align-items: center;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    height: var(--admin-topbar-height);
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 700;
}

.admin-topbar-start {
    align-items: center;
    display: flex;
    min-width: 0;
}

.admin-page-context {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-page-context > span {
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

.admin-page-context > strong {
    color: var(--admin-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    max-width: min(56vw, 680px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-menu-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    display: none;
    flex-direction: column;
    height: 40px;
    justify-content: center;
    margin-right: 12px;
    padding: 0;
    width: 40px;
}

.admin-menu-toggle:hover {
    background: #f0f2f6;
}

.admin-menu-toggle span {
    background: #555b69;
    border-radius: 2px;
    display: block;
    height: 2px;
    width: 19px;
}

.admin-menu-toggle span + span {
    margin-top: 4px;
}

.admin-account {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    padding: 5px 7px;
    text-align: left;
}

.admin-account:hover,
.admin-account[aria-expanded="true"] {
    background: #f0f3f8;
}

.admin-account-dropdown {
    margin-left: 20px;
    position: relative;
}

.admin-account-chevron {
    fill: none;
    height: 16px;
    margin-left: 2px;
    stroke: #7d8492;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
    transition: transform .15s ease;
    width: 16px;
}

.admin-account[aria-expanded="true"] .admin-account-chevron {
    transform: rotate(180deg);
}

.admin-account-menu {
    background: #fff;
    border: 1px solid var(--admin-border);
    border-radius: 7px;
    box-shadow: 0 16px 38px rgba(31, 38, 51, .14);
    min-width: 190px;
    padding: 7px;
    position: absolute;
    right: 0;
    top: calc(100% + 9px);
    z-index: 1050;
}

.admin-account-menu a,
.admin-account-menu button {
    background: transparent;
    border: 0;
    border-radius: 5px;
    color: #414754;
    cursor: pointer;
    display: block;
    font: inherit;
    font-size: 12px;
    padding: 10px 11px;
    text-align: left;
    text-decoration: none;
    width: 100%;
}

.admin-account-menu a:hover,
.admin-account-menu button:hover {
    background: #f2f5fa;
    color: var(--admin-primary-dark);
}

.admin-account-menu form {
    border-top: 1px solid var(--admin-border);
    margin-top: 4px;
    padding-top: 4px;
}

.admin-account-menu .admin-language-form {
    border-top: 0;
    margin: 0;
    padding: 9px 12px 7px;
}

.admin-language-form label {
    color: var(--admin-muted);
    display: block;
    font-size: 10px;
    font-weight: 750;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.admin-language-form select {
    background: #fff;
    border: 1px solid var(--admin-border);
    color: var(--admin-text);
    cursor: pointer;
    font: inherit;
    min-height: 34px;
    padding: 5px 8px;
    width: 100%;
}

.admin-account-avatar {
    align-items: center;
    background: #e8f0ff;
    border-radius: 50%;
    color: var(--admin-primary-dark);
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.admin-account-copy {
    display: flex;
    flex-direction: column;
}

.admin-account-copy small {
    color: var(--admin-muted);
    font-size: 10px;
}

.admin-account-copy strong {
    color: #383d49;
    font-size: 12px;
    font-weight: 650;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-account-details {
    display: grid;
    gap: 0;
    margin: 0 0 24px;
    max-width: 760px;
}

.admin-account-details > div {
    align-items: center;
    border-bottom: 1px solid var(--admin-border);
    display: grid;
    gap: 24px;
    grid-template-columns: 170px 1fr;
    padding: 14px 0;
}

.admin-account-details dt {
    color: var(--admin-muted);
    font-size: 11px;
    font-weight: 700;
}

.admin-account-details dd {
    color: #303642;
    font-size: 13px;
    font-weight: 650;
    margin: 0;
}

.admin-main {
    flex: 1 0 auto;
    margin: 0 auto;
    max-width: 1560px;
    padding: 28px 32px 44px;
    width: 100%;
}

.admin-footer {
    align-items: center;
    border-top: 1px solid var(--admin-border);
    color: var(--admin-muted);
    display: flex;
    font-size: 11px;
    justify-content: space-between;
    min-height: 50px;
    padding: 10px 32px;
}

.admin-sidebar-overlay {
    background: rgba(19, 22, 29, .52);
    border: 0;
    display: none;
    inset: 0;
    padding: 0;
    position: fixed;
    z-index: 850;
}

.panel {
    background: var(--admin-surface);
    border: 1px solid var(--admin-border);
    border-radius: 8px;
    box-shadow: var(--admin-shadow);
    padding: 24px;
}

.panel + .panel {
    margin-top: 22px;
}

.page-head {
    align-items: flex-start;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin: -2px 0 22px;
    padding-bottom: 18px;
}

.page-head > div:last-child {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.page-head h1,
.admin-main h1 {
    color: #222630;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.admin-main h2 {
    color: #303540;
    font-size: 17px;
    font-weight: 700;
}

.admin-main h3 {
    color: #343945;
    font-size: 15px;
    font-weight: 700;
}

.muted {
    color: var(--admin-muted);
    font-size: 12px;
    margin-top: 4px;
}

.table-scroll {
    margin: 0 -24px -24px;
    overflow-x: auto;
    width: calc(100% + 48px);
}

.table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 760px;
    width: 100%;
}

.table th,
.table td {
    border-bottom: 1px solid var(--admin-border);
    padding: 13px 15px;
    text-align: left;
    vertical-align: middle;
}

.table th:first-child,
.table td:first-child {
    padding-left: 24px;
}

.table th:last-child,
.table td:last-child {
    padding-right: 24px;
}

.table th {
    background: #fafbfc;
    color: #727888;
    font-size: 10px;
    font-weight: 750;
    position: relative;
    text-transform: uppercase;
}

.table tbody tr {
    transition: background-color .15s ease;
}

.table tbody tr:hover {
    background: #fafcff;
}

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

.table td {
    color: #414652;
    font-size: 12px;
}

.table td strong {
    color: #292e39;
    font-weight: 650;
}

.table td img {
    border: 1px solid var(--admin-border);
    border-radius: 5px;
    background: #f6f7f9;
}

.table td:last-child {
    min-width: 210px;
}

.table.has-sticky-actions th:last-child,
.table.has-sticky-actions td:last-child {
    box-shadow: -8px 0 16px rgba(28, 31, 38, .035);
    position: sticky;
    right: 0;
    z-index: 2;
}

.table.has-sticky-actions th:last-child {
    background: #fafbfc;
    z-index: 3;
}

.table.has-sticky-actions td:last-child {
    background: #fff;
}

.table.has-sticky-actions tbody tr:hover td:last-child {
    background: #fafcff;
}

.form-row {
    margin-bottom: 17px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.category-level {
    margin-bottom: 12px;
}

.category-level:last-child {
    margin-bottom: 0;
}

.admin-shell label {
    color: #414652;
    display: block;
    font-size: 12px;
    font-weight: 650;
    margin-bottom: 7px;
}

.admin-shell input[type="text"],
.admin-shell input[type="email"],
.admin-shell input[type="password"],
.admin-shell input[type="number"],
.admin-shell input[type="search"],
.admin-shell input[type="tel"],
.admin-shell input[type="url"],
.admin-shell input[type="date"],
.admin-shell input[type="datetime-local"],
.admin-shell input[type="time"],
.admin-shell textarea,
.admin-shell select {
    background: #fff;
    border: 1px solid #d8dbe3;
    border-radius: 6px;
    color: #2d323d;
    font-size: 13px;
    min-height: 40px;
    outline: 0;
    padding: 9px 11px;
    transition: border-color .16s ease, box-shadow .16s ease;
    width: 100%;
}

.admin-shell textarea {
    line-height: 1.55;
    min-height: 112px;
    resize: vertical;
}

.admin-shell input:focus,
.admin-shell textarea:focus,
.admin-shell select:focus {
    border-color: #7fa6fb;
    box-shadow: 0 0 0 3px rgba(62, 121, 247, .12);
}

.admin-shell input[readonly],
.admin-shell input[disabled],
.admin-shell textarea[readonly],
.admin-shell select[disabled] {
    background: #f4f5f7;
    color: #858b98;
    cursor: not-allowed;
}

.admin-shell input[type="file"] {
    background: #fafbfc;
    border: 1px dashed #cfd3dc;
    border-radius: 6px;
    color: #6f7583;
    font-size: 12px;
    padding: 10px;
    width: 100%;
}

.admin-shell input[type="file"]::file-selector-button {
    background: #fff;
    border: 1px solid #d8dbe3;
    border-radius: 5px;
    color: #343945;
    cursor: pointer;
    font: inherit;
    font-weight: 650;
    margin-right: 10px;
    padding: 7px 10px;
}

.admin-shell input[type="checkbox"],
.admin-shell input[type="radio"] {
    accent-color: var(--admin-primary);
    height: 16px;
    margin: 0;
    vertical-align: middle;
    width: 16px;
}

.checkbox-row {
    align-items: center;
    display: flex;
    gap: 8px;
    min-height: 32px;
}

.checkbox-row label,
.checkbox-row > label {
    display: inline;
    font-weight: 500;
    margin: 0;
}

.actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 22px;
}

.btn {
    align-items: center;
    background: #fff;
    border: 1px solid #d8dbe3;
    border-radius: 6px;
    color: #3c424e !important;
    cursor: pointer;
    display: inline-flex;
    font-size: 12px;
    font-weight: 650;
    justify-content: center;
    line-height: 1.2;
    min-height: 36px;
    padding: 8px 12px;
    text-decoration: none !important;
    transition: background-color .15s ease, border-color .15s ease,
        box-shadow .15s ease, color .15s ease;
    vertical-align: middle;
    white-space: nowrap;
}

.btn:hover {
    background: #f5f6f8;
    border-color: #c7cbd5;
    color: #202530 !important;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(62, 121, 247, .18);
    outline: 0;
}

.btn.primary {
    background: var(--admin-primary);
    border-color: var(--admin-primary);
    color: #fff !important;
}

.btn.primary:hover {
    background: var(--admin-primary-dark);
    border-color: var(--admin-primary-dark);
    color: #fff !important;
}

.btn.danger {
    background: var(--admin-danger-bg);
    border-color: #ffd4d4;
    color: var(--admin-danger) !important;
}

.btn.danger:hover {
    background: #ffe2e2;
    border-color: #ffcaca;
}

.btn[disabled],
.btn:disabled {
    cursor: not-allowed;
    opacity: .55;
}

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

.message {
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 550;
    margin-bottom: 18px;
    padding: 12px 14px;
}

.message.success {
    background: var(--admin-success-bg);
    border-color: #caebdc;
    color: var(--admin-success);
}

.message.error {
    background: var(--admin-danger-bg);
    border-color: #ffd5d5;
    color: #b63333;
}

.admin-status {
    border-radius: 4px;
    display: inline-flex;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 7px;
}

.admin-status.is-success {
    background: var(--admin-success-bg);
    color: var(--admin-success);
}

.admin-status.is-muted {
    background: #eff1f4;
    color: #6d7380;
}

.field-validation-error {
    color: var(--admin-danger);
    display: block;
    font-size: 11px;
    margin-top: 5px;
}

.validation-summary-errors {
    background: var(--admin-danger-bg);
    border: 1px solid #ffd5d5;
    border-radius: 6px;
    color: #b63333;
    font-size: 12px;
    margin-bottom: 18px;
    padding: 11px 14px;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 18px;
}

.input-validation-error {
    border-color: #ef9999 !important;
}

.feature-panel {
    border: 0;
    border-top: 1px solid var(--admin-border);
    margin: 22px 0 0;
    padding: 22px 0 0;
}

.feature-head {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.feature-head h2,
.feature-head h3 {
    margin: 0;
}

.feature-options {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.site-settings-grid {
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(260px, .75fr) minmax(420px, 1.25fr);
}

.site-settings-grid > section {
    min-width: 0;
}

.site-logo-preview {
    align-items: center;
    background: #f7f8fa;
    border: 1px solid var(--admin-border);
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    min-height: 104px;
    padding: 18px;
}

.site-logo-preview img {
    display: block;
    max-height: 68px;
    max-width: 100%;
    object-fit: contain;
}

.site-code-editor {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px !important;
    min-height: 360px !important;
    tab-size: 4;
}

.site-admin-note,
.site-admin-warning {
    border: 1px solid #dce5f7;
    border-left: 3px solid var(--admin-primary);
    color: #4b5363;
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 18px;
    padding: 13px 15px;
}

.site-admin-note {
    background: #f7f9fe;
}

.site-admin-warning {
    background: #fff9ed;
    border-color: #f2dfb8;
    border-left-color: #d89a27;
}

.site-admin-note p,
.site-admin-warning p {
    margin: 4px 0 0;
}

.site-code-fields {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.small-input input {
    max-width: 110px;
}

.value-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.value-item {
    align-items: center;
    background: #fafbfc;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    display: inline-flex;
    gap: 7px;
    margin: 0;
    padding: 8px 10px;
}

.admin-main hr {
    border: 0;
    border-top: 1px solid var(--admin-border);
    margin: 22px 0;
}

.admin-main code {
    background: #f1f3f6;
    border-radius: 4px;
    color: #4b5260;
    font-size: 12px;
    padding: 2px 5px;
}

@media (max-width: 1180px) {
    .admin-sidebar {
        box-shadow: 18px 0 45px rgba(15, 17, 22, .22);
        transform: translateX(-100%);
        transition: transform .2s ease;
    }

    .admin-workspace {
        margin-left: 0;
    }

    .admin-menu-toggle {
        display: flex;
    }

    .admin-shell.admin-sidebar-open {
        overflow: hidden;
    }

    .admin-sidebar-open .admin-sidebar {
        transform: translateX(0);
    }

    .admin-sidebar-open .admin-sidebar-overlay {
        display: block;
    }
}

@media (max-width: 820px) {
    .site-settings-grid,
    .site-code-fields {
        grid-template-columns: 1fr;
    }

    .admin-topbar {
        padding: 0 18px;
    }

    .admin-main {
        padding: 20px 18px 34px;
    }

    .admin-footer {
        padding-left: 18px;
        padding-right: 18px;
    }

    .panel {
        padding: 19px;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .page-head > div:last-child {
        justify-content: flex-start;
    }

    .table-scroll {
        margin: 0 -19px -19px;
        width: calc(100% + 38px);
    }

    .table th:first-child,
    .table td:first-child {
        padding-left: 19px;
    }

    .table th:last-child,
    .table td:last-child {
        padding-right: 19px;
    }

    .feature-options {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 520px) {
    .admin-account-copy {
        display: none;
    }

    .admin-account {
        margin-left: 10px;
    }

    .admin-page-context > strong {
        max-width: 58vw;
    }

    .admin-main {
        padding: 14px 12px 28px;
    }

    .admin-topbar {
        height: 64px;
        padding: 0 12px;
    }

    .admin-footer {
        padding-left: 12px;
        padding-right: 12px;
    }

    .panel {
        border-left: 0;
        border-radius: 0;
        border-right: 0;
        margin-left: -12px;
        margin-right: -12px;
        padding: 16px 12px;
    }

    .table-scroll {
        margin: 0 -12px -16px;
        width: calc(100% + 24px);
    }

    .table th:first-child,
    .table td:first-child {
        padding-left: 12px;
    }

    .table th:last-child,
    .table td:last-child {
        padding-right: 12px;
    }

    .page-head h1,
    .admin-main h1 {
        font-size: 19px;
    }

    .feature-options {
        grid-template-columns: 1fr;
    }

    .btn {
        min-height: 38px;
    }
}

@media print {
    .admin-sidebar,
    .admin-topbar,
    .admin-footer,
    .page-head .btn,
    .inline-form {
        display: none !important;
    }

    .admin-workspace {
        margin: 0;
    }

    .admin-main {
        max-width: none;
        padding: 0;
    }

    .panel {
        border: 0;
        box-shadow: none;
        padding: 0;
    }
}
