:root {
  color-scheme: dark;
  --ink: #07162f;
  --navy: #092a62;
  --blue: #1459b8;
  --cyan: #31c9d9;
  --gold: #dfb568;
  --paper: #f4f7fb;
  --muted: #91a3bf;
  --line: rgba(157, 185, 225, .18);
  --panel: rgba(8, 29, 67, .84);
  --panel-solid: #0a2553;
  --success: #51d29b;
  --warning: #f2c56b;
  --danger: #ff7a88;
  --shadow: 0 24px 80px rgba(0, 8, 29, .32);
  font-family: Inter, "SF Pro Display", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #06152e; }
body { margin: 0; min-height: 100vh; color: #f7fbff; background: radial-gradient(circle at 48% -15%, #174f95 0, #0b2d65 28%, #06162f 67%, #041024 100%); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }

.ambient { position: fixed; z-index: 0; width: 32rem; height: 32rem; border-radius: 50%; filter: blur(90px); opacity: .18; pointer-events: none; }
.ambient-one { top: -12rem; left: -10rem; background: #2bcfe1; }
.ambient-two { right: -12rem; bottom: -13rem; background: #0d72dd; }
.eyebrow { margin: 0 0 .4rem; color: #5ad7e3; font-size: .72rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }

.login-shell { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(100%, 29rem); padding: 3.25rem; text-align: center; border: 1px solid rgba(146, 194, 255, .2); border-radius: 2rem; background: linear-gradient(155deg, rgba(16, 53, 106, .92), rgba(5, 22, 52, .96)); box-shadow: var(--shadow); backdrop-filter: blur(24px); }
.brand-mark { width: 4.75rem; height: 4.75rem; margin: 0 auto 1.5rem; display: grid; place-items: center; border-radius: 1.4rem; color: #062253; background: linear-gradient(145deg, #eefcff, #35c9dc); box-shadow: 0 18px 44px rgba(43, 208, 226, .22); transform: rotate(-6deg); }
.brand-mark span { font-size: 1.22rem; font-weight: 900; transform: rotate(6deg); }
.login-card h1 { margin: 0; font-size: clamp(2.2rem, 7vw, 3.5rem); letter-spacing: -.055em; }
.login-lead { max-width: 22rem; margin: 1rem auto 2rem; color: #afc1db; line-height: 1.55; }
.login-form { display: grid; gap: 1rem; text-align: left; }
.login-form label { display: grid; gap: .45rem; color: #c9d7e8; font-size: .82rem; font-weight: 700; }
.login-form input { width: 100%; padding: .95rem 1rem; color: white; border: 1px solid rgba(148, 185, 232, .24); border-radius: .85rem; outline: none; background: rgba(3, 17, 42, .62); transition: border-color .2s, box-shadow .2s; }
.login-form input:focus { border-color: #42cfdd; box-shadow: 0 0 0 4px rgba(66, 207, 221, .12); }
.primary-button { min-height: 3.3rem; padding: .8rem 1.2rem; border: 0; border-radius: .9rem; color: #07214c; background: linear-gradient(135deg, #6ce5ea, #e1bd76); font-weight: 900; box-shadow: 0 14px 36px rgba(68, 198, 212, .18); }
.form-error { min-height: 1.25rem; margin: -.25rem 0 0; color: #ff9da8; font-size: .82rem; }
.secure-note { margin: 1.5rem 0 0; color: #7188a9; font-size: .78rem; }

.app-shell { position: relative; z-index: 1; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 5.6rem; padding: 1rem clamp(1rem, 4vw, 3.5rem); border-bottom: 1px solid var(--line); background: rgba(4, 18, 42, .82); backdrop-filter: blur(22px); }
.brand-lockup { display: flex; align-items: center; gap: 1rem; }
.brand-lockup h1 { margin: 0; font-size: 1.25rem; letter-spacing: -.02em; }
.brand-lockup .eyebrow { margin-bottom: .18rem; font-size: .62rem; }
.brand-mark-small { width: 3rem; height: 3rem; margin: 0; border-radius: .9rem; }
.brand-mark-small span { font-size: .88rem; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.live-time { display: flex; align-items: center; gap: .55rem; padding: .72rem .9rem; border: 1px solid var(--line); border-radius: .8rem; color: #aebfd6; background: rgba(13, 44, 93, .55); font-size: .78rem; }
.live-time strong { color: white; font-size: .95rem; }
.live-dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 .28rem rgba(81, 210, 155, .12); }
.icon-button, .text-button { min-height: 2.75rem; border: 1px solid var(--line); border-radius: .8rem; background: rgba(13, 44, 93, .55); }
.icon-button { width: 2.75rem; padding: .7rem; }
.icon-button svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.text-button { padding: 0 1rem; color: #c0cce0; font-weight: 700; }
.icon-button:hover, .text-button:hover { border-color: rgba(81, 208, 221, .55); color: white; }

.overview { padding: 2.6rem clamp(1rem, 4vw, 3.5rem) 1.35rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.section-heading h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.45rem); letter-spacing: -.045em; }
.sync-label { margin: 0; color: #8195b2; font-size: .77rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .85rem; }
.kpi-card { min-height: 7.6rem; padding: 1.05rem; border: 1px solid var(--line); border-radius: 1.15rem; background: linear-gradient(155deg, rgba(17, 54, 108, .88), rgba(7, 29, 68, .84)); box-shadow: 0 14px 38px rgba(0, 10, 32, .14); }
.kpi-card.accent { background: linear-gradient(145deg, #3dccd8, #1674c7); border-color: transparent; }
.kpi-card.warning { background: linear-gradient(145deg, #c89b51, #805d2e); border-color: transparent; }
.kpi-icon { width: 2.1rem; height: 2.1rem; display: grid; place-items: center; margin-bottom: .85rem; border-radius: .65rem; background: rgba(255, 255, 255, .1); font-weight: 900; }
.kpi-value { display: block; font-size: 1.85rem; font-weight: 900; letter-spacing: -.045em; }
.kpi-label { color: #aabbd1; font-size: .73rem; line-height: 1.35; }
.kpi-card.accent .kpi-label, .kpi-card.warning .kpi-label { color: rgba(255, 255, 255, .78); }
.current-events { display: flex; gap: .75rem; margin-top: .85rem; overflow-x: auto; scrollbar-width: thin; }
.event-chip { min-width: 17rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: .95rem; background: rgba(5, 25, 58, .7); }
.event-chip span { color: #5edce5; font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.event-chip strong { display: block; margin: .25rem 0 .2rem; font-size: .88rem; }
.event-chip small { color: #8fa3be; }

.workspace { display: grid; grid-template-columns: minmax(21rem, 27rem) minmax(0, 1fr); gap: 1rem; height: calc(100vh - 20.2rem); min-height: 39rem; padding: 0 clamp(1rem, 4vw, 3.5rem) 2rem; }
.directory-panel, .person-panel { min-height: 0; border: 1px solid var(--line); border-radius: 1.35rem; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.directory-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr); overflow: hidden; }
.directory-controls { padding: 1rem; border-bottom: 1px solid var(--line); }
.search-field { position: relative; display: block; }
.search-field svg { position: absolute; top: 50%; left: .85rem; width: 1.1rem; transform: translateY(-50%); fill: none; stroke: #7f94b1; stroke-width: 1.8; }
.search-field input { width: 100%; padding: .85rem .9rem .85rem 2.6rem; color: white; border: 1px solid var(--line); border-radius: .85rem; outline: none; background: rgba(2, 16, 39, .52); }
.search-field input:focus { border-color: #44cbd8; }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: .75rem; }
.filter-row label { display: grid; gap: .3rem; color: #8195b2; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.filter-row select, .editor-grid select, .editor-grid input, .notes-field textarea { width: 100%; padding: .72rem .75rem; color: #eaf3ff; border: 1px solid var(--line); border-radius: .7rem; outline: none; background: #0a2758; }
.directory-summary { display: flex; align-items: baseline; gap: .35rem; padding: .7rem 1rem; color: #7f94b2; border-bottom: 1px solid var(--line); font-size: .72rem; }
.directory-summary strong { color: white; font-size: 1rem; }
.people-list { overflow-y: auto; scrollbar-color: #1c579c transparent; }
.person-row { width: 100%; display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .86rem 1rem; text-align: left; border: 0; border-bottom: 1px solid rgba(154, 182, 221, .1); background: transparent; }
.person-row:hover { background: rgba(49, 117, 195, .12); }
.person-row.selected { background: linear-gradient(90deg, rgba(40, 195, 210, .18), rgba(25, 87, 166, .16)); box-shadow: inset 3px 0 0 #47d2dc; }
.avatar { width: 3rem; height: 3.35rem; display: grid; place-items: center; overflow: hidden; border-radius: .8rem; color: #5bd9e3; background: linear-gradient(145deg, #173d75, #0a224c); font-weight: 900; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-row-copy { min-width: 0; }
.person-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.person-row small { display: block; margin-top: .2rem; overflow: hidden; color: #8298b7; text-overflow: ellipsis; white-space: nowrap; font-size: .68rem; }
.row-meta { display: grid; justify-items: end; gap: .35rem; }
.status-pill, .micro-pill { display: inline-flex; align-items: center; gap: .35rem; width: max-content; padding: .28rem .48rem; border-radius: 999px; font-size: .61rem; font-weight: 900; }
.status-pill::before { content: ""; width: .38rem; height: .38rem; border-radius: 50%; background: currentColor; }
.status-unknown { color: #9fb0c7; background: rgba(159, 176, 199, .12); }
.status-expected { color: #f1c66d; background: rgba(241, 198, 109, .12); }
.status-en_route { color: #62cced; background: rgba(98, 204, 237, .12); }
.status-present { color: #55dda4; background: rgba(85, 221, 164, .12); }
.status-absent, .status-wont_come { color: #ff8793; background: rgba(255, 135, 147, .12); }
.status-departed { color: #a7a9e8; background: rgba(167, 169, 232, .12); }
.micro-pill { color: #f0c879; background: rgba(240, 200, 121, .1); }

.person-panel { overflow-y: auto; padding: clamp(1rem, 2.5vw, 2rem); }
.person-panel.empty-state { display: grid; place-content: center; justify-items: center; text-align: center; color: #8da0ba; }
.person-panel.empty-state h2 { margin: 1.5rem 0 .5rem; color: white; }
.person-panel.empty-state p { max-width: 32rem; margin: 0; line-height: 1.6; }
.empty-illustration { position: relative; width: 9rem; height: 4rem; }
.empty-illustration::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, #2ac7d8, transparent); }
.empty-illustration span { position: absolute; top: 50%; width: 1rem; height: 1rem; border: 3px solid #31c9d9; border-radius: 50%; background: #092554; transform: translateY(-50%); box-shadow: 0 0 0 .45rem rgba(49, 201, 217, .1); }
.empty-illustration span:nth-child(1) { left: 12%; }.empty-illustration span:nth-child(2) { left: 46%; }.empty-illustration span:nth-child(3) { right: 12%; }

.person-header { display: grid; grid-template-columns: 6rem minmax(0, 1fr) auto; gap: 1.25rem; align-items: start; padding-bottom: 1.45rem; border-bottom: 1px solid var(--line); }
.person-photo { width: 6rem; height: 7rem; overflow: hidden; border: 1px solid rgba(86, 210, 221, .3); border-radius: 1.15rem; background: #0c2b5e; }
.person-photo img { width: 100%; height: 100%; object-fit: cover; }
.person-photo .avatar { width: 100%; height: 100%; border-radius: 0; font-size: 1.6rem; }
.person-title h2 { margin: .25rem 0 .5rem; font-size: clamp(1.45rem, 3vw, 2.2rem); line-height: 1.05; letter-spacing: -.045em; }
.person-title p { margin: .2rem 0; color: #9fb1c8; font-size: .82rem; line-height: 1.45; }
.person-badges { display: flex; flex-wrap: wrap; gap: .42rem; margin-top: .75rem; }
.panel-nav { display: flex; gap: .45rem; }
.panel-nav button { width: 2.6rem; height: 2.6rem; border: 1px solid var(--line); border-radius: .75rem; background: rgba(4, 21, 49, .62); font-size: 1.2rem; }
.panel-nav button:disabled { opacity: .3; cursor: default; }
.position-card { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr) minmax(0, .8fr); gap: .75rem; margin: 1rem 0; }
.position-block { min-height: 7.4rem; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(3, 19, 45, .46); }
.position-block.current { border-color: rgba(66, 210, 220, .38); background: linear-gradient(145deg, rgba(27, 124, 177, .28), rgba(7, 37, 79, .68)); }
.position-block span { color: #6edbe4; font-size: .63rem; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; }
.position-block h3 { margin: .55rem 0 .35rem; font-size: .95rem; line-height: 1.35; }
.position-block p { margin: 0; color: #8fa4bf; font-size: .72rem; line-height: 1.4; }
.editor-card { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(7, 31, 70, .62); }
.editor-card h3, .timeline-section h3 { margin: 0 0 .9rem; font-size: 1rem; }
.editor-grid { display: grid; grid-template-columns: 13rem minmax(0, 1fr) auto; gap: .75rem; align-items: end; }
.editor-grid label, .notes-field { display: grid; gap: .35rem; color: #7f94b2; font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.save-button { min-height: 2.65rem; padding: .65rem 1rem; border: 0; border-radius: .72rem; color: #06234e; background: linear-gradient(135deg, #5edce5, #d8b56d); font-weight: 900; }
.notes-field { margin-top: .75rem; }
.notes-field textarea { min-height: 4.8rem; resize: vertical; text-transform: none; letter-spacing: normal; font-weight: 500; line-height: 1.4; }
.travel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 1rem 0; }
.travel-card { padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: rgba(3, 19, 45, .42); }
.travel-card .travel-label { color: #6edbe4; font-size: .63rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.travel-time { margin: .55rem 0 .35rem; font-size: 1.25rem; font-weight: 900; }
.travel-card p { margin: .25rem 0; color: #9db0c9; font-size: .75rem; line-height: 1.45; white-space: pre-line; }
.timeline-section { margin-top: 1.25rem; }
.timeline { position: relative; margin: 0; padding: 0 0 0 1.25rem; list-style: none; }
.timeline::before { content: ""; position: absolute; top: .45rem; bottom: .45rem; left: .34rem; width: 1px; background: linear-gradient(#2bd0dd, rgba(43, 208, 221, .12)); }
.timeline-item { position: relative; display: grid; grid-template-columns: 7.6rem minmax(0, 1fr); gap: 1rem; padding: 0 0 1rem 1rem; }
.timeline-item::before { content: ""; position: absolute; top: .35rem; left: -.98rem; width: .66rem; height: .66rem; border: 2px solid #2acbd9; border-radius: 50%; background: #0a2553; }
.timeline-item.past { opacity: .5; }.timeline-item.active { opacity: 1; }
.timeline-item.active::before { background: #5de0e7; box-shadow: 0 0 0 .42rem rgba(70, 213, 222, .13); }
.timeline-time { color: #8fa3be; font-size: .68rem; line-height: 1.45; }
.timeline-copy strong { display: block; font-size: .82rem; line-height: 1.35; }
.timeline-copy p { margin: .2rem 0 0; color: #8297b3; font-size: .68rem; line-height: 1.4; }
.timeline-copy .closed-label { display: inline-block; margin-top: .35rem; color: #f1c56c; font-size: .58rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.toast { position: fixed; z-index: 50; right: 1.2rem; bottom: 1.2rem; max-width: 22rem; padding: .85rem 1rem; border: 1px solid rgba(102, 220, 226, .35); border-radius: .8rem; color: white; background: #0c3369; box-shadow: var(--shadow); opacity: 0; transform: translateY(1rem); pointer-events: none; transition: .25s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255, 122, 136, .45); background: #5a1e36; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .workspace { height: calc(100vh - 29rem); min-height: 42rem; grid-template-columns: minmax(19rem, 23rem) minmax(0, 1fr); }
  .position-card { grid-template-columns: 1fr 1fr; }.position-block.current { grid-column: 1 / -1; }
  .editor-grid { grid-template-columns: 1fr 1fr; }.save-button { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .topbar { align-items: flex-start; }.live-time span:not(.live-dot) { display: none; }.text-button { display: none; }
  .overview { padding-top: 1.5rem; }.kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace { display: block; height: auto; min-height: 0; }
  .directory-panel { height: 34rem; margin-bottom: 1rem; }
  .person-panel { min-height: 36rem; max-height: none; }
  .person-header { grid-template-columns: 5rem minmax(0, 1fr); }.person-photo { width: 5rem; height: 6rem; }.panel-nav { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 560px) {
  .topbar { padding: .85rem; }.brand-lockup .eyebrow { display: none; }.brand-lockup h1 { font-size: 1rem; }.brand-mark-small { width: 2.6rem; height: 2.6rem; }
  .overview, .workspace { padding-left: .7rem; padding-right: .7rem; }
  .section-heading { align-items: start; }.sync-label { max-width: 8rem; text-align: right; }
  .kpi-grid { gap: .55rem; }.kpi-card { min-height: 6.7rem; padding: .85rem; }.kpi-value { font-size: 1.5rem; }
  .filter-row, .travel-grid, .position-card, .editor-grid { grid-template-columns: 1fr; }
  .position-block.current, .save-button { grid-column: auto; }
  .person-panel { padding: 1rem; }.person-header { gap: .85rem; }.person-title h2 { font-size: 1.35rem; }
  .timeline-item { grid-template-columns: 5.2rem minmax(0, 1fr); gap: .65rem; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
