/* Autología: the approved M1 mockups (docs/disenos/m1-inventario/) as tokens and classes.
   Templates use these classes only, never inline styles. Review changes at /muestras/. */

:root {
  --background: #f6f6f4;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #55554f;
  --border: #e4e4e0;
  --field-border: #d6d6d0;
  --dashed: #c9c9c2;
  --divider: #efefeb;
  --placeholder: #e7e7e2;
  --accent: #1d4ed8;
  --accent-hover: #1e3a8a;
  --on-accent: #ffffff;
  --warning: #8a3b00;
  --warning-bg: #fff7ef;
  --warning-border: #f3cfa6;
  --warning-tag: #fde9d4;
  --warning-bar: #d9822b;
  --ok: #1f6b3a;
  --danger: #b42318;
  --radius-card: 14px;
  --radius-field: 10px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #121212;
    --card: #1c1c1b;
    --text: #ededea;
    --muted: #a8a8a0;
    --border: #2e2e2b;
    --field-border: #3a3a36;
    --dashed: #4a4a45;
    --divider: #262624;
    --placeholder: #2a2a27;
    --accent: #6d95f5;
    --accent-hover: #9db8f8;
    --on-accent: #0b1220;
    --warning: #f0a463;
    --warning-bg: #2a1d10;
    --warning-border: #5c3a17;
    --warning-tag: #3d2810;
    --warning-bar: #d9822b;
    --ok: #6fcf97;
    --danger: #f48b80;
  }
}

* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 var(--font); background: var(--background); color: var(--text); }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1 { margin: 0; font-size: 24px; font-weight: 700; }
p { margin: 0; }

/* Layout */
.page { max-width: 640px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-tight { display: flex; flex-direction: column; gap: 4px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.actions { display: flex; gap: 8px; }
.actions > * { flex: 1; }
.media { display: flex; gap: 14px; align-items: center; }
.media > .stack-tight { min-width: 0; }
.bottom-action { margin-top: auto; padding-top: 8px; }

/* Header */
.site-header { display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 64px;
  background: var(--card); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.site-header .brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; margin-right: auto; }
.site-header nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.site-header nav a { min-height: 44px; padding: 0 10px; display: flex; align-items: center;
  font-size: 14px; color: var(--muted); text-decoration: none; }
.site-header nav a.active { color: var(--text); font-weight: 600; }
.site-header .who { font-size: 13px; color: var(--muted); padding: 0 6px; }
.back-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--card); border-bottom: 1px solid var(--border); }
.back-header .title { font-weight: 600; font-size: 16px; }
.back-header .end { margin-left: auto; }
.icon-button { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  color: var(--text); border: 0; background: transparent; }
.icon-button svg { stroke: currentColor; }

/* Text */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.big { font-size: 18px; font-weight: 700; }
.huge { font-size: 22px; font-weight: 700; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.text-ok { color: var(--ok); font-weight: 500; }
.text-warning { color: var(--warning); font-weight: 600; }
.text-danger { color: var(--danger); font-weight: 600; }
.nowrap { white-space: nowrap; }

/* Cards */
.card { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius-card); color: var(--text); text-decoration: none; }
a.card:hover { color: var(--text); border-color: var(--field-border); }
.card-warning { background: var(--warning-bg); border-color: var(--warning-border); }
.card-warning .section-title { color: var(--warning); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-empty { padding: 18px; border: 1px dashed var(--dashed); border-radius: var(--radius-card);
  font-size: 14px; color: var(--muted); text-align: center; }

/* Rows inside a card */
.rows { display: flex; flex-direction: column; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--divider); color: var(--text); text-decoration: none; font-size: 14px; }
.row:last-child { border-bottom: 0; }
a.row:hover { color: var(--text); }
.row .main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.thumb { width: 44px; height: 44px; border-radius: 8px; background: var(--placeholder); flex-shrink: 0; }
.thumb-empty { background: transparent; border: 1px dashed var(--dashed); }
.photo { width: 84px; height: 64px; border-radius: var(--radius-field); background: var(--placeholder);
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); flex-shrink: 0; }

/* Data grid */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; font-size: 14px; margin: 0; }
.fields > div { display: flex; flex-direction: column; gap: 2px; }
.fields dt { color: var(--muted); font-size: 12px; }
.fields dd { margin: 0; }
.fields .wide { grid-column: span 2; }
.subsection { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--divider); }

/* Tags and status line */
.tag { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 8px; }
.tag-warning { background: var(--warning-tag); color: var(--warning); }
.tag-neutral { background: var(--divider); color: var(--text); }
.status-line { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.status-line span { height: 6px; border-radius: 3px; background: var(--border); }
.status-line span.done { background: var(--text); }
.status-line span.current { background: var(--warning-bar); }

/* Buttons and chips */
.button { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--field-border);
  background: var(--card); color: var(--text); font: inherit; font-size: 14px; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px; text-decoration: none; cursor: pointer; }
.button:hover { color: var(--text); border-color: var(--muted); }
.button-tall { min-height: 44px; font-weight: 600; border-radius: var(--radius-field); }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.button-primary:hover { color: var(--on-accent); background: var(--accent-hover); border-color: var(--accent-hover); }
.button-block { width: 100%; min-height: 48px; border-radius: 12px; font-size: 16px; }
.button-dashed { border-style: dashed; border-color: var(--dashed); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--field-border);
  background: var(--card); color: var(--text); font-size: 14px; display: inline-flex; align-items: center; text-decoration: none; }
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--background); }
details.more > summary { list-style: none; cursor: pointer; }
details.more > summary::-webkit-details-marker { display: none; }
details.more[open] { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { min-height: 44px; border: 1px solid var(--field-border);
  border-radius: var(--radius-field); padding: 0 14px; font: inherit; font-size: 15px; background: var(--card); color: var(--text); }
.field textarea { padding: 10px 14px; }
.field select { padding: 0 10px; }
.field input[type="checkbox"] { min-height: auto; width: 20px; height: 20px; }
.field-check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 15px; }
.field-amount input { min-height: 52px; font-size: 22px; font-weight: 700; }
.field .help { font-size: 12px; }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 13px; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--field-border);
  border-radius: var(--radius-field); overflow: hidden; background: var(--card); }
.segmented label { min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--muted); cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { color: var(--background); }
.segmented label:has(input:checked) { background: var(--text); color: var(--background); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Messages */
.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.messages li { padding: 12px 14px; border-radius: var(--radius-field); background: var(--card); border: 1px solid var(--border); font-size: 14px; }

/* Samples page (/muestras/) */
.samples { display: flex; gap: 32px; overflow-x: auto; padding: 24px; }
.sample { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; margin: 0; }
.sample iframe { width: 390px; height: 844px; border: 1px solid var(--border); border-radius: 24px; background: var(--background); }
