:root {
    --bg: #eef3fb;
    --bg2: #f8fafc;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #dbe3ef;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #dbeafe;
    --green: #16a34a;
    --green-dark: #15803d;
    --gray: #475569;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --shadow: 0 18px 45px rgba(15, 23, 42, .10);
    --shadow-soft: 0 8px 22px rgba(15, 23, 42, .07);
    --radius: 18px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .18), transparent 34%),
        linear-gradient(180deg, var(--bg), var(--bg2));
    color: var(--text);
    min-height: 100vh;
}
a { color: inherit; }
.site-header {
    width: min(1120px, calc(100% - 28px));
    margin: 22px auto 16px;
}
.hero-card {
    display: flex;
    align-items: center;
    gap: 18px;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(219, 227, 239, .9);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    padding: 22px;
    backdrop-filter: blur(8px);
}
.hero-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), #0f172a);
    box-shadow: 0 12px 24px rgba(37, 99, 235, .24);
    font-size: 32px;
    flex: 0 0 auto;
}
.hero-text { flex: 1; min-width: 0; }
.kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.site-header h1 {
    margin: 4px 0 6px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
}
.hero-text p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}
.hero-admin {
    flex: 0 0 auto;
    color: #fff;
    background: #0f172a;
    text-decoration: none;
    font-weight: 700;
    border-radius: 999px;
    padding: 10px 16px;
    box-shadow: var(--shadow-soft);
}
.hero-admin:hover { background: #1e293b; }
.container {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto 34px;
}
.container.narrow { width: min(650px, calc(100% - 28px)); }
.order-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}
.phone-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.phone-card {
    position: relative;
    overflow: hidden;
    background: var(--card);
    border: 1px solid rgba(219, 227, 239, .9);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 18px;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.phone-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #38bdf8);
}
.phone-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: #bfdbfe;
}
.phone-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.phone-card h2 {
    font-size: 21px;
    line-height: 1.18;
    margin: 0;
}
.phone-badge {
    order: 2;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 12px;
    padding: 6px 10px;
}
.phone-description { margin: -4px 0 12px; }
.price-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    margin: 0 0 14px;
}
.price-row span { color: var(--muted); font-size: 13px; }
.price-row strong { font-size: 19px; }
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 800;
    margin: 10px 0 6px;
}
.input, select.input, textarea.input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 11px 12px;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, select.input:focus, textarea.input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
textarea.input { resize: vertical; }
.accessory-title {
    font-size: 13px;
    font-weight: 800;
    margin: 4px 0 8px;
}
.accessory-list {
    display: grid;
    gap: 8px;
    margin: 8px 0 14px;
}
.check-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 13px;
    padding: 9px 10px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.check-row:hover {
    background: #f8fafc;
    border-color: #bfdbfe;
}
.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}
.check-row span {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    flex: 1;
}
.check-row small { color: var(--muted); font-weight: 700; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    min-height: 42px;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-green {
    background: linear-gradient(135deg, var(--green), var(--green-dark));
    color: #fff;
    width: 100%;
    box-shadow: 0 10px 20px rgba(22, 163, 74, .18);
}
.btn-green:hover { background: linear-gradient(135deg, var(--green-dark), #166534); }
.btn-gray { background: #e2e8f0; color: #0f172a; }
.btn-gray:hover { background: #cbd5e1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small {
    padding: 8px 11px;
    min-height: 34px;
    font-size: 13px;
    background: #eef2ff;
    color: #1e3a8a;
    border-radius: 10px;
}
.full { width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.alert {
    border-radius: 16px;
    padding: 13px 15px;
    margin: 14px 0;
    box-shadow: var(--shadow-soft);
}
.alert.success { background: #dcfce7; border: 1px solid #86efac; color: #14532d; }
.alert.error { background: var(--danger-soft); border: 1px solid #fca5a5; color: #7f1d1d; }
.empty-state {
    grid-column: 1 / -1;
    background: #fff;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 26px;
    color: var(--muted);
    text-align: center;
}
.cart-box {
    position: sticky;
    top: 16px;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(219, 227, 239, .9);
    padding: 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}
.cart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.cart-head h2 { margin: 4px 0 0; font-size: 22px; }
.cart-count {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 900;
}
.cart-items {
    display: grid;
    gap: 10px;
}
.cart-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    background: #f8fafc;
    border-radius: 14px;
}
.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.inline-form { display: inline; }
.link-button {
    border: 0;
    background: none;
    color: #b91c1c;
    text-decoration: none;
    padding: 4px 0;
    cursor: pointer;
    font-weight: 800;
}
.link-button:hover { text-decoration: underline; }
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    border-top: 1px solid var(--border);
    margin: 16px 0 14px;
    padding-top: 14px;
}
.cart-total span { color: var(--muted); font-weight: 800; }
.cart-total strong { font-size: 22px; }
.cart-buttons {
    display: grid;
    gap: 10px;
}
.footer {
    text-align: center;
    padding: 18px 0 32px;
    color: var(--muted);
    font-size: 13px;
}

/* Admin */
.admin-body {
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .16), transparent 34%),
        #eef3fb;
}
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(15, 23, 42, .96);
    color: #fff;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    padding: 14px 22px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
    backdrop-filter: blur(8px);
}
.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
}
.admin-version {
    color: #bfdbfe;
    background: rgba(37, 99, 235, .25);
    border: 1px solid rgba(147, 197, 253, .25);
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
}
.admin-topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.admin-topbar a {
    color: #fff;
    text-decoration: none;
    opacity: .92;
    padding: 8px 10px;
    border-radius: 10px;
}
.admin-topbar a:hover { opacity: 1; background: rgba(255,255,255,.10); }
.admin-topbar a.admin-shop-link {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(22, 163, 74, .25);
}
.admin-topbar a.admin-shop-link:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    transform: translateY(-1px);
}
.admin-container {
    width: min(1120px, calc(100% - 28px));
    margin: 24px auto 50px;
}
.admin-container h1 { margin: 0 0 16px; }
.admin-title-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}
.admin-title-row h1 { margin: 0; }
.admin-title-row .btn-green { width: auto; }
.panel {
    background: rgba(255,255,255,.95);
    border: 1px solid rgba(219, 227, 239, .9);
    border-radius: var(--radius);
    padding: 20px;
    margin: 18px 0;
    box-shadow: var(--shadow-soft);
}
.panel h2 { margin-top: 0; }
.admin-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 18px 0;
}
.admin-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    text-decoration: none;
    box-shadow: var(--shadow-soft);
    transition: transform .15s ease, box-shadow .15s ease;
}
.admin-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #38bdf8);
}
.admin-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.admin-card strong {
    display: block;
    font-size: 30px;
    margin-bottom: 4px;
}
.admin-card span { color: var(--muted); font-weight: 700; }
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}
.table th, .table td {
    border-bottom: 1px solid var(--border);
    text-align: left;
    padding: 12px 10px;
    vertical-align: middle;
}
.table th {
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.table tr:last-child td { border-bottom: 0; }
.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    white-space: nowrap;
}
.admin-form label {
    display: block;
    font-weight: 800;
    margin: 10px 0 6px;
}
.admin-check { font-weight: normal !important; }
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.form-actions .btn-green { width: auto; }
.grid-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}
.grid-form .form-actions { margin: 0; }

/* Login */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, .20), transparent 34%),
        linear-gradient(135deg, #eef3fb, #f8fafc);
}
.login-card {
    width: min(430px, 100%);
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(219, 227, 239, .9);
    border-radius: 24px;
    padding: 26px;
    box-shadow: var(--shadow);
}
.login-card h1 { margin-top: 0; text-align: center; }
.login-card label {
    display: block;
    font-weight: 800;
    margin: 10px 0 6px;
}

@media (max-width: 1050px) {
    .order-layout { grid-template-columns: 1fr; }
    .cart-box { position: static; }
}
@media (max-width: 820px) {
    .hero-card { align-items: flex-start; flex-direction: column; }
    .hero-admin { width: 100%; text-align: center; }
    .phone-grid, .admin-cards, .grid-form { grid-template-columns: 1fr; }
    .admin-topbar { align-items: flex-start; flex-direction: column; }
    .admin-topbar nav { width: 100%; }
    .admin-topbar a { background: rgba(255,255,255,.07); }
    .admin-title-row { align-items: stretch; flex-direction: column; }
    .admin-title-row .btn-green { width: 100%; }
    .table-actions { flex-direction: column; align-items: stretch; }
    .form-actions .btn { width: 100%; }
}
