:root {
  --bg: #080808;
  --panel: #111214;
  --panel-2: #18191c;
  --line: #2a2b2f;
  --text: #f5f5f5;
  --muted: #a7a8ad;
  --red: #e10613;
  --red-2: #ff2833;
  --green: #42d392;
  --amber: #f5b942;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% 0%, #260307 0, transparent 32rem), var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; left: 1rem; top: -5rem; padding: .75rem 1rem; color: white; background: var(--red); border-radius: .5rem; }
.skip-link:focus { top: 1rem; }
.eyebrow { margin: 0 0 .45rem; color: var(--red-2); font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.muted { color: var(--muted); }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 7vw, 7rem); overflow: hidden; border-right: 1px solid rgba(255,255,255,.08); }
.login-brand::before { content: ""; position: absolute; inset: 0; z-index: -2; background: linear-gradient(90deg, rgba(0,0,0,.52), rgba(0,0,0,.92)), url("assets/taller-vertical.png") center/cover; filter: saturate(.85); }
.login-brand::after { content: ""; position: absolute; z-index: -1; width: 28rem; height: 28rem; right: -12rem; bottom: -12rem; border: 1px solid rgba(225,6,19,.45); transform: rotate(45deg); box-shadow: 0 0 70px rgba(225,6,19,.24); }
.login-logo { width: min(31rem, 78%); height: auto; object-fit: contain; object-position: left; margin-bottom: 3.5rem; filter: drop-shadow(0 14px 30px rgba(0,0,0,.65)); }
.login-brand h1 { max-width: 14ch; margin: 0; font-size: clamp(2.6rem, 5vw, 5.8rem); line-height: .95; letter-spacing: -.045em; text-transform: uppercase; }
.lead { max-width: 42rem; margin: 1.5rem 0 2rem; color: #d1d1d4; font-size: clamp(1rem, 1.6vw, 1.3rem); line-height: 1.65; }
.login-points { display: flex; flex-wrap: wrap; gap: .65rem; }
.login-points span { padding: .65rem .85rem; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(8,8,8,.56); color: #ddd; font-size: .86rem; }
.login-card { align-self: center; width: min(28rem, calc(100% - 3rem)); margin: 2rem auto; display: grid; gap: 1.2rem; padding: clamp(1.5rem, 4vw, 2.5rem); border: 1px solid var(--line); border-radius: 24px; background: rgba(17,18,20,.92); box-shadow: 0 30px 70px rgba(0,0,0,.45); }
.login-card h2 { margin: 0; font-size: 1.75rem; }
.login-card label { display: grid; gap: .5rem; color: #d9d9dc; font-weight: 700; font-size: .9rem; }
input, textarea, select { width: 100%; color: var(--text); background: #090a0b; border: 1px solid #35363b; border-radius: 12px; padding: .88rem 1rem; outline: none; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--red-2); box-shadow: 0 0 0 3px rgba(225,6,19,.18); }
.button { min-height: 44px; border-radius: 12px; border: 1px solid transparent; padding: .72rem 1rem; font-weight: 800; }
.button.primary { color: white; background: linear-gradient(135deg, var(--red-2), #aa0009); box-shadow: 0 9px 25px rgba(225,6,19,.24); }
.button.secondary { color: white; background: var(--panel-2); border-color: var(--line); }
.button:hover { filter: brightness(1.12); }
.full { width: 100%; }
.form-message { min-height: 1.25rem; margin: 0; color: #ff8d93; font-size: .9rem; }
.support-copy { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: auto 1fr; }
.sidebar { position: sticky; top: 0; grid-row: 1 / 3; height: 100vh; display: flex; flex-direction: column; padding: 1.1rem; border-right: 1px solid var(--line); background: rgba(10,10,11,.97); z-index: 20; }
.brand-row { display: flex; align-items: center; gap: .8rem; padding: .4rem .4rem 1.5rem; }
.brand-mark { width: 48px; height: 48px; object-fit: contain; }
.brand-row div { display: grid; }
.brand-row strong { font-size: .9rem; letter-spacing: .04em; }
.brand-row span { color: var(--muted); font-size: .76rem; }
.nav-list { display: grid; gap: .25rem; }
.nav-list button { display: grid; grid-template-columns: 26px 1fr; align-items: center; gap: .7rem; width: 100%; border: 0; border-radius: 10px; padding: .72rem .8rem; color: #c6c7cb; background: transparent; text-align: left; font-weight: 700; }
.nav-list button span { display: grid; place-items: center; color: #8e8f94; }
.nav-list button:hover { background: #17181a; color: white; }
.nav-list button.active { color: white; background: linear-gradient(90deg, rgba(225,6,19,.28), rgba(225,6,19,.04)); box-shadow: inset 3px 0 var(--red-2); }
.nav-list button.active span { color: var(--red-2); }
.sidebar-foot { margin-top: auto; display: grid; gap: .7rem; padding: .8rem .4rem; }
.environment { color: #bfc0c4; font-size: .75rem; }
.environment i { display: inline-block; width: 8px; height: 8px; margin-right: .35rem; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.text-button { width: max-content; border: 0; padding: 0; color: #f1a2a7; background: transparent; font-weight: 700; }
.topbar { min-height: 82px; display: flex; align-items: center; gap: 1rem; padding: 1rem 2rem; border-bottom: 1px solid var(--line); background: rgba(8,8,8,.86); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10; }
.topbar h1 { margin: 0; font-size: 1.45rem; }
.user-chip { margin-left: auto; display: flex; align-items: center; gap: .65rem; }
.user-chip > span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: white; background: linear-gradient(145deg, var(--red), #6c0006); font-weight: 900; }
.user-chip div { display: grid; }
.user-chip small { color: var(--muted); text-transform: capitalize; }
.icon-button { border: 1px solid var(--line); border-radius: 10px; color: white; background: var(--panel); min-width: 42px; min-height: 42px; }
.menu-button { display: none; }
.main-content { width: 100%; max-width: 1500px; margin: 0 auto; padding: 1.4rem 2rem 3rem; }
.toolbar { display: flex; gap: .8rem; margin-bottom: 1.1rem; }
.search-field { flex: 1; position: relative; }
.search-field > span:first-child { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-field input { padding-left: 2.4rem; background: var(--panel); }
.notice { margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid rgba(245,185,66,.35); border-radius: 12px; color: #f7d793; background: rgba(245,185,66,.08); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(160deg, rgba(25,26,29,.96), rgba(13,14,15,.96)); }
.metric { min-height: 132px; display: grid; align-content: space-between; padding: 1rem; }
.metric span { color: var(--muted); font-size: .85rem; }
.metric strong { font-size: 2rem; }
.metric small { color: #c8c9cc; }
.metric.danger { border-color: rgba(225,6,19,.55); box-shadow: inset 0 -2px rgba(225,6,19,.3); }
.panel { overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 1rem; }
.panel-head span { color: var(--muted); font-size: .8rem; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: .8rem 1rem; border-bottom: 1px solid #242529; text-align: left; vertical-align: middle; }
th { color: #aeb0b5; background: #121315; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; position: sticky; top: 0; }
td { color: #e3e3e5; font-size: .88rem; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255,255,255,.018); }
.badge { display: inline-flex; align-items: center; min-height: 25px; padding: .25rem .55rem; border: 1px solid #414249; border-radius: 999px; color: #d5d6d8; background: #202125; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.badge.ok { color: #93e5bd; border-color: rgba(66,211,146,.35); background: rgba(66,211,146,.1); }
.badge.warn { color: #f5d18b; border-color: rgba(245,185,66,.35); background: rgba(245,185,66,.09); }
.badge.bad { color: #ff9ca1; border-color: rgba(225,6,19,.45); background: rgba(225,6,19,.1); }
.money { font-variant-numeric: tabular-nums; font-weight: 800; }
.period-form { display: flex; align-items: end; gap: 1rem; padding: 1rem; margin-bottom: 1rem; }
.period-form label, .editor-card label, .gallery-form label { display: grid; gap: .45rem; color: #d9d9dc; font-size: .82rem; font-weight: 800; }
.period-form label { flex: 1; }
.financial-metrics { margin-top: 0; }
.financial-panel { margin-top: 1rem; }
.financial-lines { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.financial-lines > div { display: grid; gap: .55rem; padding: 1.25rem; border-right: 1px solid var(--line); }
.financial-lines > div:last-child { border-right: 0; }
.financial-lines span { color: var(--muted); font-size: .8rem; }
.financial-lines strong { font-size: 1.25rem; }
.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.editor-card { padding-bottom: 1rem; }
.editor-card > .button { margin: 1rem 1rem 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 1rem; }
.form-grid.one-column { grid-template-columns: 1fr; }
.form-grid .wide { grid-column: 1 / -1; }
.editor-preview { width: 100%; max-height: 330px; object-fit: cover; border: 1px solid var(--line); border-radius: 14px; background: #090909; }
.gallery-panel { margin-top: 1rem; }
.gallery-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 1rem; align-items: end; padding: 1rem; border-bottom: 1px solid var(--line); }
.gallery-admin-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; padding: 1rem; }
.gallery-admin-grid article { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #0c0d0e; }
.gallery-admin-grid img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.gallery-admin-grid article div { display: flex; justify-content: space-between; gap: .7rem; align-items: center; padding: .75rem; }
.gallery-admin-grid article span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d9d9db; font-size: .8rem; }
.empty, .loading { min-height: 230px; display: grid; place-items: center; padding: 2rem; color: var(--muted); text-align: center; }
.loading::before { content: ""; width: 30px; height: 30px; border: 3px solid #333; border-top-color: var(--red-2); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 48vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-logo { width: min(25rem, 70%); margin-bottom: 2rem; }
  .editor-grid { grid-template-columns: 1fr; }
  .financial-lines { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 88vw); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.55); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: inline-grid; place-items: center; }
  .topbar { padding: .75rem 1rem; }
  .topbar .eyebrow { display: none; }
  .user-chip div { display: none; }
  .main-content { padding: 1rem; }
  .toolbar { align-items: stretch; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 112px; }
  .metric strong { font-size: 1.6rem; }
  .period-form, .gallery-form { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
  .period-form label { width: 100%; }
}

@media (max-width: 520px) {
  .login-brand { min-height: 420px; padding: 1.5rem; }
  .login-brand h1 { font-size: 2.65rem; }
  .login-points span:nth-child(3) { display: none; }
  .login-card { width: calc(100% - 2rem); margin: 1rem; }
  .metrics { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
  .form-grid, .financial-lines, .gallery-admin-grid { grid-template-columns: 1fr; }
  .financial-lines > div { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
