:root {
  color-scheme: light;
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #efeee7;
  --ink: #13201a;
  --ink-2: #4a5650;
  --muted: #7b847e;
  --line: #e1dfd5;
  --ring: rgba(19, 32, 26, 0.10);
  --brand: #1d6a3a;
  --brand-2: #e3efe6;
  --brand-ink: #ffffff;
  --active: #eb6834;
  --upcoming: #2a78d6;
  --finished: #8f9792;
  --campo: #fbc02d;
  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --critical: #d03b3b;
  --bar: #9fb9a8;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(19,32,26,.08);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1310;
    --surface: #161c18;
    --surface-2: #1e2620;
    --ink: #eef1ec;
    --ink-2: #b8c1b9;
    --muted: #87908a;
    --line: #2a332d;
    --ring: rgba(255,255,255,0.10);
    --brand: #3fa564;
    --brand-2: #1f3327;
    --brand-ink: #08130c;
    --active: #d95926;
    --upcoming: #3987e5;
    --finished: #7c847f;
    --good-ink: #0ca30c;
    --bar: #4b6655;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.hidden { display: none !important; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ------------------------------------------------------------ header */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 18px; height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink);
}
.logo small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; letter-spacing: .02em; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a {
  color: var(--ink-2); padding: 7px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; font-size: .93rem;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--brand-2); color: var(--brand); }
.userbox { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); object-fit: cover; }
@media (max-width: 860px) {
  .topbar .wrap { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 6px; gap: 8px 12px; }
  .nav { order: 3; flex-basis: 100%; }
  .logo small { display: none; }
  .userbox { margin-left: auto; }
  .userbox .uname { display: none; }
}

/* ------------------------------------------------------------ buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px;
  font: 600 .95rem var(--font); cursor: pointer; white-space: nowrap;
  background: var(--brand); color: var(--brand-ink); transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.light { background: #fff; color: #13201a; }
.btn.danger { background: var(--critical); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: .85rem; border-radius: 8px; }
.btn-google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn-google svg { width: 18px; height: 18px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
label.field > span em { font-weight: 400; color: var(--muted); font-style: normal; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
input[readonly] { background: var(--surface-2); color: var(--ink-2); }
textarea { resize: vertical; min-height: 92px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.counter { float: right; font-weight: 400; color: var(--muted); }

/* ------------------------------------------------------------ cards / chips */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 2px var(--surface); }
.dot.activo { background: var(--active); }
.dot.proximo { background: var(--upcoming); }
.dot.finalizado { background: var(--finished); }
.dot.pendiente { background: var(--warning); }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.status svg { width: 13px; height: 13px; }
.status.aprobado, .status.activo { color: var(--good-ink); }
.status.pendiente { color: var(--ink); }
.status.pendiente svg { color: #b57d00; }
.status.rechazado { color: var(--critical); }
.status.cancelado { color: var(--muted); }

.alert {
  border-radius: 12px; padding: 12px 14px; margin: 12px 0; border: 1px solid var(--line);
  background: var(--surface-2); display: flex; gap: 10px; align-items: flex-start;
}
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 2px; }
.alert.warn { background: color-mix(in srgb, var(--warning) 14%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }
.alert.warn svg { color: #b57d00; }
.alert.error { background: color-mix(in srgb, var(--critical) 10%, var(--surface)); border-color: color-mix(in srgb, var(--critical) 35%, var(--line)); }
.alert.error svg { color: var(--critical); }
.alert.ok { background: color-mix(in srgb, var(--good) 10%, var(--surface)); border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.alert.ok svg { color: var(--good-ink); }

/* ------------------------------------------------------------ hero */
.hero { position: relative; height: min(74vh, 680px); min-height: 520px; background: #1b261f; }
.hero #map { position: absolute; inset: 0; }
.hero-panel {
  position: absolute; z-index: 500; left: max(16px, calc((100vw - 1240px) / 2 + 16px)); top: 28px; width: min(420px, calc(100% - 32px));
  background: rgba(12, 20, 15, .78); color: #f3f6f2; backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 18px; padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.hero-panel .kicker { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: #b9d7c1; font-weight: 700; }
.hero-panel h1 { font-size: 1.7rem; margin: 6px 0 14px; }
.hero-figure { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 6px; }
.hero-figure strong { font-size: 3.6rem; line-height: 1; font-weight: 750; letter-spacing: -0.03em; }
.hero-figure span { font-size: 1.02rem; color: #d7e2da; }
.hero-sub { color: #c5d2c9; font-size: .92rem; margin-bottom: 16px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.hero-actions .btn.ghost:hover { background: rgba(255,255,255,.1); }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--active); display: inline-block; position: relative; top: -2px; }
.pulse::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--active); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse::after { animation: none; } }

.map-legend {
  position: absolute; z-index: 500; right: 12px; bottom: 84px; max-width: calc(100% - 24px); display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
}
.map-legend button {
  display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer;
  background: rgba(255,255,255,.94); color: #13201a; font: 600 .8rem var(--font);
  padding: 6px 11px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.map-legend button.off { opacity: .5; text-decoration: line-through; }
.map-legend .sw { width: 12px; height: 12px; border-radius: 3px; }
.map-legend .sw.campo { background: transparent; border: 2px dashed var(--campo); }
@media (max-width: 700px) {
  .hero { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .hero #map { position: relative; height: 58vh; order: 2; }
  .hero-panel { position: relative; left: 0; top: 0; width: 100%; border-radius: 0; order: 1; }
  .hero-figure strong { font-size: 3rem; }
  .map-legend { top: auto; bottom: 30px; right: 8px; max-width: calc(100% - 16px); }
  .map-legend button { padding: 5px 9px; font-size: .74rem; }
}

/* ------------------------------------------------------------ stats */
.section { padding: 34px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head p { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-top: -48px; position: relative; z-index: 600; }
@media (max-width: 700px) { .tiles { margin-top: 16px; } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.tile .label { font-size: .84rem; color: var(--ink-2); display: flex; align-items: center; gap: 7px; }
.tile .value { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0 0; }
.tile .value small { font-size: 1rem; font-weight: 600; color: var(--ink-2); margin-left: 3px; }
.tile .sub { font-size: .8rem; color: var(--muted); }
.meter { height: 6px; border-radius: 99px; background: var(--brand-2); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }

.grid2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.halves { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid2 > *, .grid3 > *, .halves > *, .tiles > * { min-width: 0; }
.grid3 { align-items: start; }
@media (min-width: 701px) { .hero .leaflet-bottom { bottom: 56px; } }
@media (max-width: 900px) { .grid2, .grid3, .halves { grid-template-columns: 1fr; } }

/* column chart */
.cols { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 180px; padding-top: 22px; border-bottom: 1px solid var(--line); }
.cols .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; position: relative; cursor: default; }
.cols .col i { display: block; width: min(24px, 70%); background: var(--bar); border-radius: 4px 4px 0 0; min-height: 2px; }
.cols .col.current i { background: var(--active); }
.cols .col.future i { background: repeating-linear-gradient(135deg, var(--bar) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px var(--bar); }
.cols .col .v { position: absolute; font-size: .78rem; font-weight: 700; color: var(--ink); }
.cols .col:hover i { filter: brightness(.9); }
.xlabels { display: flex; gap: 2px; margin-top: 6px; }
.xlabels span { flex: 1; text-align: center; font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.xlabels span.current { color: var(--ink); font-weight: 700; }
.xlabels span, .cols .col { min-width: 0; }
@media (max-width: 560px) { .xlabels span:not(:nth-child(3n)):not(.current) { visibility: hidden; } .xlabels span { overflow: visible; } }

/* bar list */
.bars { display: grid; gap: 10px; }
.bars .b { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; align-items: center; gap: 10px; font-size: .86rem; }
.bars .b .t { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .b .track { display: flex; align-items: center; gap: 8px; }
.bars .b i { display: block; height: 14px; background: var(--brand); border-radius: 0 4px 4px 0; min-width: 3px; }
.bars .b b { font-size: .82rem; }

.tip {
  position: fixed; z-index: 3000; pointer-events: none; background: #13201a; color: #fff; padding: 6px 9px;
  border-radius: 8px; font-size: .8rem; box-shadow: 0 6px 18px rgba(0,0,0,.25); white-space: nowrap;
}

/* lists */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .t { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mini-list .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list .d { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.empty { color: var(--muted); font-size: .9rem; padding: 14px 0; }


/* ------------------------------------------------------------ app layouts */
.split { display: grid; grid-template-columns: 400px 1fr; height: calc(100vh - 61px); }
.split .side { overflow-y: auto; border-right: 1px solid var(--line); background: var(--surface); }
.split .side-inner { padding: 18px; }
.split .mapcol { position: relative; }
.split .mapcol #map { position: absolute; inset: 0; }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; height: auto; }
  .split .mapcol { height: 60vh; order: -1; }
  .split .side { border-right: 0; }
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.filters button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
  font: 600 .82rem var(--font); padding: 6px 11px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
}
.filters button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.filters button .n { font-weight: 500; opacity: .75; }

.exp-list { list-style: none; margin: 0; padding: 0; }
.exp-item { padding: 12px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; display: grid; gap: 4px; }
.exp-item:hover { background: var(--surface-2); }
.exp-item.sel { border-color: var(--brand); background: var(--brand-2); }
.exp-item .top { display: flex; align-items: center; gap: 8px; }
.exp-item .top strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-item .meta { font-size: .8rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.progress { height: 4px; background: var(--surface-2); border-radius: 9px; overflow: hidden; margin-top: 4px; }
.progress i { display: block; height: 100%; background: var(--active); border-radius: 9px; }

.detail h3 { font-size: 1.15rem; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0; font-size: .9rem; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }
.detail .desc { white-space: pre-line; }
.detail .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; margin-bottom: 10px; cursor: pointer; color: var(--ink-2); background: none; border: 0; padding: 0; font-family: inherit; }

/* ------------------------------------------------------------ solicitar */
.req { display: grid; grid-template-columns: 1fr 440px; height: calc(100vh - 61px); }
.req .mapcol { position: relative; }
.req .mapcol #map { position: absolute; inset: 0; }
.req .side { overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); }
.req .side-inner { padding: 20px; }
@media (max-width: 1000px) {
  .req { grid-template-columns: 1fr; height: auto; }
  .req .mapcol { height: 62vh; }
  .req .side { border-left: 0; }
}
.map-hint {
  position: absolute; z-index: 600; left: 50%; top: 14px; transform: translateX(-50%); max-width: calc(100% - 120px);
  background: rgba(12,20,15,.85); color: #fff; padding: 9px 14px; border-radius: 12px; font-size: .88rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); text-align: center;
}
@media (max-width: 700px) { .map-hint { font-size: .78rem; padding: 7px 10px; max-width: calc(100% - 130px); } }
.area-badge { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--brand-2); margin-bottom: 14px; }
.area-badge strong { font-size: 1.3rem; }
.history { margin-top: 18px; }
.hist-summary { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.hist-summary .chip { font-size: .8rem; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 16px 24px; }
.timeline li .dot { position: absolute; left: 2px; top: 6px; }
.timeline .hcard { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: var(--surface); }
.timeline .hcard.conflict { border-color: color-mix(in srgb, var(--warning) 70%, var(--line)); background: color-mix(in srgb, var(--warning) 7%, var(--surface)); }
.timeline .hcard .when { font-size: .8rem; color: var(--muted); }
.timeline .hcard .desc { font-size: .86rem; color: var(--ink-2); margin: 6px 0; white-space: pre-line; }
.timeline .hcard .who { font-size: .8rem; color: var(--ink-2); display: flex; gap: 10px; flex-wrap: wrap; }
.success { text-align: center; padding: 30px 10px; }
.success .big { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--good-ink); }

/* ------------------------------------------------------------ page */
.page { padding: 28px 0 60px; }
.req-cards { display: grid; gap: 12px; }
.req-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: start; }
.req-card .meta { font-size: .84rem; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.req-card .note { font-size: .86rem; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; margin-top: 6px; }
.req-card .right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
@media (max-width: 600px) { .req-card { grid-template-columns: 1fr; } .req-card .right { align-items: flex-start; flex-direction: row; } }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-grid .mapbox { position: sticky; top: 76px; height: calc(100vh - 100px); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.admin-grid .mapbox #map { height: 100%; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } .admin-grid .mapbox { position: relative; top: 0; height: 50vh; } }
.req-card.sel { outline: 2px solid var(--brand); }

.toast {
  position: fixed; z-index: 4000; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #13201a; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.3); font-size: .92rem;
}
.toast.error { background: var(--critical); }

/* ------------------------------------------------------------ leaflet tweaks */
.leaflet-container { font-family: var(--font); background: #1b261f; }
.leaflet-tooltip.exp-tip { font: 600 .8rem var(--font); padding: 5px 9px; border-radius: 8px; border: 0; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.leaflet-popup-content { margin: 12px 14px; font-size: .88rem; }
.leaflet-popup-content .btn { margin-top: 8px; }
.leaflet-container a.btn:not(.ghost):not(.btn-google) { color: var(--brand-ink); }
.leaflet-container a.btn.ghost { color: var(--ink); }
.leaflet-container a.btn-google { color: #1f1f1f; }

footer { border-top: 1px solid var(--line); padding: 20px 0 30px; color: var(--muted); font-size: .84rem; }

/* investigadores en el formulario */
.flabel { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
.flabel em { font-weight: 400; color: var(--muted); font-style: normal; }
.inv-row { display: grid; grid-template-columns: 1fr 1fr 38px; gap: 8px; margin-bottom: 8px; }
.inv-row.bad input { border-color: var(--critical); }
.inv-del {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.inv-del:hover { background: var(--surface-2); color: var(--critical); }
.inv-del svg { width: 16px; height: 16px; }

.who { font-size: .82rem; color: var(--ink-2); margin-top: 4px; }

/* ------------------------------------------------------------ temas (tags) */
.chip.t { background: var(--brand-2); color: var(--brand); font-weight: 600; }
#detail .chip.t { cursor: pointer; }
#detail .chip.t:hover { filter: brightness(.95); }
.tag-input { position: relative; }
.tag-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 46px; padding: 6px 8px; cursor: text;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
.tag-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.tag-box input { flex: 1; min-width: 150px; border: 0; padding: 5px 4px; background: transparent; }
.tag-box input:focus { box-shadow: none; border: 0; }
.tag {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px 3px 3px 10px; border-radius: 999px;
  background: var(--brand-2); color: var(--brand); font-weight: 600; font-size: .86rem; white-space: nowrap;
}
.tag button {
  width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 50%; padding: 0;
  background: transparent; color: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer;
}
.tag button:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); }
.tag-sugg {
  position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px); max-height: 300px; overflow-y: auto;
  list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.tag-sugg .hdr { padding: 4px 10px 6px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tag-sugg [role="option"] { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: .92rem; }
.tag-sugg [role="option"].on, .tag-sugg [role="option"]:hover { background: var(--brand-2); }
.tag-sugg .n { flex: none; font-size: .78rem; color: var(--muted); }
.tag-sugg mark { background: transparent; color: var(--brand); font-weight: 700; }
.tag-sugg .new { color: var(--ink-2); }
.tag-sugg .hdr + .new, .tag-sugg [role="option"] + .new { margin-top: 4px; box-shadow: inset 0 1px 0 var(--line); }
