/* Design system Timaná — generador DIAN
   Se amplía el ancho máximo respecto a las apps de postcosecha porque esta es una
   herramienta de escritorio con tablas de muchas columnas: 680px haría ilegible la
   grilla de 13 campos.

   PENDIENTE — deriva respecto a postcosecha/assets/tokens.css: coinciden los tokens
   de marca y superficie (--turquoise, --deep-green, --bg, --surface) pero difieren
   nombre y/o valor en el resto:
     --muted  #6B7A80  vs  --text3         #5C7068
     --border #E2DDD6  vs  --border        #D4E8E4
     --text   #1F2A2E  vs  --text          #1F1F1F
     --error  #C0392B  vs  --red           #F15A62
     --warn   #B8860B  vs  --yellow        #E8A020
     --ok     #2E7D5B  vs  --green-success #2E7D32
     --radius 8px      vs  --r             8px
   Unificar contra tokens.css cambia el aspecto de una UI ya probada, así que queda
   como decisión aparte. Ver dian-api/README.md. */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
  --turquoise: #16BECF;
  --deep-green: #356856;
  --bg: #F5F2EE;
  --surface: #FFFFFF;
  --text: #1F2A2E;
  --muted: #6B7A80;
  --border: #E2DDD6;
  --error: #C0392B;
  --error-bg: #FDF0EE;
  --warn: #B8860B;
  --warn-bg: #FDF8E9;
  --ok: #2E7D5B;
  --ok-bg: #EDF7F2;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(31, 42, 46, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Montserrat', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }
.wrap-narrow { max-width: 680px; }

/* ---------- Encabezado ---------- */
header.top {
  background: var(--deep-green);
  color: #fff;
  padding: 14px 20px;
}
header.top .inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
header.top h1 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: 0.2px; }
header.top .sub { font-size: 12px; color: #BFD8CE; font-weight: 500; }
nav.tabs { margin-left: auto; display: flex; gap: 4px; }
nav.tabs a {
  color: #DCEDE5; text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius);
}
nav.tabs a:hover { background: rgba(255,255,255,0.1); }
nav.tabs a.active { background: var(--turquoise); color: #08343B; font-weight: 600; }

/* ---------- Tarjetas ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--deep-green); margin: 0 0 14px; font-weight: 700;
}
.step { display: flex; align-items: baseline; gap: 8px; }
.step .n {
  background: var(--turquoise); color: #08343B; font-weight: 700; font-size: 11px;
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}

/* ---------- Formularios ---------- */
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.grow { flex: 1 1 200px; }
label { font-size: 12px; font-weight: 600; color: var(--muted); }
input, select, textarea, button {
  font-family: inherit; font-size: 14px;
}
input, select, textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--turquoise);
  outline-offset: -1px;
  border-color: var(--turquoise);
}
input[readonly] { background: #F7F5F2; color: var(--muted); }
textarea { resize: vertical; min-height: 130px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; }
.hint { font-size: 11px; color: var(--muted); }

button {
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 600; cursor: pointer; background: var(--turquoise); color: #08343B;
}
button:hover:not(:disabled) { filter: brightness(1.06); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary { background: #fff; border-color: var(--border); color: var(--text); }
button.ghost { background: transparent; border-color: transparent; color: var(--deep-green); text-decoration: underline; padding: 4px 6px; }
button.danger { background: var(--error); color: #fff; }

/* ---------- Mensajes ---------- */
.msg { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 13px; }
.msg.error { background: var(--error-bg); border: 1px solid #F0C6C0; color: var(--error); }
.msg.warn  { background: var(--warn-bg);  border: 1px solid #EAD9A0; color: #7A5C08; }
.msg.ok    { background: var(--ok-bg);    border: 1px solid #B9DFCC; color: var(--ok); }
.msg ul { margin: 6px 0 0; padding-left: 18px; }
.msg li { margin-bottom: 3px; }
.msg b { font-weight: 700; }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th {
  background: var(--deep-green); color: #fff; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.3px;
  padding: 8px 10px; text-align: left; white-space: nowrap; position: sticky; top: 0;
}
td { padding: 7px 10px; border-top: 1px solid var(--border); white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.fila-error td { background: var(--error-bg); }
tr.fila-warn td { background: var(--warn-bg); }
tbody tr:hover td { background: #F7FBFB; }
td.linea { color: var(--muted); font-weight: 600; text-align: right; }

/* ---------- Totales ---------- */
.totales { display: flex; gap: 28px; flex-wrap: wrap; padding: 14px 0 2px; }
.total .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); font-weight: 600; }
.total .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Menú de inicio ---------- */
.menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.menu a {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.menu a:hover { border-color: var(--turquoise); }
.menu .t { font-weight: 700; font-size: 15px; margin-bottom: 4px; color: var(--deep-green); }
.menu .d { font-size: 12.5px; color: var(--muted); }

/* ---------- Login ---------- */
.login { max-width: 340px; margin: 12vh auto; }
.login .card { text-align: center; }
.login input { text-align: center; font-size: 22px; letter-spacing: 6px; width: 100%; }

.oculto { display: none !important; }

@media (max-width: 640px) {
  nav.tabs { width: 100%; margin-left: 0; overflow-x: auto; }
  .wrap { padding: 16px 12px 48px; }
}
