:root {
    --blue-900: #3a578c;
    --blue-700: #6690c3;
    --blue-100: #e4efff;
    --bg: #eef3fb;
    --surface: #ffffff;
    --surface-soft: #f5f9ff;
    --ink: #1f3258;
    --muted: #5a719a;
    --accent: #3a578c;
    --accent-strong: #2f4a78;
    --gold: #c2a15b;
    --gold-soft: #e6d6ad;
    --line: #dbe6f6;
    --danger: #c0473f;
    --ok: #2e8b6b;
    --shadow-sm: 0 6px 18px rgba(40, 64, 110, 0.08);
    --shadow-md: 0 14px 34px rgba(40, 64, 110, 0.13);
    --serif: 'Cormorant Garamond', serif;
    --sans: 'Nunito Sans', sans-serif;
    --side-w: 264px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}

h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 600; }
a { color: inherit; text-decoration: none; }

:focus-visible {
    outline: 2px solid var(--blue-700);
    outline-offset: 2px;
}

/* ===================== Layout ===================== */
.panel {
    display: flex;
    min-height: 100vh;
}

.panel-side {
    width: var(--side-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    background: linear-gradient(165deg, var(--blue-900), var(--accent-strong));
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    padding: 26px 18px;
}

.panel-side__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 22px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.panel-side__heart {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    color: var(--gold-soft);
    font-size: 1.1rem;
    border: 1px solid rgba(230, 214, 173, 0.4);
}

.panel-side__brand-text { display: flex; flex-direction: column; line-height: 1.25; overflow: hidden; }
.panel-side__brand-text strong { font-family: var(--serif); font-size: 1.18rem; color: #fff; }
.panel-side__brand-text small { font-size: 0.78rem; color: rgba(255, 255, 255, 0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panel-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.panel-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border-radius: 11px;
    font-size: 0.92rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.78);
    transition: background 0.2s ease, color 0.2s ease;
}

.panel-nav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.panel-nav a.is-active {
    background: rgba(255, 255, 255, 0.96);
    color: var(--accent-strong);
    box-shadow: var(--shadow-sm);
}

.panel-nav__ico { font-size: 0.8rem; width: 18px; text-align: center; opacity: 0.85; }

.panel-side__foot {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.panel-side__view {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gold-soft);
    padding: 8px 14px;
}

.panel-side__view:hover { color: #fff; }

.panel-side__logout {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.panel-side__logout:hover { background: rgba(255, 255, 255, 0.16); }

.panel-main {
    flex: 1;
    min-width: 0;
    padding: 30px clamp(18px, 4vw, 46px) 60px;
}

.panel-topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.panel-topbar__eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--blue-700);
}

.panel-topbar__title { font-size: clamp(1.7rem, 3vw, 2.3rem); color: var(--ink); margin-top: 2px; }

/* ===================== Messages ===================== */
.panel-messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.panel-message {
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid;
}

.panel-message--success { background: #e7f6ef; color: #1d6e51; border-color: #b6e3cf; }
.panel-message--error { background: #fceceb; color: #a5322b; border-color: #f1c3bf; }

/* ===================== Cards ===================== */
.panel-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    padding: clamp(20px, 3vw, 30px);
    margin-bottom: 22px;
}

.panel-card__title {
    font-size: 1.4rem;
    color: var(--ink);
    padding-bottom: 14px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
    position: relative;
}

.panel-card__title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 46px;
    height: 2px;
    background: var(--gold);
}

.panel-card__subtitle { font-size: 1.05rem; color: var(--ink); margin: 22px 0 10px; }
.panel-card--narrow { max-width: 520px; }
.panel-card--empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }

.panel-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: start;
}

/* ===================== Stats ===================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card__value { font-family: var(--serif); font-size: 2.6rem; font-weight: 700; color: var(--accent); line-height: 1; }
.stat-card__label { font-size: 0.82rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.stat-card--accent {
    background: linear-gradient(150deg, var(--blue-900), var(--accent-strong));
    border-color: transparent;
}
.stat-card--accent .stat-card__value { color: #fff; }
.stat-card--accent .stat-card__label { color: var(--gold-soft); }

/* ===================== Quick links / checklist ===================== */
.quick-links { display: grid; gap: 12px; }

.quick-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.quick-link:hover { border-color: var(--gold-soft); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.quick-link strong { color: var(--ink); font-size: 0.98rem; }
.quick-link span { color: var(--muted); font-size: 0.84rem; }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li {
    position: relative;
    padding-left: 30px;
    font-size: 0.92rem;
    color: var(--muted);
}
.checklist li::before {
    content: '○';
    position: absolute;
    left: 0;
    top: -1px;
    font-size: 1.1rem;
    color: #b9c8e0;
}
.checklist li.is-ok { color: var(--ink); font-weight: 600; }
.checklist li.is-ok::before { content: '✓'; color: var(--ok); font-weight: 800; }

.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mini-list li {
    font-size: 0.88rem;
    color: var(--muted);
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: baseline;
}
.mini-list li strong { color: var(--ink); }
.mini-list li em { color: var(--accent); font-style: normal; font-weight: 600; }
.mini-list li span { margin-left: auto; font-size: 0.78rem; color: #93a6c4; }

.panel-empty { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* ===================== Forms ===================== */
.panel-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.panel-field { display: flex; flex-direction: column; gap: 6px; }
.panel-field--full, .panel-field:has(textarea) { grid-column: 1 / -1; }

.panel-field > label { font-size: 0.86rem; font-weight: 700; color: var(--ink); }

.panel-field input[type="text"],
.panel-field input[type="email"],
.panel-field input[type="password"],
.panel-field input[type="number"],
.panel-field input[type="date"],
.panel-field input[type="url"],
.panel-field select,
.panel-field textarea,
.login-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 0.94rem;
    color: var(--ink);
    background: var(--surface-soft);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.panel-field textarea { resize: vertical; min-height: 90px; }

.panel-field input:focus,
.panel-field select:focus,
.panel-field textarea:focus,
.login-form input:focus {
    outline: none;
    border-color: var(--blue-700);
    box-shadow: 0 0 0 3px rgba(102, 144, 195, 0.18);
    background: #fff;
}

.panel-field input[type="color"] {
    width: 64px;
    height: 42px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
}

.panel-field input[type="file"] {
    font-size: 0.86rem;
    color: var(--muted);
}
.panel-field input[type="file"]::file-selector-button {
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--accent);
    background: var(--blue-100);
    border: none;
    padding: 9px 14px;
    border-radius: 8px;
    margin-right: 12px;
    cursor: pointer;
}

.panel-field--check { flex-direction: row; align-items: center; grid-column: 1 / -1; }
.check-label { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); cursor: pointer; }
.check-label input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

.panel-help { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.panel-error { font-size: 0.8rem; color: var(--danger); font-weight: 600; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }

.current-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 11px;
    margin-bottom: 4px;
}
.current-file img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.current-file span { font-size: 0.8rem; color: var(--muted); }

.panel-form__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

.confirm-text { font-size: 1rem; color: var(--ink); margin: 0 0 22px; }

/* ===================== Buttons ===================== */
.btn-panel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    padding: 11px 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.2s ease, color 0.2s ease;
}
.btn-panel:hover { transform: translateY(-2px); }
.btn-panel--sm { padding: 8px 14px; font-size: 0.78rem; }
.btn-panel--block { width: 100%; }

.btn-panel--primary {
    background: linear-gradient(135deg, var(--blue-700), var(--blue-900));
    color: #fff;
    box-shadow: 0 8px 18px rgba(58, 87, 140, 0.26);
}
.btn-panel--primary:hover { box-shadow: 0 12px 24px rgba(58, 87, 140, 0.34); }

.btn-panel--ghost { background: var(--surface); color: var(--accent); border-color: #a8c5ea; }
.btn-panel--ghost:hover { background: var(--blue-100); }

.btn-panel--danger { background: #fff; color: var(--danger); border-color: #e6b3af; }
.btn-panel--danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ===================== Gift grid (admin) ===================== */
.admin-gift-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
}

.admin-gift {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.admin-gift:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.admin-gift.is-inactive { opacity: 0.7; }

.admin-gift__thumb {
    position: relative;
    height: 160px;
    background: var(--surface-soft);
}
.admin-gift__thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-gift__noimg {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9fb2cf;
    font-size: 0.85rem;
    font-weight: 600;
}

.admin-gift__badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-sm);
}
.badge--gold { color: #946f17; }
.badge--ok { color: var(--ok); }
.badge--off { color: var(--muted); }

.admin-gift__body { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.admin-gift__body h3 { font-size: 1.2rem; color: var(--ink); }
.admin-gift__price { font-family: var(--serif); font-size: 1.25rem; font-weight: 700; color: var(--accent); margin: 0; }
.admin-gift__actions { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; }
.admin-gift__actions .btn-panel { flex: 1; }

/* ===================== Table ===================== */
.table-wrap { overflow-x: auto; }
.panel-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.panel-table th {
    text-align: left;
    padding: 12px 14px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
}
.panel-table td { padding: 14px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: top; }
.panel-table tr:last-child td { border-bottom: none; }
.panel-table td strong { display: block; }
.panel-table td small { color: var(--muted); font-size: 0.8rem; }
.msg-cell { color: var(--muted); max-width: 280px; }

/* ===================== Login ===================== */
.panel-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(102, 144, 195, 0.25), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(194, 161, 91, 0.14), transparent 42%),
        linear-gradient(160deg, var(--blue-900), var(--accent-strong));
}

.login-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 22px;
    padding: 40px 34px 30px;
    box-shadow: 0 30px 70px rgba(20, 36, 70, 0.4);
    text-align: center;
    position: relative;
}

.login-card__ornament {
    width: 54px;
    height: 2px;
    margin: 0 auto 18px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.login-card__brand {
    margin: 0;
    color: var(--gold);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.74rem;
}
.login-card__title { font-size: 2.1rem; color: var(--ink); margin: 8px 0 4px; }
.login-card__subtitle { color: var(--muted); font-size: 0.9rem; margin: 0 0 22px; }

.login-form { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-bottom: 18px; }
.login-form .panel-field label { font-size: 0.84rem; font-weight: 700; color: var(--ink); }
.login-form button { margin-top: 6px; }

.login-card__back { display: inline-block; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.login-card__back:hover { color: var(--accent); }

/* ===================== Responsive ===================== */
@media (max-width: 860px) {
    .panel { flex-direction: column; }
    .panel-side {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px 16px;
        padding: 14px 16px;
    }
    .panel-side__brand { border: none; padding: 0; margin: 0; }
    .panel-nav {
        flex: 1 1 100%;
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        order: 3;
        scrollbar-width: none;
    }
    .panel-nav::-webkit-scrollbar { display: none; }
    .panel-nav a { white-space: nowrap; padding: 9px 13px; }
    .panel-side__foot {
        flex-direction: row;
        align-items: center;
        border: none;
        padding: 0;
        margin-left: auto;
        gap: 10px;
    }
    .panel-side__logout { width: auto; }
    .panel-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .panel-fields { grid-template-columns: 1fr; }
    .panel-main { padding: 22px 16px 50px; }
    .panel-form__actions { flex-direction: column-reverse; }
    .panel-form__actions .btn-panel { width: 100%; }
    .panel-topbar__action { width: 100%; }
    .panel-topbar__action .btn-panel { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.001ms !important; }
}
