:root {
  --red: #ef4d5a;
  --red-dark: #d83c49;
  --ink: #172033;
  --muted: #718096;
  --line: #e7eaf0;
  --surface: #ffffff;
  --background: #f5f7fb;
  --green: #21a66b;
  --shadow: 0 12px 35px rgba(26, 34, 55, .08);
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--background); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; }
a { color: var(--red-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.75rem, 3vw, 2.45rem); margin-bottom: .4rem; }
h2 { font-size: 1.05rem; }
small, .muted { display: block; color: var(--muted); }
code { font-size: .86em; background: #f0f2f7; padding: .2rem .35rem; border-radius: .3rem; }

.app-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.landing-card, .login-panel { width: min(680px, 100%); padding: clamp(2rem, 6vw, 4rem); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.landing-card h1 { max-width: 16ch; margin-top: 2rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); font-size: 1.15rem; font-weight: 800; }
.brand:hover { text-decoration: none; }
.brand-large { font-size: 1.5rem; }
.brand-mark { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50% 50% 45% 45%; background: var(--red); color: white; }
.public-image { width: 100%; max-height: 600px; object-fit: cover; border-radius: 18px; }

.admin-body { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.5rem; border-right: 1px solid var(--line); background: var(--surface); }
.sidebar-nav { display: grid; gap: .3rem; margin: 2rem 0; }
.sidebar-nav a { padding: .72rem .85rem; border-radius: 10px; color: #47506a; font-weight: 620; }
.sidebar-nav a:hover { background: #fff0f1; color: var(--red-dark); text-decoration: none; }
.sidebar-user { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.sidebar-user .button { margin-top: .8rem; width: 100%; }
.admin-main { width: 100%; max-width: 1480px; padding: clamp(1.25rem, 3vw, 3rem); overflow: hidden; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.eyebrow { margin-bottom: .25rem; color: var(--red-dark); font-size: .74rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat-card, .panel, .content-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 5px 18px rgba(26, 34, 55, .035); }
.stat-card { padding: 1.2rem; }
.stat-card span { display: block; color: var(--muted); font-size: .77rem; text-transform: uppercase; letter-spacing: .06em; }
.stat-card strong { display: block; margin-top: .5rem; font-size: 2rem; }
.panel { padding: 1.3rem; margin-bottom: 1rem; }
.panel-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); margin: -.1rem 0 .3rem; padding-bottom: .75rem; }
.split-grid, .detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.row-link { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem .2rem; border-bottom: 1px solid var(--line); color: var(--ink); }
.row-link:hover { color: var(--red-dark); text-decoration: none; }
.row-link:last-child { border-bottom: 0; }
.row-link time { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.empty-state { padding: 1rem 0 0; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: .65rem; margin-bottom: 1rem; }
input, select, textarea { width: 100%; border: 1px solid #cfd5e1; border-radius: 9px; background: white; color: var(--ink); font: inherit; padding: .7rem .8rem; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(239, 77, 90, .14); border-color: var(--red); }
.filters input, .filters select { width: auto; min-width: 180px; }
.stack-form { display: grid; gap: 1rem; }
.stack-form label { display: grid; gap: .4rem; font-size: .84rem; font-weight: 700; }
.narrow-form { max-width: 680px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.check-label { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }
.check-label input { width: auto; }

.button { display: inline-flex; align-items: center; justify-content: center; width: auto; border: 1px solid #cfd5e1; border-radius: 9px; background: white; color: var(--ink); cursor: pointer; font-weight: 750; padding: .68rem 1rem; }
.button:hover { text-decoration: none; border-color: var(--red); }
.button-primary { border-color: var(--red); background: var(--red); color: white; }
.button-primary:hover { background: var(--red-dark); }
.button-danger { border-color: #dc3343; background: #dc3343; color: white; }
.button-success { border-color: var(--green); background: var(--green); color: white; }
.button-ghost { background: transparent; }

.flash { border-radius: 10px; margin-bottom: 1rem; padding: .85rem 1rem; }
.flash-success { background: #e7f8f0; color: #12633e; }
.flash-error { background: #fff0f1; color: #9b2430; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; background: color-mix(in srgb, var(--badge-color, #718096) 12%, white); color: var(--badge-color, #596277); font-size: .74rem; font-weight: 800; padding: .25rem .55rem; }
.badge-active { --badge-color: var(--green); }
.badge-suspended, .badge-deleted { --badge-color: #d52d3e; }
.badge-deletion_pending { --badge-color: #d08119; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .07em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
td small { margin-top: .15rem; }
.card-list { display: grid; gap: .8rem; }
.content-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem; color: var(--ink); }
.content-card:hover { border-color: #efb3b9; text-decoration: none; }
.content-card h2 { margin: .55rem 0 .3rem; }
.content-card p { margin: 0; color: var(--muted); }
.content-metrics { display: flex; gap: .7rem; align-items: center; white-space: nowrap; }
.definition-list { display: grid; grid-template-columns: minmax(110px, .5fr) 1.5fr; gap: .65rem 1rem; }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; }
.danger-zone { border-color: #f3c7cb; }
.admin-media { display: block; max-width: min(700px, 100%); max-height: 520px; margin: 1rem 0; border-radius: 14px; object-fit: contain; }
.comment-row { display: grid; grid-template-columns: 160px 1fr auto; gap: 1rem; padding: .75rem 0; border-top: 1px solid var(--line); }
.comment-row p { margin: 0; }
.comment-row time { color: var(--muted); font-size: .8rem; }
.color-dot { display: block; width: 1rem; height: 1rem; border-radius: 50%; background: var(--dot); }
.login-panel { max-width: 470px; }
.login-panel h1 { margin-top: 1.5rem; }

@media (max-width: 1000px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .split-grid, .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .admin-body { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; padding: 1rem; }
  .sidebar-nav { display: flex; overflow-x: auto; margin: 1rem 0; }
  .sidebar-nav a { white-space: nowrap; }
  .sidebar-user { display: none; }
  .admin-main { padding: 1rem; }
  .page-header, .content-card { align-items: stretch; flex-direction: column; }
  .comment-row { grid-template-columns: 1fr; gap: .25rem; }
  .form-grid { grid-template-columns: 1fr; }
}
