:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #15171c;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --radius: 10px;
    --sidebar: 240px;
    --header: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; height: auto; display: block; }

/* Auth */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.auth__card { width: 100%; max-width: 420px; background: var(--surface); padding: 2rem;
    border-radius: var(--radius); box-shadow: var(--shadow); }
.auth__brand { margin: 0 0 1.25rem; font-size: 1.5rem; }
.auth__brand span { color: var(--primary); }
.auth__hint { text-align: center; color: var(--muted); font-size: .875rem; margin: 1rem 0 0; }

/* App layout */
.app { min-height: 100vh; }
.app__header { position: fixed; top: 0; left: 0; right: 0; height: var(--header);
    display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
    background: var(--surface); border-bottom: 1px solid var(--border); z-index: 20; }
.app__brand { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.app__brand span { color: var(--primary); font-weight: 500; }
.app__user { margin-left: auto; display: flex; gap: .75rem; align-items: center; }
.app__email { color: var(--muted); font-size: .875rem; display: none; }
@media (min-width: 640px) { .app__email { display: inline; } }

.app__sidebar { position: fixed; top: var(--header); left: 0; bottom: 0;
    width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border);
    padding: 1rem; overflow-y: auto; z-index: 10;
    transform: translateX(-100%); transition: transform .2s; }
.app__sidebar.is-open { transform: translateX(0); }
@media (min-width: 900px) {
    .app__sidebar { transform: none; }
    .burger { display: none; }
}

.app__main { padding: calc(var(--header) + 1rem) 1rem 2rem; }
@media (min-width: 900px) {
    .app__main { padding-left: calc(var(--sidebar) + 1.5rem); padding-right: 1.5rem; }
}

/* Nav */
.nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.nav__link { display: block; padding: .6rem .75rem; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav__link:hover { background: #f1f3f8; text-decoration: none; }
.nav__link.active { background: #eaf1ff; color: var(--primary-dark); }

/* Burger */
.burger { background: none; border: 0; width: 36px; height: 36px; display: grid; place-items: center;
    cursor: pointer; padding: 0; border-radius: 6px; }
.burger:hover { background: #f1f3f8; }
.burger span { display: block; width: 18px; height: 2px; background: var(--text); margin: 2px 0; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-weight: 500; font-size: .875rem; }
.field input, .field textarea, .field select {
    padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 8px;
    font: inherit; background: var(--surface); width: 100%;
}
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px #2563eb22;
}
.field textarea { min-height: 120px; resize: vertical; }
.field__help { color: var(--muted); font-size: .8rem; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 640px) { .field--row { grid-template-columns: 1fr; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1rem; border-radius: 8px; border: 1px solid transparent;
    background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
    text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: transparent; color: var(--muted); }
.btn--ghost:hover { background: #f1f3f8; color: var(--text); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #b91c1c; }
.btn--success { background: var(--success); color: #fff; }
.btn--secondary { background: #f1f3f8; color: var(--text); }
.btn--secondary:hover { background: #e5e7eb; }
.btn--block { width: 100%; }
.btn--sm { padding: .35rem .7rem; font-size: .85rem; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* Cards / sections */
.page { display: flex; flex-direction: column; gap: 1rem; max-width: 1200px; }
.page__head { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.page__head h1 { margin: 0; font-size: 1.4rem; }
.page__actions { margin-left: auto; display: flex; gap: .5rem; }

.card { background: var(--surface); padding: 1.25rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.grid { display: grid; gap: 1rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.stat { background: var(--surface); padding: 1.1rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.stat__label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.stat__value { font-size: 1.75rem; font-weight: 700; margin-top: .25rem; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; min-width: 600px; }
.table th, .table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #fafbfc; font-weight: 600; font-size: .85rem; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table .actions { display: flex; gap: .4rem; justify-content: flex-end; }

/* Flash */
.flashes { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.flash { padding: .65rem .9rem; border-radius: 8px; font-size: .9rem; border: 1px solid transparent; }
.flash--error { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
.flash--success { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.flash--info { background: #dbeafe; color: #1e3a8a; border-color: #bfdbfe; }
.flash--warning { background: #fef3c7; color: #78350f; border-color: #fde68a; }

/* Badges */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge--ok { background: #dcfce7; color: #14532d; }
.badge--pending { background: #fef3c7; color: #78350f; }
.badge--ko { background: #fee2e2; color: #7f1d1d; }
.badge--muted { background: #f1f3f8; color: var(--muted); }

/* Utils */
.inline { display: inline; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt { margin-top: 1rem; }
.sep { height: 1px; background: var(--border); margin: 1rem 0; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.photo-grid__item { position: relative; border-radius: 8px; overflow: hidden; background: #f1f3f8; aspect-ratio: 1/1; }
.photo-grid__item img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid__item .remove { position: absolute; top: 4px; right: 4px; }

.split { display: grid; grid-template-columns: 1fr 320px; gap: 1rem; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

pre.log { background: #0b0f17; color: #e5e7eb; padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: .8rem; }
