:root { --navy: #0b2545; --teal: #0f766e; --gold: #f2c14e; --line: #e2e8f0; --muted: #64748b; --bg: #f1f5f9; --danger: #dc2626; }
* { box-sizing: border-box; }
body.admin { margin: 0; font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #0f172a; background: var(--bg); display: flex; min-height: 100vh; }
a { color: var(--teal); }
code { background: #e2e8f0; padding: 0 .3em; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
h1 { font-size: 1.6rem; margin: 0 0 1.2rem; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; }

.admin-side { width: 240px; flex-shrink: 0; background: var(--navy); color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.admin-brand { display: flex; align-items: center; gap: .6rem; padding: 1.2rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-brand img { width: 38px; height: 38px; background: #fff; border-radius: 8px; padding: 2px; }
.admin-brand small { display: block; font-weight: 400; font-size: .75rem; color: var(--gold); letter-spacing: .1em; text-transform: uppercase; }
.admin-side nav { display: flex; flex-direction: column; padding: .8rem; gap: 2px; flex: 1; overflow: auto; }
.admin-side nav a { color: #cbd5e1; text-decoration: none; padding: .6rem .8rem; border-radius: 8px; }
.admin-side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-side nav a.is-active { background: var(--gold); color: var(--navy); font-weight: 600; }
.admin-side__foot { padding: 1rem 1.2rem; border-top: 1px solid rgba(255,255,255,.08); display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; }
.admin-side__foot a, .admin-side__foot .linkish { color: #cbd5e1; }
.admin-main { flex: 1; padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; min-width: 0; max-width: 1200px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem; margin-bottom: 1.2rem; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.alert { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert--success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.alert--error { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }
.alert--info { background: #ecfeff; border: 1px solid #a5f3fc; color: #164e63; }

.btn { display: inline-flex; align-items: center; gap: .4rem; background: var(--navy); color: #fff; border: 0; padding: .6rem 1.1rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: #13355f; color: #fff; }
.btn--ghost { background: transparent; color: var(--navy); border: 1px solid #cbd5e1; }
.btn--ghost:hover { background: #fff; color: var(--navy); }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #b91c1c; }
.linkish { background: none; border: 0; padding: 0; color: var(--teal); cursor: pointer; font: inherit; text-decoration: underline; }
.linkish.danger, .danger { color: var(--danger); }

.form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; margin-bottom: .9rem; }
.form label.inline { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
.form small { display: block; margin: -.5rem 0 1rem; }
.form fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin: 0 0 1rem; min-width: 0; }
.form legend { font-weight: 700; padding: 0 .4rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=month], input[type=url], select, textarea {
  font: inherit; font-weight: 400; padding: .55rem .7rem; border: 1px solid #cbd5e1; border-radius: 8px; width: 100%; background: #fff; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1.2rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 1rem 0; }
.narrow-form { max-width: 520px; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.table tr.is-hidden td { opacity: .55; }
.table form { display: inline; }
.nowrap { white-space: nowrap; }
.actions-cell a { margin-right: .7rem; }
.badge { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: #e2e8f0; color: #334155; font-weight: 600; }
.badge--soft { background: #ecfeff; color: #0e7490; }
.badge--ok { background: #dcfce7; color: #166534; }
.badge--bad { background: #fee2e2; color: #991b1b; }
.pill { border: 1px solid #cbd5e1; background: #fff; border-radius: 999px; padding: .15rem .7rem; font: inherit; font-size: .82rem; cursor: pointer; color: var(--muted); }
.pill--on { background: #dcfce7; border-color: #86efac; color: #166534; font-weight: 600; }
.lead-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem; text-decoration: none; color: inherit; }
.tile strong { display: block; font-size: 2rem; color: var(--navy); }
.tile span { color: var(--muted); }
.howto { margin: 0; padding-left: 1.2rem; display: grid; gap: .6rem; }

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs a { padding: .45rem .9rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: #334155; font-size: .9rem; }
.tabs a.is-active { background: var(--navy); color: #fff; border-color: var(--navy); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.thumbs figure { margin: 0; text-align: center; }
.thumbs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; margin-bottom: .3rem; }
.album-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.album-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; padding-bottom: .8rem; }
.album-card img, .album-card__empty { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: #e2e8f0; display: grid; place-items: center; color: var(--muted); margin-bottom: .6rem; }
.album-card strong, .album-card span { padding: 0 .9rem; }
.danger-zone { margin-top: 2rem; }

.mailboxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.mailbox { margin-bottom: 0; display: flex; flex-direction: column; }
.mailbox h2 { margin: .8rem 0 .3rem; word-break: break-all; }
.mailbox p { flex: 1; margin: 0 0 1rem; }
.mailbox .actions form { display: inline; }

.table-scroll { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-bottom: .8rem; }
.table-scroll--tall { max-height: 360px; }
.table-scroll .table thead th { position: sticky; top: 0; background: #fff; z-index: 1; }
.placeholders { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: -.4rem 0 .6rem; font-size: .88rem; }
.mail-preview { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 8px; background: #f1f5f9; margin-bottom: 1rem; }
.progress { height: 12px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-bottom: .6rem; }
.progress__bar { height: 100%; background: linear-gradient(90deg, var(--teal), #22c55e); transition: width .4s; }
.form fieldset[disabled] { opacity: .75; }
.actions form { display: inline; }
.toolbar { display: inline-flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.toolbar__check { display: inline-flex; align-items: center; gap: .3rem; font-size: .9rem; color: var(--muted); }
.mailbox__icon { width: 44px; height: 44px; border-radius: 12px; background: var(--navy); color: var(--gold); display: grid; place-items: center; }
.mailbox__icon svg { width: 22px; height: 22px; }

.slide-card { display: grid; grid-template-columns: 280px 1fr; gap: 1.2rem; }
.slide-card > img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; }
.slide-tools { display: flex; gap: 1rem; }
.slide-tools form { display: inline; }

.dl { display: grid; grid-template-columns: 220px 1fr; gap: .4rem 1rem; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

.login-card { max-width: 380px; margin: 8vh auto; background: #fff; padding: 2rem; border-radius: 16px; border: 1px solid var(--line); box-shadow: 0 20px 50px -20px rgba(11,37,69,.3); display: flex; flex-direction: column; gap: .8rem; text-align: center; }
.login-card img { margin: 0 auto; }
.login-card label { display: flex; flex-direction: column; gap: .3rem; text-align: left; font-weight: 600; font-size: .9rem; }
.login-card .btn { justify-content: center; }
body.admin:not(:has(.admin-side)) .admin-main { max-width: none; }
body.admin:not(:has(.admin-side)) h1 { display: none; }

@media (max-width: 800px) {
  body.admin { flex-direction: column; }
  .admin-side { width: 100%; height: auto; position: static; }
  .admin-side nav { flex-direction: row; flex-wrap: wrap; }
  .slide-card { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
}
@media print {
  .admin-side, .actions, form[data-confirm] { display: none !important; }
  body.admin { background: #fff; }
}
