/* ==========================================================================
   SIGAP Vijes - base.css
   Design tokens, typography and application frame (sidebar, top bar, view).
   Identity: night-street navy for the frame, one warm "luminaire" amber as
   the accent, and system fonts available on any Windows computer
   (Bahnschrift for headings and figures, Segoe UI for text).
   Presentation rules (v1.4): one surface per topic with hairline dividers
   instead of floating boxes, no decorative shadows, and color reserved for
   what needs attention.
   ========================================================================== */
:root {
  --navy: #0f2238;
  --navy-2: #16314f;
  --navy-3: #1f4168;
  --primary: #1b5a94;
  --primary-600: #154a7b;
  --primary-50: #e8f0f8;
  --amber: #f0a31c;
  --amber-600: #c98400;
  --amber-50: #fdf3dc;

  --ink: #14202e;
  --ink-2: #3d4b5c;
  --ink-3: #7b8897;
  --muted: #5f6f83;
  --line: #dfe4ea;
  --line-2: #ebeef2;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;

  --verde: #1a7a48;      --verde-bg: #e3f3e9;   --verde-line: #9fd3b4;
  --amarillo: #8a5a00;   --amarillo-bg: #fdf0cc; --amarillo-line: #e7bd55;
  --rojo: #b3261e;       --rojo-bg: #fce7e5;    --rojo-line: #eba29c;
  --azul: #1b5a94;       --azul-bg: #e5eff9;    --azul-line: #9fc3e6;
  --gris: #556170;       --gris-bg: #ebeef2;    --gris-line: #c5ccd6;

  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: Bahnschrift, "DIN Alternate", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-1: 0 1px 1px rgba(15, 34, 56, .03);
  --shadow-2: 0 10px 30px rgba(15, 34, 56, .18);
  --sidebar-w: 258px;
  --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.icon { flex: none; vertical-align: -3px; }

:focus-visible { outline: 2px solid var(--amber-600); outline-offset: 2px; border-radius: 3px; }
::selection { background: #cfe2f5; }

.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pre { white-space: pre-wrap; }
.stack > * + * { margin-top: 16px; }
.plain-list { list-style: disc; padding-left: 20px; margin: 8px 0 12px; }
.link { color: var(--primary); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 600; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; text-align: left; }
.link-btn:hover { text-decoration: underline; }

/* ------------------------------- Shell ---------------------------------- */
#app { height: 100%; }
/* The frame is pinned to the four edges of the window instead of using a
   viewport-height unit, so the sidebar always reaches the bottom, whatever
   the zoom, the display scaling or the way the window was resized. */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); position: fixed; top: 0; right: 0; bottom: 0; left: 0; }
.shell.is-collapsed { --sidebar-w: 64px; }

.sidebar { background: var(--navy); color: #c9d6e4; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid #0a1828; }
.brand { display: flex; align-items: center; gap: 11px; padding: 12px 13px; height: var(--topbar-h); text-decoration: none; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .08); flex: none; }
.brand-logo { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-family: var(--font-head); font-size: 19px; font-weight: 600; letter-spacing: .2px; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: #9db2c8; white-space: nowrap; }
.brand-bg { fill: var(--navy-3); }
.brand-cone { fill: var(--amber); opacity: .9; }
.brand-pole { fill: none; stroke: #e7eef6; stroke-width: 2.4; stroke-linecap: round; }
.brand-head { fill: #fff; }

.nav { flex: 1; overflow-y: auto; padding: 8px 8px 16px; scrollbar-width: thin; scrollbar-color: #2b4664 transparent; }
.nav-group { margin-bottom: 1px; }
.nav-group-head { width: 100%; display: flex; align-items: center; gap: 11px; padding: 8px 10px; background: none; border: 0; border-radius: 6px; color: #c9d6e4; cursor: pointer; text-align: left; text-decoration: none; font-size: 13.5px; line-height: 1.25; position: relative; }
.nav-group-head:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-group-head.is-active { color: #fff; font-weight: 600; }
.nav-group-head.is-active::before { content: ""; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--amber); }
.nav-group-head.is-active .icon { color: var(--amber); }
.nav-label { flex: 1; min-width: 0; }
.nav-caret { display: inline-flex; transition: transform .15s; opacity: .7; }
.nav-group-head.is-open .nav-caret { transform: rotate(180deg); }
.nav-sub { margin: 2px 0 6px 19px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .13); }
.nav-item { display: block; padding: 6px 10px; border-radius: 5px; color: #aebfd1; text-decoration: none; font-size: 13px; line-height: 1.3; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.is-active { background: var(--navy-3); color: #fff; font-weight: 600; }
.sidebar-foot { padding: 10px 14px; font-size: 11.5px; color: #7f95ad; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; justify-content: space-between; gap: 8px; flex: none; }

.is-collapsed .brand-text, .is-collapsed .nav-label, .is-collapsed .nav-caret, .is-collapsed .nav-sub, .is-collapsed .sidebar-foot { display: none; }
.is-collapsed .brand { justify-content: center; padding: 9px 0; }
.is-collapsed .nav-group-head { justify-content: center; padding: 10px 0; }
.is-collapsed .nav-group-head.is-active::before { left: -8px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { height: var(--topbar-h); flex: none; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 18px 0 10px; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; }
.crumb { color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
a.crumb:hover { color: var(--primary); text-decoration: underline; }
.crumb.is-current { color: var(--ink); font-weight: 600; }
.crumb-sep { color: #a5b1bf; display: inline-flex; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }

.search { position: relative; display: flex; align-items: center; }
.search > .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.search-input { width: 300px; height: 36px; padding: 0 10px 0 33px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); font-size: 13px; }
.search-input:focus { background: #fff; border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(27, 90, 148, .15); }
.search-panel { position: absolute; top: 42px; right: 0; width: 440px; max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); z-index: 60; padding: 6px; }
.search-group { font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 8px 3px; }
.search-hit { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 5px; text-decoration: none; color: var(--ink); }
.search-hit:hover, .search-hit:focus { background: var(--primary-50); }
.search-hit-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-hit-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.search-empty { padding: 14px 10px; color: var(--muted); }
.search-all { display: block; text-align: center; padding: 9px; border-top: 1px solid var(--line-2); margin-top: 4px; font-weight: 600; text-decoration: none; }

.demo-pill { font-size: 12px; font-weight: 700; color: var(--amarillo); background: var(--amarillo-bg); border: 1px solid var(--amarillo-line); padding: 4px 10px; border-radius: 12px; text-decoration: none; white-space: nowrap; }
.demo-short { display: none; }
/* Shared folder indicator: color, icon and text together (never color alone). */
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 12px; border: 1px solid; white-space: nowrap; cursor: pointer; line-height: 1.3; }
.sync-pill:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sync-verde { color: var(--verde); background: var(--verde-bg); border-color: var(--verde-line); }
.sync-amarillo { color: var(--amarillo); background: var(--amarillo-bg); border-color: var(--amarillo-line); }
.sync-rojo { color: var(--rojo); background: var(--rojo-bg); border-color: var(--rojo-line); }
.sync-azul { color: #fff; background: var(--azul); border-color: var(--azul); }
.sync-short { display: none; }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 18px; color: var(--ink-2); }
.bell:hover { background: var(--line-2); }
.bell-count { position: absolute; top: 1px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--rojo); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.user-btn { display: flex; align-items: center; gap: 9px; background: none; border: 1px solid transparent; border-radius: 20px; padding: 3px 9px 3px 3px; cursor: pointer; }
.user-btn:hover { background: var(--line-2); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--navy-2); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-head); }
.user-text { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.user-name { font-weight: 600; font-size: 13px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11.5px; color: var(--muted); }

.view { flex: 1; overflow: auto; padding: 26px 30px 48px; outline: none; }

/* ------------------------------- Page ----------------------------------- */
.page { max-width: 1680px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-titles { min-width: 0; flex: 1 1 320px; }
.page-title { font-family: var(--font-head); font-size: 26px; font-weight: 600; line-height: 1.2; letter-spacing: .1px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.page-sub { color: var(--muted); margin-top: 4px; max-width: 80ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.page-toolbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.title-badges { display: inline-flex; gap: 6px; align-items: center; font-family: var(--font); }
.record-meta { margin-top: 18px; font-size: 12px; color: var(--muted); }
.sub-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; margin: 14px 0 8px; }

.grid { display: grid; gap: 18px; }
.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-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
/* Indicator band: one surface, cells separated by hairlines (the gap shows
   the line color). Columns are balanced by ui.grid so rows come out even. */
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(176px, 1fr)); gap: 1px; background: var(--line-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-1); }
.grid-kpi.is-flush { border: 0; border-top: 1px solid var(--line-2); border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
.grid + .grid, .grid + .card, .card + .grid, .card + .card, .tabs-wrap + .card { margin-top: 18px; }
.grid > .card, .grid > .grid, .grid > .tabs-wrap { margin-top: 0; }
.span-2 { grid-column: span 2; }
.section-title { font-family: var(--font-head); font-size: 17px; font-weight: 600; margin: 30px 0 12px; display: flex; align-items: center; gap: 10px; color: var(--navy-2); }
.section-title:first-child { margin-top: 0; }

/* ---------------------------- Responsive -------------------------------- */
@media (max-width: 1500px) {
  .search-input { width: 215px; }
  .demo-long { display: none; }
  .demo-short { display: inline; }
  .sync-long { display: none; }
  .sync-short { display: inline; }
  .user-name { max-width: 120px; }
}
/* A wide table next to a side card needs room: below this width they stack. */
@media (max-width: 1440px) {
  .grid-21 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-text { display: none; }
  .view { padding: 20px 20px 40px; }
}
@media (max-width: 999px) {
  .shell, .shell.is-collapsed { grid-template-columns: minmax(0, 1fr); --sidebar-w: 270px; }
  .sidebar { position: fixed; z-index: 80; top: 0; bottom: 0; left: 0; width: 270px; transform: translateX(-100%); transition: transform .18s ease; }
  .is-mobile-open .sidebar { transform: none; }
  .is-mobile-open .sidebar-scrim { position: fixed; inset: 0; background: rgba(15, 34, 56, .45); z-index: 70; }
  .is-collapsed .brand-text, .is-collapsed .nav-label, .is-collapsed .nav-caret { display: revert; }
  .is-collapsed .nav-sub { display: block; }
  .is-collapsed .nav-group-head { justify-content: flex-start; padding: 8px 10px; }
  .grid-2, .grid-3, .grid-4, .grid-21 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .search-input { width: 170px; }
  .search-panel { width: min(440px, 92vw); }
  .demo-pill { display: none; }
  .sync-pill { padding: 6px 8px; }
  .sync-verde .sync-short { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
