/* =======================================================================
   PORTAL DE PADRES SGE · NÚCLEO CSS
   ======================================================================= */

/* -------- TOKENS -------- */
:root{
  --bg: oklch(0.985 0.003 80);
  --bg-elev: oklch(0.995 0.002 80);
  --bg-sunken: oklch(0.965 0.004 80);
  --ink: oklch(0.22 0.01 260);
  --ink-2: oklch(0.42 0.01 260);
  --ink-3: oklch(0.60 0.008 260);
  --line: oklch(0.22 0.01 260 / 0.08);
  --line-strong: oklch(0.22 0.01 260 / 0.14);
  --accent: oklch(0.52 0.16 265);
  --accent-soft: oklch(0.94 0.04 265);
  --accent-ink: oklch(0.35 0.14 265);
  --ok: oklch(0.62 0.14 155);
  --warn: oklch(0.72 0.14 70);
  --alert: oklch(0.60 0.18 25);
  --lilac: oklch(0.70 0.09 300);
  --card: color-mix(in oklab, white 72%, transparent);
  --card-strong: color-mix(in oklab, white 86%, transparent);
  --shadow-1: 0 1px 2px oklch(0.22 0.01 260 / .04), 0 2px 6px oklch(0.22 0.01 260 / .04);
  --shadow-2: 0 1px 2px oklch(0.22 0.01 260 / .05), 0 8px 24px oklch(0.22 0.01 260 / .06);
  --shadow-3: 0 2px 6px oklch(0.22 0.01 260 / .06), 0 24px 60px oklch(0.22 0.01 260 / .10);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --font-sans: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Fraunces', 'Inter Tight', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --header-h: 64px;
  --tab-h: 72px;
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
}
html[data-theme="dark"]{
  --bg: oklch(0.18 0.012 265);
  --bg-elev: oklch(0.22 0.014 265);
  --bg-sunken: oklch(0.15 0.012 265);
  --ink: oklch(0.97 0.005 260);
  --ink-2: oklch(0.78 0.01 260);
  --ink-3: oklch(0.58 0.01 260);
  --line: oklch(1 0 0 / 0.08);
  --line-strong: oklch(1 0 0 / 0.14);
  --accent: oklch(0.72 0.14 265);
  --accent-soft: oklch(0.32 0.08 265);
  --accent-ink: oklch(0.85 0.12 265);
  --card: color-mix(in oklab, oklch(0.26 0.014 265) 70%, transparent);
  --card-strong: color-mix(in oklab, oklch(0.28 0.014 265) 88%, transparent);
  --shadow-1: 0 1px 2px #0000, 0 2px 10px #00000040;
  --shadow-2: 0 1px 2px #0000, 0 12px 28px #00000055;
  --shadow-3: 0 2px 6px #0000, 0 30px 80px #00000070;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family: var(--font-sans);
  font-feature-settings: "ss01","cv11";
  color: var(--ink);
  background: var(--bg);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
body::before{
  content:"";
  position: fixed; inset:0;
  background:
    radial-gradient(1200px 800px at 90% -10%, oklch(0.88 0.09 265 / .45), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, oklch(0.90 0.06 300 / .35), transparent 55%),
    radial-gradient(700px 500px at 50% 120%, oklch(0.93 0.04 80 / .35), transparent 60%);
  z-index: -1;
  pointer-events: none;
}
html[data-theme="dark"] body::before{
  background:
    radial-gradient(1100px 800px at 90% -10%, oklch(0.45 0.14 265 / .35), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, oklch(0.40 0.10 300 / .30), transparent 55%);
}

button{font: inherit; color: inherit; background: none; border: 0; cursor: pointer; letter-spacing: inherit}
a{color: inherit; text-decoration: none}

/* -------- APP SHELL -------- */
.app{
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .35s cubic-bezier(.2,.7,.2,1);
}
.app.collapsed{ grid-template-columns: var(--sidebar-w-collapsed) 1fr }

/* -------- SIDEBAR -------- */
.sidebar{
  position: sticky; top:0;
  height: 100vh;
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border-right: 1px solid var(--line);
}
.brand{
  display:flex; align-items:center; gap:12px;
  padding: 10px 10px 18px;
}
.brand-mark{
  width:36px; height:36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--lilac));
  display:grid; place-items:center;
  color:white; font-family: var(--font-display); font-weight:600; font-size:18px;
  box-shadow: var(--shadow-1), inset 0 1px 0 #ffffff40;
  flex: 0 0 36px;
}
.brand-text{ display:flex; flex-direction:column; line-height:1.1; overflow:hidden }
.brand-text b{ font-family: var(--font-display); font-weight:600; font-size:15.5px; letter-spacing:-0.015em; white-space:nowrap }
.brand-text span{ font-size:11.5px; color: var(--ink-3); margin-top:2px; white-space:nowrap }

.nav{ display:flex; flex-direction:column; gap: 2px; margin-top: 4px }
.nav-section{ font-size: 10.5px; letter-spacing:.08em; text-transform: uppercase; color: var(--ink-3); padding: 14px 12px 6px }
.nav-item{
  display:flex; align-items:center; gap:12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--ink-2); font-weight: 500; font-size: 14px;
  position: relative;
  transition: background .2s, color .2s, transform .2s;
  cursor: pointer;
}
.nav-item:hover{ background: var(--bg-sunken); color: var(--ink) }
.nav-item.active{
  background: var(--card-strong);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.nav-item.active::before{
  content:""; position:absolute; left:4px; top:10px; bottom:10px;
  width:3px; border-radius: 3px; background: var(--accent);
}
.nav-item .ico{ flex: 0 0 20px; display:grid; place-items:center; color: var(--ink-2) }
.nav-item.active .ico{ color: var(--accent) }
.nav-item .label{ white-space:nowrap; overflow:hidden; text-overflow: ellipsis }
.nav-item .badge{
  margin-left:auto;
  font-size:11px; font-weight:600;
  background: var(--accent); color:white;
  padding: 2px 7px; border-radius: 999px; min-width:20px; text-align:center;
}
.collapsed .brand-text,
.collapsed .nav-section,
.collapsed .nav-item .label,
.collapsed .nav-item .badge,
.collapsed .sidebar-footer .meta{ display:none }
.collapsed .sidebar{ padding: 18px 10px }
.collapsed .nav-item{ justify-content:center; padding: 12px }

.sidebar-footer{
  margin-top: auto;
  padding: 10px; border-radius: 14px;
  background: var(--bg-sunken);
  display:flex; align-items:center; gap: 10px;
}
.avatar{
  width:36px; height:36px; border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.80 0.08 30), oklch(0.72 0.10 60));
  color:white; display:grid; place-items:center;
  font-weight:600; font-size:13px; flex:0 0 36px;
  box-shadow: inset 0 1px 0 #ffffff60;
}
.sidebar-footer .meta{ line-height:1.2; overflow:hidden }
.sidebar-footer .meta b{ font-size:13px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.sidebar-footer .meta span{ font-size:11px; color: var(--ink-3) }

.sidebar-toggle{
  position:absolute; top: 18px; right: -12px;
  width:24px; height:24px; border-radius: 50%;
  background: var(--bg-elev); border: 1px solid var(--line);
  display:grid; place-items:center;
  box-shadow: var(--shadow-1);
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
  z-index: 5;
}
.collapsed .sidebar-toggle{ transform: rotate(180deg) }

/* -------- MAIN -------- */
.main{ min-width: 0; display:flex; flex-direction: column }
.topbar{
  position: sticky; top:0; z-index: 20;
  height: var(--header-h);
  display:flex; align-items:center; gap: 14px;
  padding: 0 28px;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar h1{
  font-family: var(--font-display);
  font-weight: 600; font-size: 20px; letter-spacing: -0.02em;
  margin: 0;
}
.topbar .crumb{ color: var(--ink-3); font-size:13px; font-weight:500 }
.topbar .spacer{ flex:1 }
.search{
  display:flex; align-items:center; gap: 8px;
  padding: 8px 12px; border-radius: 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  min-width: 260px;
  color: var(--ink-3);
  font-size: 13px;
}
.search input{
  border:0; background:transparent; outline: none; flex:1;
  font: inherit; color: var(--ink);
}
.search kbd{
  font-family: var(--font-mono); font-size:10px;
  padding: 2px 6px; border-radius: 6px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--ink-3);
}
.icon-btn{
  width: 40px; height: 40px; border-radius: 12px;
  display:grid; place-items:center;
  color: var(--ink-2);
  transition: background .2s, color .2s;
  position: relative;
}
.icon-btn:hover{ background: var(--bg-sunken); color: var(--ink) }
.icon-btn .dot{
  position:absolute; top:10px; right:11px;
  width:8px; height:8px; border-radius:50%;
  background: var(--alert); border: 2px solid var(--bg);
}
.mobile-only{display:none}

/* -------- VIEW HOST -------- */
#viewHost{
  padding: 28px 28px 60px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.view-head{
  display:flex; align-items:flex-end; justify-content:space-between; gap: 16px;
  margin-bottom: 22px;
}
.view-head h2{
  font-family: var(--font-display);
  font-weight: 600; font-size: clamp(28px, 3.4vw, 40px);
  letter-spacing: -0.025em; line-height: 1.05;
  margin: 0 0 4px;
}
.view-head p{ color: var(--ink-2); margin:0; font-size: 14.5px }

/* -------- CARDS -------- */
.card{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: var(--shadow-2);
  padding: 20px;
}
.card.flat{ box-shadow: var(--shadow-1) }
.card-header{
  display:flex; align-items:center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.card-title{
  font-family: var(--font-display);
  font-weight: 600; font-size: 17px; letter-spacing: -0.015em;
}
.card-eyebrow{
  font-size: 11px; letter-spacing:.08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}
.link{
  color: var(--accent-ink); font-size: 13px; font-weight: 500;
  display:inline-flex; align-items:center; gap: 4px;
  cursor: pointer;
}
.link:hover{ text-decoration: underline }

/* chips / tags */
.chip{
  display:inline-flex; align-items:center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--bg-sunken);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.chip.accent{ background: var(--accent-soft); color: var(--accent-ink); border-color: transparent }
.chip.ok{ background: oklch(0.94 0.06 155); color: oklch(0.40 0.12 155); border-color: transparent }
.chip.warn{ background: oklch(0.95 0.07 70); color: oklch(0.42 0.12 60); border-color: transparent }
.chip.alert{ background: oklch(0.95 0.05 25); color: oklch(0.42 0.14 25); border-color: transparent }
html[data-theme="dark"] .chip.ok{ background: oklch(0.30 0.07 155); color: oklch(0.85 0.10 155) }
html[data-theme="dark"] .chip.warn{ background: oklch(0.32 0.07 70); color: oklch(0.88 0.10 70) }
html[data-theme="dark"] .chip.alert{ background: oklch(0.32 0.07 25); color: oklch(0.88 0.10 25) }

.btn{
  display: inline-flex; align-items:center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  font-weight: 500; font-size: 14px;
  background: var(--bg-sunken); color: var(--ink);
  border: 1px solid var(--line);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover{ background: var(--bg-elev); box-shadow: var(--shadow-1) }
.btn:active{ transform: translateY(1px) }
.btn.primary{
  background: var(--ink); color: var(--bg);
  border-color: transparent;
}
.btn.primary:hover{ background: oklch(from var(--ink) calc(l + .06) c h) }
.btn.accent{ background: var(--accent); color:white; border-color: transparent }
.btn.accent:hover{ background: oklch(from var(--accent) calc(l - .04) c h) }
.btn.ghost{ background: transparent }

/* -------- TAB BAR (MOBILE) -------- */
.tabbar{
  display: none;
  position: fixed; left: 12px; right: 12px; bottom: 10px;
  height: var(--tab-h);
  background: var(--card-strong);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-3);
  z-index: 50;
  padding: 8px;
}
.tabbar-inner{ display: grid; grid-template-columns: repeat(5, 1fr); height: 100% }
.tab{
  display:flex; flex-direction: column; align-items:center; justify-content:center;
  gap: 3px; color: var(--ink-3); border-radius: 14px;
  font-size: 10.5px; font-weight: 500; letter-spacing: 0;
  transition: color .2s, background .2s;
}
.tab svg{ width: 22px; height: 22px }
.tab.active{ color: var(--accent) }
.tab.active .tab-ico{ background: var(--accent-soft); }
.tab-ico{
  width: 44px; height: 28px; border-radius: 14px;
  display:grid; place-items:center;
  transition: background .2s;
}

/* -------- GRID -------- */
.grid{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}
.col-4{grid-column: span 4}
.col-5{grid-column: span 5}
.col-6{grid-column: span 6}
.col-7{grid-column: span 7}
.col-8{grid-column: span 8}
.col-12{grid-column: span 12}

/* -------- STUDENT HERO -------- */
.student-hero{
  padding: 0;
  overflow: hidden;
  position: relative;
}
.student-hero-top{
  padding: 22px 22px 20px;
  display:flex; align-items:center; gap: 16px;
  background:
    radial-gradient(120% 140% at 90% 10%, oklch(0.88 0.09 265 / .55), transparent 60%),
    linear-gradient(180deg, oklch(0.97 0.02 265), transparent);
  border-bottom: 1px solid var(--line);
}
html[data-theme="dark"] .student-hero-top{
  background:
    radial-gradient(120% 140% at 90% 10%, oklch(0.50 0.12 265 / .40), transparent 60%),
    linear-gradient(180deg, oklch(0.30 0.02 265), transparent);
}
.student-avatar{
  width: 60px; height: 60px; border-radius: 18px;
  background: linear-gradient(135deg, oklch(0.82 0.08 30), oklch(0.72 0.12 40));
  color:white; font-weight: 600; font-size: 22px;
  display:grid; place-items:center;
  box-shadow: var(--shadow-2), inset 0 1px 0 #ffffff60;
  flex: 0 0 60px;
  font-family: var(--font-display);
}
.student-meta b{ font-family: var(--font-display); font-weight:600; font-size: 20px; letter-spacing: -0.02em; display:block }
.student-meta span{ color: var(--ink-2); font-size: 13px }
.student-switch{
  margin-left: auto;
  display:flex; align-items:center; gap:4px;
  padding: 6px 10px 6px 6px; border-radius: 999px;
  background: var(--card-strong); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.student-switch .mini-av{
  width:22px; height:22px; border-radius:50%;
  display:grid; place-items:center; color:white; font-weight:600; font-size:10px;
  background: linear-gradient(135deg, oklch(0.78 0.10 160), oklch(0.70 0.12 180));
}
.hero-stats{
  display:grid; grid-template-columns: repeat(4, 1fr);
  padding: 16px 8px;
}
.hero-stat{
  padding: 8px 14px;
  border-right: 1px solid var(--line);
}
.hero-stat:last-child{ border-right: 0 }
.hero-stat .k{ font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600 }
.hero-stat .v{ font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-top:2px; display:flex; align-items:baseline; gap: 6px }
.hero-stat .delta{ font-size: 11px; font-family: var(--font-sans); color: var(--ok); font-weight:600 }
.hero-stat .delta.down{ color: var(--alert) }

/* -------- TIMELINE -------- */
.timeline{ display:flex; flex-direction: column; gap: 10px }
.timeline-row{
  display:grid; grid-template-columns: 64px 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: transform .2s, box-shadow .2s;
}
.timeline-row.now{
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: 0 0 0 2px oklch(from var(--accent) l c h / .15);
}
.timeline-row:hover{ transform: translateY(-1px); box-shadow: var(--shadow-1) }
.t-time{ font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); line-height: 1.3 }
.timeline-row.now .t-time{ color: var(--accent-ink); font-weight: 600 }
.t-time small{ display:block; font-size:10.5px; color: var(--ink-3) }
.t-body b{ font-size: 14px; font-weight: 600; display:block; letter-spacing:-0.01em }
.t-body span{ font-size: 12.5px; color: var(--ink-3) }
.t-room{
  font-family: var(--font-mono); font-size: 11.5px;
  padding: 4px 8px; border-radius: 8px;
  background: var(--bg-sunken); color: var(--ink-2);
  border: 1px solid var(--line);
}
.timeline-row.now .t-room{ background: white; color: var(--accent-ink); border-color: transparent }

/* -------- GRADE CARD -------- */
.grade-card{
  padding: 22px;
  background: linear-gradient(160deg, oklch(0.45 0.14 265), oklch(0.38 0.16 285));
  color: white;
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-2);
  height: 100%;
}
.grade-card::after{
  content:"";
  position: absolute; right: -60px; top: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, oklch(0.90 0.06 300 / .35), transparent 60%);
}
.grade-card .eyebrow{ font-size: 11px; text-transform: uppercase; letter-spacing:.1em; opacity:.8; font-weight:600 }
.grade-card .subject{ font-family: var(--font-display); font-size: 22px; font-weight:600; letter-spacing:-0.02em; margin-top: 4px }
.grade-card .score{
  display:flex; align-items:baseline; gap: 6px; margin-top: 20px;
}
.grade-card .score b{ font-family: var(--font-display); font-size: 64px; font-weight: 600; letter-spacing: -0.04em; line-height: 1 }
.grade-card .score span{ font-size: 14px; opacity:.8 }
.grade-card .foot{ margin-top: 14px; font-size: 12.5px; opacity:.9; display:flex; justify-content: space-between; position:relative; z-index:1 }
.grade-card .teacher{ display:flex; align-items:center; gap:8px }
.grade-card .mini-av.t{
  width: 22px; height:22px; border-radius:50%;
  background: linear-gradient(135deg, oklch(0.80 0.08 70), oklch(0.70 0.10 50));
  display:grid; place-items:center; font-size:10px; font-weight:600;
}

/* -------- ANNOUNCEMENTS -------- */
.announce-list{ display:flex; flex-direction: column; gap: 2px }
.announce{
  display:grid; grid-template-columns: 40px 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.announce:last-child{ border-bottom: 0 }
.announce .ic{
  width: 40px; height: 40px; border-radius: 12px;
  display:grid; place-items:center;
  background: var(--bg-sunken); color: var(--ink-2);
  border: 1px solid var(--line);
}
.announce .ic.school{ background: var(--accent-soft); color: var(--accent-ink); border-color: transparent }
.announce .ic.teacher{ background: oklch(0.94 0.05 155); color: oklch(0.38 0.12 155); border-color: transparent }
html[data-theme="dark"] .announce .ic.teacher{ background: oklch(0.30 0.07 155); color: oklch(0.85 0.10 155) }
.announce .ic.admin{ background: oklch(0.95 0.06 70); color: oklch(0.42 0.12 60); border-color: transparent }
html[data-theme="dark"] .announce .ic.admin{ background: oklch(0.32 0.07 70); color: oklch(0.88 0.10 70) }
.announce b{ font-size: 13.5px; font-weight: 600; display:block; letter-spacing:-0.01em }
.announce span{ font-size: 12.5px; color: var(--ink-3) }
.announce time{ font-size: 12px; color: var(--ink-3); font-family: var(--font-mono) }

/* -------- QUICK ACTIONS -------- */
.quick{
  display:grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.quick .q{
  padding: 14px; border-radius: 14px;
  background: var(--bg-elev); border: 1px solid var(--line);
  display:flex; flex-direction: column; gap: 10px; align-items: flex-start;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
  text-align: left;
}
.quick .q:hover{ transform: translateY(-2px); box-shadow: var(--shadow-2) }
.quick .q .ic{
  width: 36px; height: 36px; border-radius: 10px;
  display:grid; place-items:center;
  background: var(--accent-soft); color: var(--accent-ink);
}
.quick .q b{ font-size: 13.5px; font-weight: 600 }
.quick .q span{ font-size: 11.5px; color: var(--ink-3) }

/* -------- ACADÉMICO -------- */
.period-switch{
  display:inline-flex; padding: 4px; border-radius: 12px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  gap: 2px;
}
.period-switch button{
  padding: 6px 12px; border-radius: 9px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.period-switch button.on{ background: var(--bg-elev); color: var(--ink); box-shadow: var(--shadow-1) }

.subject-grid{
  display:grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.subject{
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.subject:hover{ transform: translateY(-2px); box-shadow: var(--shadow-2) }
.subject-head{
  display:grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items:center;
}
.subject-ico{
  width: 44px; height: 44px; border-radius: 12px;
  display:grid; place-items:center;
  font-family: var(--font-display); font-weight: 600; font-size: 18px;
  color: white;
}
.subject-ico.s1{ background: linear-gradient(135deg, oklch(0.62 0.16 265), oklch(0.52 0.18 285)) }
.subject-ico.s2{ background: linear-gradient(135deg, oklch(0.62 0.15 155), oklch(0.55 0.16 175)) }
.subject-ico.s3{ background: linear-gradient(135deg, oklch(0.70 0.13 60), oklch(0.62 0.16 40)) }
.subject-ico.s4{ background: linear-gradient(135deg, oklch(0.62 0.14 15), oklch(0.55 0.16 355)) }
.subject-ico.s5{ background: linear-gradient(135deg, oklch(0.64 0.12 200), oklch(0.56 0.14 220)) }
.subject-ico.s6{ background: linear-gradient(135deg, oklch(0.66 0.12 320), oklch(0.58 0.14 300)) }
.subject-head b{ font-family: var(--font-display); font-weight:600; font-size: 16px; letter-spacing:-0.015em; display:block }
.subject-head span{ color: var(--ink-3); font-size: 12px }
.subject-score{
  font-family: var(--font-display); font-weight:600; font-size: 24px; letter-spacing:-0.02em;
  padding: 6px 10px; border-radius: 10px;
  background: var(--bg-sunken); color: var(--ink);
}
.competences{ margin-top: 16px; display:flex; flex-direction: column; gap: 10px }
.comp{ display:grid; grid-template-columns: 1fr auto; gap: 8px; align-items:center }
.comp-label{ font-size: 12.5px; color: var(--ink-2); font-weight: 500 }
.comp-bar{ grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--bg-sunken); overflow: hidden; position: relative }
.comp-bar .fill{
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--lilac));
  transition: width .8s cubic-bezier(.2,.7,.2,1);
}
.comp-bar .fill.ok{ background: linear-gradient(90deg, oklch(0.62 0.14 155), oklch(0.68 0.14 170)) }
.comp-bar .fill.warn{ background: linear-gradient(90deg, oklch(0.72 0.14 70), oklch(0.68 0.16 50)) }
.comp-value{ font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums }
.materials{
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  display:flex; flex-wrap: wrap; gap: 6px;
}
.material{
  display:inline-flex; align-items:center; gap: 6px;
  padding: 5px 10px; border-radius: 8px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-2); font-weight: 500;
}
.material svg{ width: 12px; height: 12px }
.material.deck{ background: var(--accent-soft); color: var(--accent-ink); border-color: transparent }

/* -------- COMUNICACIONES -------- */
.comms-layout{
  display: grid; grid-template-columns: 1fr 1.3fr; gap: 18px; min-height: 520px;
}
.comms-filters{ display:flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap }
.comms-filters .chip{ cursor: pointer }
.comms-filters .chip.on{ background: var(--ink); color: var(--bg); border-color: transparent }
.msg-list{ display:flex; flex-direction: column }
.msg{
  display:grid; grid-template-columns: 40px 1fr auto;
  gap: 12px; padding: 14px 12px; align-items:center;
  border-radius: 12px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
  position: relative;
}
.msg:hover{ background: var(--bg-sunken) }
.msg.selected{ background: var(--accent-soft); border-color: transparent }
html[data-theme="dark"] .msg.selected{ background: oklch(0.30 0.08 265) }
.msg.unread::before{
  content:""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.msg .ic{
  width: 40px; height: 40px; border-radius: 12px;
  display:grid; place-items:center;
  background: var(--bg-sunken); color: var(--ink-2);
  border: 1px solid var(--line);
  font-family: var(--font-display); font-weight:600; font-size:14px;
}
.msg b{ font-size: 13.5px; font-weight: 600; display:block; letter-spacing:-0.01em }
.msg .preview{ font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100% }
.msg time{ font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); white-space: nowrap }
.msg .from{ font-size: 11px; color: var(--ink-3); margin-bottom:2px; display:block }
.msg-reader{ display:flex; flex-direction: column }
.reader-head{
  padding: 8px 4px 16px; border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.reader-head h3{
  font-family: var(--font-display); font-weight: 600; font-size: 22px;
  letter-spacing: -0.02em; margin: 0 0 10px;
}
.reader-meta{ display:flex; align-items:center; gap: 10px; font-size: 12.5px; color: var(--ink-3) }
.reader-meta .avatar{ width: 28px; height: 28px; font-size: 11px }
.reader-meta b{ color: var(--ink); font-weight: 600; font-size: 13px }
.reader-body{ font-size: 14.5px; line-height: 1.65; color: var(--ink-2) }
.reader-body p{ margin: 0 0 14px }
.reader-attach{
  display:flex; gap: 10px; flex-wrap: wrap;
  margin: 16px 0;
}
.attach{
  display:flex; align-items:center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 500;
  color: var(--ink);
  min-width: 220px;
}
.attach .ft{
  width: 32px; height: 32px; border-radius: 8px;
  display:grid; place-items:center; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-ink);
}
.attach small{ display:block; color: var(--ink-3); font-weight:400; font-size:11px }

/* -------- TRÁMITES -------- */
.tramites{
  display:grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.tramite{
  padding: 22px; border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(20px) saturate(1.2);
  display:flex; flex-direction: column; gap: 14px;
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.tramite:hover{ transform: translateY(-2px); box-shadow: var(--shadow-2) }
.tramite .big-ico{
  width: 52px; height: 52px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent-ink);
  display:grid; place-items:center;
}
.tramite h3{ font-family: var(--font-display); font-weight:600; font-size:17px; letter-spacing:-0.015em; margin:0 }
.tramite p{ font-size:13px; color: var(--ink-3); margin:0; line-height:1.5 }
.tramite .foot{ margin-top:auto; display:flex; align-items:center; justify-content: space-between; padding-top: 8px }
.tramite .eta{ font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono) }
.history{ margin-top: 24px; }
.history-row{
  display:grid; grid-template-columns: 1fr auto auto auto;
  gap: 16px; align-items:center;
  padding: 14px 16px; border-radius: 14px;
  background: var(--bg-elev); border: 1px solid var(--line);
  margin-bottom: 8px;
  font-size: 13px;
}
.history-row b{ font-weight: 600; font-size: 13.5px; display:block }
.history-row span{ font-size: 12px; color: var(--ink-3) }
.history-row time{ font-family: var(--font-mono); font-size: 12px; color: var(--ink-3) }

/* -------- MODAL -------- */
.modal-scrim{
  position: fixed; inset: 0; z-index: 100;
  background: oklch(0.22 0.01 260 / .35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-scrim.open{ display:flex; animation: fade .2s ease }
@keyframes fade{ from{opacity:0} to{opacity:1} }
.modal{
  background: var(--card-strong);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: 24px;
  max-width: 540px; width: 100%;
  box-shadow: var(--shadow-3);
  padding: 28px;
  animation: pop .3s cubic-bezier(.2,.7,.2,1);
}
@keyframes pop{ from{opacity:0; transform: scale(.96) translateY(10px)} to{opacity:1; transform:none} }
.modal h3{ font-family: var(--font-display); font-size: 22px; font-weight:600; letter-spacing:-0.02em; margin: 0 0 6px }
.modal p.sub{ font-size: 13.5px; color: var(--ink-3); margin: 0 0 20px }
.field{ display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px }
.field label{ font-size: 12.5px; font-weight: 500; color: var(--ink-2) }
.field input, .field select, .field textarea{
  font: inherit; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(from var(--accent) l c h / .15);
}
.field textarea{ resize: vertical; min-height: 90px; font-family: inherit }
.modal-actions{ display:flex; gap: 10px; justify-content: flex-end; margin-top: 8px }

/* -------- VIEW TRANSITION -------- */
.view-enter{ animation: view-in .35s cubic-bezier(.2,.7,.2,1) }
@keyframes view-in{
  from{ opacity: 0; transform: translateY(8px); filter: blur(4px) }
  to{ opacity: 1; transform: none; filter: none }
}

/* -------- MOBILE -------- */
@media (max-width: 920px){
  .app{ grid-template-columns: 1fr !important }
  .sidebar{ display: none }
  .tabbar{ display: block }
  .mobile-only{ display: inline-flex }
  .topbar{ padding: 0 18px; height: 56px }
  .topbar .search{ display: none }
  #viewHost{ padding: 18px 18px calc(var(--tab-h) + 28px) }
  .grid{ gap: 14px }
  .col-4,.col-5,.col-6,.col-7,.col-8{ grid-column: span 12 }
  .subject-grid{ grid-template-columns: 1fr }
  .tramites{ grid-template-columns: 1fr }
  .comms-layout{ grid-template-columns: 1fr }
  .comms-layout .msg-reader{ display: none }
  .comms-layout.show-reader .msg-list{ display: none }
  .comms-layout.show-reader .msg-reader{ display: flex }
  .hero-stats{ grid-template-columns: repeat(2, 1fr) }
  .hero-stat{ border-right: 0; border-bottom: 1px solid var(--line) }
  .hero-stat:nth-child(3), .hero-stat:nth-child(4){ border-bottom: 0 }
  .hero-stat:nth-child(odd){ border-right: 1px solid var(--line) }
  .quick{ grid-template-columns: repeat(2, 1fr) }
  .history-row{ grid-template-columns: 1fr auto; gap: 8px }
  .history-row .hide-s{ display:none }
}