:root {
    --blue: #0752b8;
    --blue-dark: #05377d;
    --ink: #182238;
    --muted: #68748a;
    --line: #dde4ee;
    --surface: #f3f6fa;
    --white: #fff;
    --danger: #bd2c31;
    --success: #087a55;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--surface); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.admin-header { position: sticky; z-index: 20; top: 0; display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 24px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); color: #fff; background: #092b62; box-shadow: 0 5px 20px rgba(10,31,66,.16); }
.admin-brand { display: flex; align-items: center; gap: 11px; }
.admin-brand span, .auth-logo span { display: inline-grid; width: 35px; height: 35px; place-items: center; border-radius: 9px; color: var(--blue-dark); background: #fff; font-weight: 900; }
.admin-header nav { display: flex; align-items: center; gap: 20px; font-size: 13px; font-weight: 700; }
.admin-header nav form { margin: 0; }
.admin-header nav button { padding: 7px 13px; color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 8px; background: transparent; cursor: pointer; }
.admin-header nav a:hover, .admin-header nav button:hover { color: #bcd5ff; }
.admin-main { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 70px; }

.admin-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
.admin-page-head p, .auth-kicker { margin: 0 0 3px; color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.admin-page-head h1 { margin: 0; font-size: clamp(31px, 4vw, 45px); line-height: 1.1; }
.admin-page-head span { display: block; margin-top: 8px; color: var(--muted); font-size: 14px; }
.admin-button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; padding: 9px 18px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-weight: 800; cursor: pointer; }
.admin-button:hover { border-color: #afbed4; }
.admin-button--primary { color: #fff; border-color: var(--blue); background: var(--blue); box-shadow: 0 8px 20px rgba(7,82,184,.18); }
.admin-button--primary:hover { background: var(--blue-dark); }
.admin-button--block { width: 100%; }

.alert { margin-bottom: 24px; padding: 13px 16px; border: 1px solid; border-radius: 10px; font-size: 14px; }
.alert--success { color: #086143; border-color: #a9dec9; background: #e8f8f1; }
.alert--error { color: #972127; border-color: #efb7b9; background: #fff0f0; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 10px 32px rgba(20,43,80,.06); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { padding: 13px 16px; color: var(--muted); border-bottom: 1px solid var(--line); background: #f9fbfd; font-size: 11px; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid #edf0f4; vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.product-cell { display: flex; min-width: 270px; align-items: center; gap: 13px; }
.product-cell img { width: 58px; height: 58px; border: 1px solid var(--line); border-radius: 9px; object-fit: cover; background: var(--surface); }
.product-cell b, .product-cell small { display: block; }
.product-cell small { margin-top: 3px; color: var(--muted); }
.status { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status--published { color: #076747; background: #e5f7f0; }
.status--draft { color: #805b10; background: #fff5d9; }
.admin-actions { white-space: nowrap; }
.admin-actions > a, .admin-actions form, .admin-actions button { display: inline; }
.admin-actions a, .admin-actions button { margin: 0 5px; padding: 0; color: var(--blue); border: 0; background: transparent; font-weight: 800; cursor: pointer; }
.admin-actions button { color: var(--danger); }
.admin-empty { padding: 70px 25px; border: 1px dashed #bdc9d9; border-radius: 14px; text-align: center; background: #fff; }
.admin-empty h2 { margin: 0; }
.admin-empty p { margin: 8px 0 22px; color: var(--muted); }

.product-form { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: start; gap: 25px; }
.form-side { display: grid; gap: 20px; }
.form-card { padding: 26px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 27px rgba(20,43,80,.05); }
.form-card h2 { margin: 0 0 23px; font-size: 17px; }
.admin-form label, .product-form label { display: block; margin-bottom: 20px; color: #34405a; font-size: 13px; font-weight: 750; }
.admin-form input, .product-form input, .product-form textarea, .product-form select { width: 100%; margin-top: 7px; padding: 11px 12px; color: var(--ink); border: 1px solid #cbd4e0; border-radius: 8px; outline: none; background: #fff; font-weight: 500; }
.admin-form input:focus, .product-form input:focus, .product-form textarea:focus, .product-form select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(7,82,184,.1); }
.product-form textarea { resize: vertical; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.file-field small, .admin-form small { display: block; margin-top: 7px; color: var(--muted); font-weight: 500; }
.image-preview { width: 100%; margin-bottom: 17px; border: 1px solid var(--line); border-radius: 10px; aspect-ratio: 1; object-fit: cover; }
.check-field { display: flex !important; align-items: center; gap: 10px; }
.check-field input { width: 18px; height: 18px; margin: 0; }

.auth-body { display: grid; min-height: 100vh; place-items: center; padding: 30px 18px; background: radial-gradient(circle at top left, #e5efff, transparent 38%), var(--surface); }
.auth-card { width: min(480px, 100%); padding: clamp(28px, 5vw, 46px); border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 20px 60px rgba(18,42,82,.14); }
.auth-card--small { width: min(430px, 100%); }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 36px; color: var(--blue-dark); font-weight: 900; }
.auth-logo span { color: #fff; background: var(--blue); }
.auth-card h1 { margin: 0 0 8px; font-size: 30px; }
.auth-card > p:not(.auth-kicker) { margin: 0 0 25px; color: var(--muted); font-size: 14px; }
.auth-card .admin-button { width: 100%; }
.auth-back { display: block; margin-top: 23px; color: var(--muted); font-size: 13px; text-align: center; }
.auth-back:hover { color: var(--blue); }

.admin-page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.page-admin-note { margin: 0 0 22px; color: var(--blue); font-size: 14px; font-weight: 800; }
.page-admin-note a:hover { text-decoration: underline; }
.page-admin-card { display: flex; flex-direction: column; align-items: flex-start; min-height: 235px; padding: 25px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 27px rgba(20,43,80,.05); }
.page-admin-card__icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; color: var(--blue); background: #e9f1fe; font-weight: 900; }
.page-admin-card h2 { margin: 14px 0 6px; font-size: 20px; }
.page-admin-card p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.page-admin-card .admin-button { margin-top: auto; }
.page-admin-card__view { display: inline-block; margin-top: 13px; color: var(--blue); font-size: 12px; font-weight: 800; }
.page-editor { display: grid; gap: 22px; }
.page-editor__group { padding: 28px; }
.page-editor__group h2 { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.page-editor__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 20px; }
.page-editor__fields label { display: block; margin-bottom: 20px; color: #34405a; font-size: 13px; font-weight: 750; }
.page-editor__fields input, .page-editor__fields textarea { display: block; width: 100%; margin-top: 7px; padding: 11px 12px; color: var(--ink); border: 1px solid #cbd4e0; border-radius: 8px; outline: none; background: #fff; font-weight: 500; }
.page-editor__fields input:focus, .page-editor__fields textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(7,82,184,.1); }
.page-editor__fields textarea { resize: vertical; line-height: 1.6; }
.page-editor__wide { grid-column: 1 / -1; }
.page-editor__image-field img { width: min(100%, 300px); max-height: 180px; margin: 10px 0; border: 1px solid var(--line); border-radius: 9px; object-fit: cover; background: var(--surface); }
.page-editor__image-field .product-detail-editor__wide-preview { width: min(100%, 920px); max-height: 430px; object-fit: contain; }
.page-editor__empty-image { display: grid; width: min(100%, 300px); min-height: 110px; margin: 10px 0; place-items: center; color: var(--muted); border: 1px dashed #b9c4d2; border-radius: 9px; background: var(--surface); font-size: 13px; font-weight: 600; }
.page-editor__image-field small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; font-weight: 500; }
.page-editor__image-field .page-editor__image-hint { padding: 9px 11px; color: #0752b8; border: 1px solid #c9daf4; border-radius: 7px; background: #eff5ff; font-size: 12px; font-weight: 750; line-height: 1.55; }
.page-editor__save { display: flex; position: sticky; bottom: 12px; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.96); box-shadow: 0 12px 30px rgba(20,43,80,.12); }
.page-editor__save span { color: var(--muted); font-size: 13px; }
.application-admin-list { display: grid; gap: 18px; margin-bottom: 22px; }
.application-admin-card { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 22px; }
.application-admin-card img { width: 100%; aspect-ratio: 1.15; border-radius: 9px; object-fit: cover; }
.application-admin-card label { display: block; margin-bottom: 12px; color: #34405a; font-size: 13px; font-weight: 750; }
.application-admin-card input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid #cbd4e0; border-radius: 8px; }
.application-admin-card__fields { display: grid; grid-template-columns: minmax(0, 1fr) 95px; gap: 0 16px; align-content: start; }
.application-admin-card__fields label:first-child, .application-admin-card__fields label:last-child { grid-column: 1 / -1; }
.application-admin-card__fields label:last-child input { display: inline; width: auto; margin: 0 7px 0 0; }
.application-admin-add .page-editor__fields { max-width: 720px; }
.application-admin-add small { display: block; margin-top: 4px; color: var(--muted); }

@media (max-width: 850px) {
    .product-form { grid-template-columns: 1fr; }
    .form-side { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
    .admin-header { padding: 0 14px; }
    .admin-brand b { display: none; }
    .admin-header nav { gap: 10px; }
    .admin-main { width: min(100% - 24px, 1240px); padding-top: 32px; }
    .admin-page-head { align-items: flex-start; flex-direction: column; }
    .form-row, .form-side { grid-template-columns: 1fr; }
    .admin-table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; }
    .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
    .admin-table thead { display: none; }
    .admin-table tr { margin-bottom: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
    .admin-table td { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 4px; border-bottom: 1px solid #edf0f4; }
    .admin-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
    .admin-table td:first-child { display: block; }
    .admin-table td:first-child::before, .admin-table td:last-child::before { display: none; }
    .admin-table td:last-child { justify-content: flex-end; border-bottom: 0; }
    .product-cell { min-width: 0; }
    .page-admin-grid, .page-editor__fields { grid-template-columns: 1fr; }
    .page-editor__group { padding: 20px; }
    .page-editor__save { flex-direction: column; align-items: stretch; }
    .page-editor__save .admin-button { width: 100%; }
    .admin-header nav a:first-child { display: none; }
    .application-admin-card { grid-template-columns: 1fr; }
    .application-admin-card img { max-width: 300px; }
    .application-admin-card__fields { grid-template-columns: 1fr 85px; }
    .admin-header nav { flex-wrap: wrap; justify-content: flex-end; padding: 8px 0; }
}
