@font-face { font-family: "Gloock"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/gloock-latin.woff2") format("woff2"); }
@font-face { font-family: "Karla"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("../fonts/karla-latin-var.woff2") format("woff2"); }

/* Panel: mismo mundo que el menu publico (manta, tinta de comal, hoja, maiz, chile). */
:root {
  --manta: #f7f2e8;
  --paper: #fffaf2;
  --ink: #2a1d16;
  --ink-soft: #6b5446;
  --line: #e2d6c3;
  --leaf: #2f5d3a;
  --maize: #d99a1e;
  --chile: #b5452b;
  --chile-deep: #8a2f1a;
  --radius: 14px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --display: "Gloock", Georgia, serif;
  --body: "Karla", system-ui, sans-serif;
  /* alias que usan las vistas */
  --brand: var(--leaf); --muted: var(--ink-soft); --danger: var(--chile); --bg: var(--manta);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: var(--ink-soft) var(--line); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
body { margin: 0; font: 16px/1.5 var(--body); color: var(--ink); background: var(--manta); caret-color: var(--leaf); }
::selection { background: rgba(217, 154, 30, .35); color: var(--ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--line); }
::-webkit-scrollbar-thumb { background: var(--ink-soft); border-radius: 999px; border: 2px solid var(--line); }
:focus-visible { outline: 3px solid var(--maize); outline-offset: 3px; border-radius: 8px; }
a { color: var(--leaf); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--manta); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }

/* Bordado (franja del menu publico, en chile) */
.stitch { position: relative; height: 30px; background-color: var(--chile); }
.stitch::before, .stitch::after { content: ""; position: absolute; inset: 0; background-size: 60px 30px; background-position: center; }
.stitch::before {
  background-color: #fff8ef;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='30' viewBox='0 0 60 30' shape-rendering='crispEdges'%3E%3Cg fill='%23000'%3E%3Crect x='27' y='3' width='3' height='3'/%3E%3Crect x='24' y='6' width='3' height='3'/%3E%3Crect x='30' y='6' width='3' height='3'/%3E%3Crect x='21' y='9' width='3' height='3'/%3E%3Crect x='33' y='9' width='3' height='3'/%3E%3Crect x='18' y='12' width='3' height='3'/%3E%3Crect x='36' y='12' width='3' height='3'/%3E%3Crect x='21' y='15' width='3' height='3'/%3E%3Crect x='33' y='15' width='3' height='3'/%3E%3Crect x='24' y='18' width='3' height='3'/%3E%3Crect x='30' y='18' width='3' height='3'/%3E%3Crect x='27' y='21' width='3' height='3'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='30' viewBox='0 0 60 30' shape-rendering='crispEdges'%3E%3Cg fill='%23000'%3E%3Crect x='27' y='3' width='3' height='3'/%3E%3Crect x='24' y='6' width='3' height='3'/%3E%3Crect x='30' y='6' width='3' height='3'/%3E%3Crect x='21' y='9' width='3' height='3'/%3E%3Crect x='33' y='9' width='3' height='3'/%3E%3Crect x='18' y='12' width='3' height='3'/%3E%3Crect x='36' y='12' width='3' height='3'/%3E%3Crect x='21' y='15' width='3' height='3'/%3E%3Crect x='33' y='15' width='3' height='3'/%3E%3Crect x='24' y='18' width='3' height='3'/%3E%3Crect x='30' y='18' width='3' height='3'/%3E%3Crect x='27' y='21' width='3' height='3'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-mask-size: 60px 30px; mask-size: 60px 30px; -webkit-mask-position: center; mask-position: center;
}
.stitch::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='30' viewBox='0 0 60 30' shape-rendering='crispEdges'%3E%3Cg fill='%23d99a1e'%3E%3Crect x='27' y='12' width='3' height='3'/%3E%3C/g%3E%3Cg fill='%232f5d3a'%3E%3Crect x='3' y='12' width='3' height='3'/%3E%3Crect x='6' y='9' width='3' height='3'/%3E%3Crect x='6' y='15' width='3' height='3'/%3E%3Crect x='51' y='12' width='3' height='3'/%3E%3Crect x='54' y='9' width='3' height='3'/%3E%3Crect x='54' y='15' width='3' height='3'/%3E%3C/g%3E%3C/svg%3E"); }
.stitch.thin { height: 15px; }
.stitch.thin::before, .stitch.thin::after { background-size: 30px 15px; }
.stitch.thin::before { -webkit-mask-size: 30px 15px; mask-size: 30px 15px; }

/* Barra superior */
.top { background: var(--ink); color: var(--manta); padding: 6px 16px 0; }
.top-inner { max-width: 960px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; }
.brand { font: 400 1.35rem/1.2 var(--display); color: var(--manta); padding: 10px 0; margin-right: auto; overflow-wrap: anywhere; }
.top nav { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a, .top nav .link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: var(--manta); text-decoration: none; font: 600 .95rem/1 var(--body); white-space: nowrap; border-bottom: 3px solid transparent; border-radius: 0; transition: background-color .2s var(--ease), border-color .2s var(--ease); }
.top nav a:hover, .top nav .link:hover { background: rgba(247, 242, 232, .1); color: var(--manta); }
.top nav a[aria-current="page"] { border-bottom-color: var(--maize); background: rgba(247, 242, 232, .08); }
.top nav form { display: flex; margin: 0 0 0 10px; padding-left: 10px; border-left: 1px solid rgba(247, 242, 232, .3); }
.top nav .link { color: #f2c9bd; cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; }
.top :focus-visible { outline-offset: -3px; }
.top + .stitch { margin-bottom: 0; }

.wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px 56px; }

/* Tipografia */
h1, h2, h3 { margin-top: 0; }
h1 { font: 400 1.8rem/1.15 var(--display); margin-bottom: 16px; text-wrap: balance; }
h2 { font: 700 1.15rem/1.3 var(--body); margin-bottom: 12px; }
.muted { color: var(--ink-soft); }

/* Tarjetas */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: 0 8px 24px -16px rgba(42, 29, 22, .35); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Formularios */
label { display: block; font-weight: 700; margin: 12px 0 4px; }
label:has(> input[type=checkbox]), label.inline { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; font-weight: 600; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--leaf); margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=file], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; color: var(--ink); background: #fff; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
input[type=file] { padding: 8px 10px; background: var(--paper); }
input[type=file]::file-selector-button { margin-right: 12px; min-height: 30px; border: 1px solid var(--leaf); border-radius: 8px; background: var(--paper); color: var(--leaf); font: 700 .9rem var(--body); padding: 0 12px; cursor: pointer; }
input[type=color] { display: block; width: 100%; min-height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
input[type=time] { min-width: 0; }
td input[type=time] { padding: 9px 6px 9px 8px; font-size: .9rem; }
td:has(> input[type=time]) { padding-left: 4px; padding-right: 4px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--maize); box-shadow: 0 0 0 3px rgba(217, 154, 30, .4); }
::placeholder { color: #85705f; }
img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); }

/* Botones */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; background: var(--leaf); color: #fff; border: 1px solid var(--leaf); border-radius: 10px; padding: 0 18px; font: 700 1rem/1 var(--body); cursor: pointer; text-decoration: none; transition: transform .2s var(--ease), background-color .2s var(--ease), box-shadow .2s var(--ease); }
button:hover, .button:hover { background: #264c2f; color: #fff; }
button:active, .button:active { transform: scale(.97); }
button.secondary, .button.secondary { background: var(--paper); color: var(--leaf); border-color: var(--leaf); }
button.secondary:hover, .button.secondary:hover { background: #eaf0e6; color: var(--leaf); }
button.danger, .button.danger { background: var(--chile); border-color: var(--chile); color: #fff; }
button.danger:hover { background: var(--chile-deep); border-color: var(--chile-deep); }
button.small, .button.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
button:disabled, .button[aria-disabled=true] { opacity: .5; cursor: not-allowed; }
button.link { all: unset; }
.top nav button.link { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; color: #f2c9bd; cursor: pointer; font: 600 .95rem/1 var(--body); white-space: nowrap; border-bottom: 3px solid transparent; }
.top nav button.link:hover { background: rgba(247, 242, 232, .1); }
.top nav button.link:focus-visible { outline: 3px solid var(--maize); outline-offset: -3px; }
.top nav button.link:active { transform: none; }

/* Mensajes */
.flash, .errors { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.flash svg, .errors svg { flex: none; width: 22px; height: 22px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.flash > div, .errors > div { min-width: 0; }
.flash { background: #e4efe3; border: 1px solid #b9d3b8; color: #1f4a2b; }
.errors { background: #f8e1da; border: 1px solid #e8b9ab; color: var(--chile-deep); }
.flash p, .errors p { margin: 2px 0; }

/* Tablas */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font: 700 .75rem/1.2 var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
td { font-variant-numeric: tabular-nums; }
td.actions { display: table-cell; }
td.actions > * { margin: 2px 4px 2px 0; }

/* Etiquetas */
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #efe7d8; color: var(--ink); }
.tag.off { background: #f8e1da; color: var(--chile-deep); }

/* Dashboard */
.bar { height: 12px; background: var(--leaf); border-radius: 999px; }
.stat { font: 400 2rem/1.1 var(--display); color: var(--ink); }

/* Acceso */
.auth { max-width: 400px; margin: 40px auto; }
.auth .stitch { border-radius: var(--radius) var(--radius) 0 0; }
.auth .card { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 22px 20px; margin-bottom: 0; }
.auth h1 { margin-bottom: 8px; }
.auth .card p { margin: 14px 0 0; }
.auth .card button { width: 100%; }

@media (max-width: 560px) {
  .wrap { padding-top: 18px; }
  .card { padding: 14px; }
  .top-inner { gap: 0; }
  .brand { flex-basis: 100%; padding-bottom: 4px; }
  td.actions { display: block; }
  table { display: block; overflow-x: auto; max-width: 100%; }
  td code { white-space: nowrap; }
}
