/* AnavianVet — backoffice. Fără build: CSS scris de mână. */

:root {
    --green: #307d63;
    --green-dark: #163f35;
    --green-mid: #2c5f55;
    --green-tint: #e8f2ee;
    --green-tint-2: #d3e7df;
    --bg: #f4f6f5;
    --surface: #ffffff;
    --text: #1b2724;
    --muted: #55645f;
    --border: #d8e0dd;
    --border-strong: #b8c6c1;
    --danger: #a8321f;
    --danger-tint: #fbeae6;
    --warning: #8a5a00;
    --warning-tint: #fff4dc;
    --info: #1f5a8a;
    --info-tint: #e6f0f9;
    --focus: #f2b632;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(22, 63, 53, .06), 0 2px 8px rgba(22, 63, 53, .05);
    --sidebar-w: 236px;
    font-size: 16px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: .9375rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--green); }
a:hover { color: var(--green-dark); }

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

.skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 100;
    background: var(--surface);
    padding: 8px 12px;
    border-radius: var(--radius);
}
.skip-link:focus { left: 8px; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Structură ---------- */

.shell { min-height: 100vh; display: flex; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--green-dark);
    color: #e6efeb;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: .01em;
}
.brand:hover { color: #fff; }
.brand-mark {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--green);
    display: grid;
    place-items: center;
    font-size: .875rem;
}
.brand small { display: block; font-weight: 400; font-size: .75rem; color: #b9d0c7; }

.nav { list-style: none; margin: 0; padding: 8px 10px 24px; }
.nav li { margin: 2px 0; }
.nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 12px;
    border-radius: 6px;
    color: #dbe8e3;
    text-decoration: none;
}
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a[aria-current="page"] { background: var(--green); color: #fff; font-weight: 600; }
.nav .count {
    min-width: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: #f2b632;
    color: #2b1d00;
    font-size: .75rem;
    font-weight: 700;
    text-align: center;
    line-height: 20px;
}
.nav-sep { height: 1px; background: rgba(255, 255, 255, .12); margin: 10px 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    min-height: 56px;
}
.topbar-user { display: flex; align-items: center; gap: 12px; margin-left: auto; color: var(--muted); }
.topbar-user strong { color: var(--text); font-weight: 600; }
.btn.menu-toggle { display: none; }

.content { padding: 24px 28px 48px; max-width: 1280px; width: 100%; }

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 1.5rem; line-height: 1.25; color: var(--green-dark); }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.breadcrumb { font-size: .875rem; margin-bottom: 4px; }
.breadcrumb a { text-decoration: none; }

/* ---------- Carduri, grile ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.card-head h2 { margin: 0; font-size: 1.0625rem; color: var(--green-dark); }
.card-body { padding: 18px; }
.card-body > :first-child { margin-top: 0; }
.card-body > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    display: block;
}
a.stat:hover { border-color: var(--green); color: var(--text); }
.stat-label { color: var(--muted); font-size: .8125rem; }
.stat-value { font-size: 1.625rem; font-weight: 700; color: var(--green-dark); line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-note { font-size: .8125rem; color: var(--muted); margin-top: 2px; }
.stat.is-alert { border-left: 4px solid #f2b632; }

dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; word-break: break-word; }

.prewrap { white-space: pre-wrap; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ---------- Tabele ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table th { font-size: .8125rem; font-weight: 600; color: var(--muted); background: #f8faf9; white-space: nowrap; }
.table tbody tr:hover { background: #f8fbfa; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.table tfoot td { font-weight: 600; border-top: 2px solid var(--border); border-bottom: 0; }
.table .row-link { font-weight: 600; text-decoration: none; }
.table .row-link:hover { text-decoration: underline; }
.table .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--green-tint); display: block; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }

/* ---------- Etichete ---------- */

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    background: #eceff0;
    color: #36413e;
    border: 1px solid transparent;
}
.badge-new { background: var(--warning-tint); color: var(--warning); border-color: #f0d9a4; }
.badge-ok { background: var(--green-tint); color: #1d5a46; border-color: var(--green-tint-2); }
.badge-info { background: var(--info-tint); color: var(--info); border-color: #c7dcef; }
.badge-done { background: #e3ece9; color: var(--green-dark); }
.badge-danger { background: var(--danger-tint); color: var(--danger); border-color: #f1c7be; }
.badge-muted { background: #eceff0; color: #4b5653; }

/* ---------- Mesaje ---------- */

.flash {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    border: 1px solid;
}
.flash-success { background: var(--green-tint); border-color: var(--green-tint-2); color: #164a3a; }
.flash-error { background: var(--danger-tint); border-color: #f1c7be; color: #7a2112; }
.flash-warning { background: var(--warning-tint); border-color: #f0d9a4; color: #5f3e00; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------- Formulare ---------- */

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
label, .label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: 5px; color: #26332f; }
.hint { font-size: .8125rem; color: var(--muted); margin-top: 4px; }
.req { color: var(--danger); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="search"], input[type="color"],
select, textarea {
    width: 100%;
    font: inherit;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 8px 10px;
    min-height: 40px;
}
input[type="color"] { padding: 3px; width: 64px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: 3px solid rgba(48, 125, 99, .25); outline-offset: 0; }
.is-invalid { border-color: var(--danger) !important; }
.error { color: var(--danger); font-size: .8125rem; margin-top: 4px; }

.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; }
.check input { width: 18px; height: 18px; accent-color: var(--green); margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 600; font-size: .875rem; margin-bottom: 6px; padding: 0; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 14px 18px;
}
.filters .field { margin: 0; flex: 1 1 150px; min-width: 130px; }
.filters .field.grow { flex: 2 1 240px; }
.filters .actions { display: flex; gap: 8px; }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; }

/* ---------- Butoane ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid var(--green);
    background: var(--green);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--green-mid); border-color: var(--green-mid); color: #fff; }
.btn-secondary { background: #fff; color: var(--green-dark); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--green-tint); color: var(--green-dark); border-color: var(--green); }
.btn-danger { background: #fff; color: var(--danger); border-color: #e2a99d; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-link { background: none; border: 0; color: var(--green); padding: 0; min-height: 0; font-weight: 600; text-decoration: underline; }
.btn-link:hover { background: none; color: var(--green-dark); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .8125rem; }
.inline-form { display: inline; margin: 0; }

/* ---------- Paginare ---------- */

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); }
.pagination ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
.pagination a, .pagination span.page {
    display: inline-block;
    min-width: 36px;
    padding: 6px 10px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--green-dark);
    background: #fff;
}
.pagination a:hover { border-color: var(--green); }
.pagination [aria-current="page"] span { background: var(--green); color: #fff; border-color: var(--green); }
.pagination .disabled span { color: #9aa7a3; }

/* ---------- Produse ---------- */

.img-preview {
    width: 100%;
    max-width: 260px;
    aspect-ratio: 1;
    object-fit: contain;
    background: var(--green-tint);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: block;
}
.price-old { text-decoration: line-through; color: var(--muted); font-size: .8125rem; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); vertical-align: -2px; margin-right: 6px; }

.answer-box { background: var(--green-tint); border: 1px solid var(--green-tint-2); border-radius: var(--radius); padding: 12px 14px; }

/* ---------- Autentificare ---------- */

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background: linear-gradient(160deg, var(--green-dark) 0%, var(--green-mid) 55%, var(--green) 100%);
}
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 12px; padding: 28px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.auth-card h1 { margin: 0 0 4px; font-size: 1.375rem; color: var(--green-dark); }
.auth-card .sub { margin: 0 0 20px; color: var(--muted); }
.auth-card .btn { width: 100%; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
    .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
    .shell { display: block; }
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 0 0 24px rgba(0, 0, 0, .3);
    }
    .nav-open .sidebar { transform: translateX(0); }
    .nav-backdrop { display: none; }
    .nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
    .btn.menu-toggle { display: inline-flex; }
    .topbar { padding: 8px 16px; position: sticky; top: 0; z-index: 30; }
    .topbar-user .who { display: none; }
    .content { padding: 18px 16px 40px; }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .page-head h1 { font-size: 1.3125rem; }
    .hide-sm { display: none; }
    dl.details { grid-template-columns: 1fr; gap: 0; }
    dl.details dd { margin-bottom: 8px; }
}

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

/* ---------- Galeria produsului ---------- */
.gallery-admin { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.gallery-item { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.gallery-item:first-child { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.gallery-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--green-tint); }
.gallery-item__body { display: grid; gap: 8px; min-width: 0; }
.gallery-item__body input[type="text"] { width: 100%; }
.gallery-item__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.check-danger { color: var(--danger); margin-left: auto; }
.upload-preview { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.upload-preview li { display: flex; align-items: center; gap: 10px; font-size: .8125rem; color: var(--muted); }
.upload-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
details.field > summary { cursor: pointer; color: var(--green); font-weight: 600; margin-bottom: 8px; }
