/* =====================================================================
   Intranet Escuela Básica Pozo Almonte — hoja de estilos
   Paleta institucional: azul #1B3A6B · verde tamarugo #2E7D5B · ocre #E0A526
   ===================================================================== */
:root {
  --primary: #1B3A6B;
  --primary-700: #142c52;
  --primary-50: #EBF0F7;
  --secondary: #2E7D5B;
  --secondary-50: #E8F3EE;
  --accent: #E0A526;
  --accent-50: #FCF4E1;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --danger: #B42318;
  --danger-50: #FEF3F2;
  --success: #067647;
  --success-50: #ECFDF3;
  --warning: #B54708;
  --warning-50: #FFFAEB;
  --info: #175CD3;
  --info-50: #EFF8FF;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --sidebar: 264px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); }
img, svg, video { max-width: 100%; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--secondary); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; color: var(--text); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #111; padding: 8px 14px; border-radius: 6px; z-index: 100; font-weight: 600; }
.skip-link:focus { left: 8px; }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; vertical-align: middle; }

/* ------------------------------------------------------------- Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--primary); color: #DCE5F2; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.brand img { width: 40px; height: 40px; border-radius: 50%; background: #fff; object-fit: contain; }
.brand strong { display: block; color: #fff; font-size: 1rem; }
.brand span { display: block; font-size: .78rem; color: #B9C7DD; line-height: 1.3; }
.sidebar-close { display: none; margin-left: auto; background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; }
.nav { padding: 10px 10px 24px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: #DCE5F2; text-decoration: none; font-size: .93rem; position: relative; }
.nav a span:first-of-type { flex: 1; }
.nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.nav-group { margin: 16px 12px 6px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #95A8C6; font-weight: 600; }
.nav-badge { background: var(--accent); color: #1F2937; font-size: .72rem; font-weight: 700; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-backdrop { display: none; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 24px; background: rgba(255, 255, 255, .95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.topbar-title { margin: 0; font-weight: 600; color: var(--muted); font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; color: var(--text); background: none; border: 0; cursor: pointer; }
.icon-btn:hover { background: var(--bg); color: var(--primary); }
.nav-toggle { display: none; }
.dot-badge { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 10px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--bg); }
.user-name { display: flex; flex-direction: column; font-weight: 600; font-size: .9rem; line-height: 1.2; }
.user-name small { font-weight: 400; color: var(--muted); font-size: .75rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--secondary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: .75rem; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.dropdown-head { padding: 10px 10px 12px; margin: 0 0 6px; border-bottom: 1px solid var(--border); font-size: .85rem; }
.dropdown-head span { display: block; color: var(--muted); word-break: break-all; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 6px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg); }
.dropdown form { margin: 0; }

.content { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 24px; }
.content:focus { outline: none; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px 24px; font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); }

/* ------------------------------------------------------------- Encabezados */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-header h1 { margin: 0; }
.page-header p { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: .85rem; margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .icon { width: 16px; height: 16px; }

/* ------------------------------------------------------------- Tarjetas y grillas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.card-header .icon { color: var(--secondary); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 20px; }
.grid > .card + .card { margin-top: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 20px; }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--text); }
a.stat:hover { border-color: var(--primary); color: var(--text); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--primary-50); color: var(--primary); flex-shrink: 0; }
.stat-icon.verde { background: var(--secondary-50); color: var(--secondary); }
.stat-icon.ocre { background: var(--accent-50); color: #8a5a00; }
.stat-icon.rojo { background: var(--danger-50); color: var(--danger); }
.stat-valor { display: block; font-size: 1.5rem; font-weight: 700; line-height: 1.15; word-break: break-word; }
.stat-label { display: block; font-size: .82rem; color: var(--muted); line-height: 1.3; }
.stat > span:last-child { min-width: 0; }

.welcome { background: linear-gradient(120deg, var(--primary) 0%, #24508f 60%, var(--secondary) 130%); color: #fff; border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; position: relative; overflow: hidden; }
.welcome h1 { color: #fff; margin: 0 0 4px; font-size: 1.45rem; }
.welcome p { margin: 0; color: #DCE5F2; }
.welcome::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; border: 22px solid rgba(224, 165, 38, .35); }

/* ------------------------------------------------------------- Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-700); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: #246549; color: #fff; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #912018; color: #fff; }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-50); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .84rem; }
.btn-icon { min-height: 34px; width: 34px; padding: 0; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.acciones { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.acciones form { margin: 0; }
.inline { display: inline; margin: 0; }

/* ------------------------------------------------------------- Badges, chips */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-primary { background: var(--primary-50); color: var(--primary); border-color: #C9D6EA; }
.badge-success { background: var(--success-50); color: var(--success); border-color: #ABEFC6; }
.badge-warning { background: var(--warning-50); color: var(--warning); border-color: #FEDF89; }
.badge-danger { background: var(--danger-50); color: var(--danger); border-color: #FECDCA; }
.badge-info { background: var(--info-50); color: var(--info); border-color: #B2DDFF; }
.badge-muted { background: #F2F4F7; color: #475467; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--chip, var(--primary)); }
.dot-nuevo { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; flex-shrink: 0; }

/* ------------------------------------------------------------- Alertas */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 16px; font-size: .93rem; }
.alert > div { flex: 1; }
.alert-success { background: var(--success-50); border-color: #ABEFC6; color: #054F31; }
.alert-error { background: var(--danger-50); border-color: #FECDCA; color: #7A271A; }
.alert-warning { background: var(--warning-50); border-color: #FEDF89; color: #7A2E0E; }
.alert-info { background: var(--info-50); border-color: #B2DDFF; color: #194185; }
.alert-close { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; opacity: .7; }
.alert-close:hover { opacity: 1; }

/* ------------------------------------------------------------- Tablas */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); font-weight: 600; white-space: nowrap; }
.table tbody tr:hover { background: #FAFBFD; }
.table tr.no-leido td { font-weight: 600; }
.table tr.inactivo td { color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.acciones-col { width: 1%; white-space: nowrap; }
.table td.acciones-col .acciones { flex-wrap: nowrap; }
.table a.fila-link { color: var(--text); text-decoration: none; font-weight: 600; }
.table a.fila-link:hover { color: var(--primary); text-decoration: underline; }
.table-sub { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }
.positivo { color: var(--success); font-weight: 600; }
.negativo { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------- Formularios */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: .88rem; }
.req { color: var(--danger); }
.hint { font-size: .8rem; color: var(--muted); margin: 0; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; font: inherit; color: var(--text);
}
input:not([type]) { min-height: 42px; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27, 58, 107, .15); }
input[type=color] { width: 56px; height: 42px; padding: 3px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; }
input[type=file] { font: inherit; padding: 8px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); width: 100%; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.check small { display: block; color: var(--muted); }
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-actions .izq { margin-right: auto; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }
.radios { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-card { position: relative; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card span { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer; font-size: .9rem; background: #fff; }
.radio-card input:checked + span { border-color: var(--primary); background: var(--primary-50); color: var(--primary); font-weight: 600; }
.radio-card input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { flex: 1 1 180px; }
.toolbar .field-sm { flex: 0 1 160px; }
.toolbar .btn { min-height: 42px; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; }
.search-input input { padding-left: 36px; }

/* ------------------------------------------------------------- Pestañas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--primary); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------- Listas */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.list li:last-child { border-bottom: 0; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-weight: 600; color: var(--text); text-decoration: none; display: block; }
a.list-title:hover { color: var(--primary); }
.list-meta { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.list-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-50); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.list li.no-leido .list-title::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 8px; vertical-align: middle; }
.nivel-urgente .list-ico { background: var(--danger-50); color: var(--danger); }
.nivel-importante .list-ico { background: var(--warning-50); color: var(--warning); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty > .icon { width: 40px; height: 40px; color: var(--border-strong); margin-bottom: 8px; }
.empty p { margin: 0 0 12px; }

/* ------------------------------------------------------------- Contenido de texto */
.prose { font-size: 1rem; line-height: 1.7; }
.prose p { margin: 0 0 1em; }
.prose ul { padding-left: 1.3em; margin: 0 0 1em; }
.prose a { word-break: break-word; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .85rem; color: var(--muted); align-items: center; margin-bottom: 16px; }
.meta-row .icon { width: 16px; height: 16px; }
.destacado { border-left: 4px solid var(--accent); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: .92rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; min-width: 0; word-break: break-word; }

/* ------------------------------------------------------------- Archivos */
.archivos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.archivo-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.archivo-card:hover { border-color: var(--primary); color: var(--text); }
.archivo-card h3 { font-size: .95rem; margin: 0; word-break: break-word; }
.file-ico { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.file-ico .icon { width: 24px; height: 24px; }
.ft-pdf { background: #FEE4E2; color: #B42318; }
.ft-imagen { background: #E0F2FE; color: #026AA2; }
.ft-video { background: #F4EBFF; color: #6941C6; }
.ft-word { background: #D1E9FF; color: #1849A9; }
.ft-presentacion { background: #FFEAD5; color: #B93815; }
.ft-planilla { background: #D3F8DF; color: #087443; }
.ft-zip { background: #F2F4F7; color: #344054; }
.ft-archivo { background: #F2F4F7; color: #344054; }
.preview { background: #111827; border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 240px; }
.preview img { max-height: 75vh; object-fit: contain; display: block; }
.preview video { width: 100%; max-height: 75vh; display: block; }
.preview iframe { width: 100%; height: 78vh; border: 0; background: #fff; display: block; }
.preview-none { background: var(--surface-2); color: var(--muted); flex-direction: column; gap: 10px; padding: 40px; text-align: center; }

/* ------------------------------------------------------------- Plataformas */
.enlaces-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.enlace-card { display: flex; gap: 12px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.enlace-card:hover { border-color: var(--c, var(--primary)); color: var(--text); transform: translateY(-1px); }
.enlace-card .enlace-ico { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--c, var(--primary)); flex-shrink: 0; }
.enlace-card strong { display: block; }
.enlace-card small { color: var(--muted); display: block; line-height: 1.35; }

/* ------------------------------------------------------------- Línea de tiempo */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 30px; }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: -2px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .tl-dot { position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 3px solid var(--primary); }
.timeline .tl-dot.success { border-color: var(--success); }
.timeline .tl-dot.danger { border-color: var(--danger); }
.timeline .tl-dot.warning { border-color: var(--accent); }
.timeline .tl-dot.muted { border-color: var(--border-strong); }
.estado-pasos { display: flex; gap: 0; margin: 4px 0 4px; overflow-x: auto; }
.estado-paso { flex: 1; min-width: 92px; text-align: center; font-size: .78rem; color: var(--muted); position: relative; padding-top: 30px; }
.estado-paso::before { content: ""; position: absolute; top: 10px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border-strong); z-index: 1; }
.estado-paso::after { content: ""; position: absolute; top: 17px; left: -50%; width: 100%; height: 3px; background: var(--border); }
.estado-paso:first-child::after { display: none; }
.estado-paso.hecho { color: var(--text); font-weight: 600; }
.estado-paso.hecho::before { background: var(--secondary); border-color: var(--secondary); }
.estado-paso.hecho::after { background: var(--secondary); }
.estado-paso.rechazo::before { background: var(--danger); border-color: var(--danger); }
.estado-paso.rechazo { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------- Solicitud: filas de materiales */
.fila-material { display: grid; grid-template-columns: minmax(0, 1fr) 130px auto; gap: 10px; align-items: start; margin-bottom: 10px; }
@media (max-width: 640px) {
  .fila-material { grid-template-columns: minmax(0, 1fr) auto; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
  .fila-material .fm-item { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------- Mensajes */
.mensaje-cuerpo { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.mensaje-hilo { border-left: 3px solid var(--border); padding-left: 16px; margin-top: 16px; color: #374151; }
.selector-usuarios { border: 1px solid var(--border-strong); border-radius: 8px; max-height: 280px; overflow-y: auto; background: #fff; }
.selector-usuarios label { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: .9rem; }
.selector-usuarios label:last-child { border-bottom: 0; }
.selector-usuarios label:hover { background: var(--surface-2); }
.selector-usuarios input { accent-color: var(--primary); width: 17px; height: 17px; }
.selector-usuarios small { color: var(--muted); display: block; }

/* ------------------------------------------------------------- Indicadores */
.indicadores-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 20px; }
.chart-box { position: relative; height: 280px; }
.kpi { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi strong { font-size: 1.6rem; color: var(--primary); }
.kpi span { color: var(--muted); font-size: .85rem; }
.valores-tabla input { min-height: 36px; padding: 6px 8px; }
.valores-tabla td { padding: 6px 8px; }

/* ------------------------------------------------------------- Paginación */
.paginacion { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 20px; font-size: .85rem; color: var(--muted); }
.paginacion-links { display: flex; gap: 4px; flex-wrap: wrap; }
.pag-link { min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text); background: #fff; }
.pag-link:hover { border-color: var(--primary); color: var(--primary); }
.pag-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pag-link.disabled { color: var(--border-strong); pointer-events: none; }

/* ------------------------------------------------------------- Pantallas de acceso */
.auth-body { background: radial-gradient(1200px 600px at 10% -10%, #2b5797 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #2E7D5B 0%, transparent 55%), var(--primary); min-height: 100vh; }
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, .3); padding: 32px 28px; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand img { width: 72px; height: 72px; object-fit: contain; border-radius: 50%; margin-bottom: 8px; }
.auth-brand h1 { font-size: 1.35rem; margin: 0; color: var(--primary); }
.auth-brand p { color: var(--muted); margin: 4px 0 0; font-size: .92rem; }
.auth-card form .field { margin-bottom: 14px; }
.auth-links { text-align: center; margin-top: 16px; font-size: .9rem; }
.auth-foot { color: #C8D4E8; font-size: .82rem; margin-top: 20px; text-align: center; }
.password-field { position: relative; }
.password-field input { padding-right: 46px; }
.password-field button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: 8px; cursor: pointer; }
.verificacion { text-align: center; padding: 8px 0; }
.verificacion .icon { width: 56px; height: 56px; }
.verificacion.valido .icon { color: var(--success); }
.verificacion.invalido .icon { color: var(--danger); }

/* ------------------------------------------------------------- Utilidades */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.w-100 { width: 100%; }
.color-dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; vertical-align: middle; }
.img-preview { max-width: 220px; max-height: 120px; border: 1px solid var(--border); border-radius: 8px; background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50% / 16px 16px; padding: 6px; display: block; }
.progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--secondary); border-radius: 999px; }
.stock-bajo { color: var(--danger); font-weight: 700; }
.stock-ok { color: var(--success); font-weight: 600; }
.codigo { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }

/* ------------------------------------------------------------- Responsivo */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .indicadores-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-abierta .sidebar { transform: none; }
  body.nav-abierta .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(17, 24, 39, .45); z-index: 35; }
  .sidebar-close { display: inline-flex; }
  .main { margin-left: 0; }
  .nav-toggle { display: inline-flex; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .content { padding: 16px; }
  .topbar { padding: 0 10px; }
  .user-name { display: none; }
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .form-grid, .checks { grid-template-columns: 1fr; }
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }
  .list li { padding: 12px 16px; }
  .page-header h1 { font-size: 1.35rem; }
  .stat { padding: 12px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; }
  .stat-valor { font-size: 1.25rem; }
  .table th, .table td { padding: 9px 10px; }
  .chart-box { height: 240px; }
  .form-actions .btn { flex: 1; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
}

@media print {
  .sidebar, .topbar, .footer, .page-actions, .form-actions, .toolbar, .paginacion, .no-print { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
