:root {
  --navy: #0e2439;
  --navy-2: #17324c;
  --bg: #eef2f6;
  --sidebar: #f6f8fb;
  --card: #ffffff;
  --text: #1c2833;
  --muted: #5d6d7c;
  --line: #e2e8ef;
  --blue: #1f6feb;
  --blue-soft: #e7f0ff;
  --green: #18794e;
  --green-soft: #e5f6ee;
  --red: #b42318;
  --amber: #9a6700;
  --shadow: 0 1px 2px rgba(14, 36, 57, .06), 0 10px 28px rgba(14, 36, 57, .05);
  --radius: 14px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); }

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, var(--navy) 0 180px, var(--bg) 180px);
  padding: 24px;
}
.login-card {
  width: min(440px, 100%);
  background: white;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--navy); color: white; display: grid; place-items: center; font-weight: 700;
}
.login h1 { margin: 18px 0 6px; font-size: 28px; }
.muted { color: var(--muted); }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: white;
}
textarea { min-height: 80px; }
.btn {
  border: 0; border-radius: 10px; padding: 10px 14px; background: var(--blue); color: white; font-weight: 700;
}
.btn.secondary { background: white; color: var(--text); border: 1px solid var(--line); }
.btn.dark { background: #1c2430; color: white; }
.btn.tiny { background: white; color: var(--text); border: 1px solid #d7e0e8; border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 650; }
.btn.tiny.danger { color: #c24545; border-color: #f0c9c9; }
.btn.outline { background: transparent; color: white; border: 1px solid rgba(255,255,255,.55); border-radius: 8px; padding: 6px 12px; font-weight: 650; }
.btn.ghost { background: transparent; color: var(--navy); }
.btn.warn { background: #9a3412; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; }
.login .btn { width: 100%; margin-top: 16px; }
details.demo { margin-top: 16px; background: var(--blue-soft); border-radius: 12px; padding: 10px 12px; }
details.demo summary { cursor: pointer; font-weight: 700; }

.shell { min-height: 100%; display: grid; grid-template-rows: auto 1fr; }
.topbar {
  background: #0e1c33; color: white; display: flex; align-items: center; gap: 14px; padding: 0 18px; min-height: 64px;
}
.topbar .brand { font-size: 18px; gap: 8px; }
.topbar .brand-mark, .topbar .avatar { background: white; color: #0e1c33; }
.env-pill {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 3px 8px; color: rgba(255,255,255,.9);
}
.topbar .search {
  background: rgba(255,255,255,.08); color: white; border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px; padding: 8px 12px; width: min(320px, 28vw);
}
.topbar .search::placeholder { color: rgba(255,255,255,.55); }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 14px; font-weight: 600; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 0; }
.sidebar { background: #f7f9fb; border-right: 1px solid #e7edf3; padding: 8px 10px 18px; }
.nav-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #93a0ad; font-weight: 700; padding: 16px 12px 6px; }
.nav-btn {
  width: 100%; text-align: left; background: transparent; border: 0; border-radius: 10px;
  padding: 9px 12px; color: #3d4d5c; font-weight: 600; margin-bottom: 2px;
  display: flex; align-items: center; gap: 10px;
}
.nav-btn svg { flex: none; opacity: .8; }
.nav-btn.active { background: #e7f1fb; color: #1d4f91; }
.nav-btn.active svg { opacity: 1; }
.main { padding: 28px 32px; overflow: auto; background: #f3f6f9; }
.page-title, .page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.page-title h1, .page-head h1 { margin: 0; font-size: 32px; letter-spacing: -.02em; }
.page-head p, .page-title .hint { color: #6d7b89; margin: 6px 0 0; font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.card, .panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.stat { text-align: left; border: 0; width: 100%; }
.stat .k { color: var(--muted); font-weight: 600; }
.stat .v { font-size: 30px; font-weight: 700; margin-top: 4px; }
.stat:hover { outline: 2px solid var(--blue-soft); }
.section { margin-top: 18px; }
.section h2 { margin: 0 0 10px; font-size: 18px; }
table.data { width: 100%; border-collapse: collapse; background: white; }
table.data th, table.data td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { color: #8b97a3; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover { background: #f7fbff; }
.pill { display: inline-block; border-radius: 999px; padding: 2px 8px; background: var(--blue-soft); color: var(--navy); font-weight: 700; font-size: 12px; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: #fff4d6; color: var(--amber); }
.pill.red { background: #fee4e2; color: var(--red); }
.banner {
  background: #fff7e8; border: 1px solid #f3d7a1; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px;
}
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 12px; }
.grid-wrap { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; max-height: calc(100vh - 230px); }
.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.grid th, .grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: white; }
.grid th { position: sticky; top: 0; z-index: 3; background: #f8fafc; font-size: 13px; text-align: left; padding: 0; }
.grid th .th { display: flex; align-items: center; gap: 4px; padding: 8px; cursor: pointer; }
.grid th.filter input, .grid th.filter select { width: 100%; border: 0; border-radius: 0; padding: 6px 8px; background: #f3f6fa; }
.grid td { padding: 0; height: 36px; }
.grid td .cell { padding: 7px 8px; min-height: 36px; outline: none; }
.grid td.active .cell { box-shadow: inset 0 0 0 2px var(--blue); }
.grid td.selected .cell { background: #eaf2ff; }
.grid td input.editor, .grid td select.editor { width: 100%; height: 36px; border: 0; border-radius: 0; padding: 6px 8px; box-shadow: inset 0 0 0 2px var(--blue); }
.grid .freeze { position: sticky; z-index: 2; }
.grid thead .freeze { z-index: 4; }
.check { width: 36px; text-align: center; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.modal-back { position: fixed; inset: 0; background: rgba(14, 28, 51, .45); display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal { width: min(480px, 100%); background: white; border-radius: 16px; padding: 0; box-shadow: var(--shadow); max-height: min(88vh, 820px); overflow: auto; }
.modal h2, .drawer h2 { margin: 0; font-size: 20px; }
.modal .body, .drawer .body { padding: 18px 20px 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid #eef2f6; position: sticky; top: 0; background: white; z-index: 1; }
.icon-x { width: 32px; height: 32px; border-radius: 50%; border: 1px solid #e4eaf0; background: white; color: #526273; font-size: 18px; line-height: 1; }
.drawer-back { position: fixed; inset: 0; background: rgba(14, 28, 51, .35); z-index: 15; display: flex; justify-content: flex-end; }
.drawer { width: min(460px, 100%); background: white; height: 100%; overflow: auto; padding: 0; box-shadow: var(--shadow); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .field > label { font-weight: 700; margin: 0; }
.field input, .field select, .field textarea { border-radius: 12px; padding: 12px 14px; background: #fbfcfd; }
.choice-box { background: #f4f7fb; border-radius: 14px; padding: 12px; margin: 8px 0 16px; }
.choice-box h3 { margin: 2px 6px 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #7b8794; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { display: flex; align-items: center; gap: 8px; background: white; border: 1px solid #e6edf4; border-radius: 10px; padding: 10px 12px; font-weight: 650; }
.choice input { width: auto; margin: 0; }
.choice.wide { grid-column: 1 / -1; }
.sheet { background: white; border: 1px solid #e7edf3; border-radius: 16px; box-shadow: 0 1px 2px rgba(16,24,40,.04); margin-bottom: 16px; overflow: auto; }
.sheet > h2 { margin: 14px 18px 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #8b97a3; }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th { text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #8b97a3; font-weight: 700; padding: 10px 16px; border-bottom: 1px solid #eef2f6; }
.sheet-table td { padding: 14px 16px; border-bottom: 1px solid #f3f6f9; vertical-align: middle; }
.sheet-table tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; border-radius: 6px; padding: 4px 8px; white-space: nowrap; }
.sheet-table td .row { flex-wrap: nowrap; }
.sheet-table .btn.tiny { white-space: nowrap; }
.badge.dark { background: #1c2430; color: white; }
.badge.soft { background: #e5f6ee; color: #157a45; }
.you { color: #8b97a3; font-weight: 600; font-size: 14px; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; display: inline-block; }
.dot.off { background: #c5ced6; }
.acting { background: #e7f1fb; color: #1d4f91; padding: 8px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.acting button { background: white; border: 1px solid #c5d7ee; border-radius: 8px; padding: 6px 10px; font-weight: 700; color: #1d4f91; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.toast { position: fixed; bottom: 16px; right: 16px; background: var(--navy); color: white; padding: 12px 14px; border-radius: 12px; z-index: 30; }
.perm-table { width: 100%; }
.perm-table td, .perm-table th { padding: 6px; border-bottom: 1px solid var(--line); }
.split { display: grid; grid-template-columns: 280px 1fr; gap: 14px; }
.person { width: 100%; text-align: left; background: white; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; vertical-align: middle; margin-right: 6px; background: var(--navy); color: white; font-size: 11px; font-weight: 700; }
.avatar.letters { line-height: 28px; text-align: center; }
.who-line, .cell { display: flex; align-items: center; gap: 6px; }
.tag { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: #eef2f6; color: var(--muted); }
.tag.on { background: var(--green-soft); color: var(--green); }
a.tel { color: inherit; text-decoration: none; }
a.tel:hover { text-decoration: underline; }
a.jt-link { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); }
a.jt-link:hover { background: #d6e6ff; }
.contact-form { display: grid; gap: 10px; margin: 12px 0; }
.contact-form label { display: grid; gap: 4px; font-weight: 600; }
.contact-form input { font-weight: 400; }
.company-switch { position: relative; }
.switch-btn, .company-menu button { display: flex; align-items: center; gap: 8px; background: var(--navy-2); color: white; border: 0; border-radius: 10px; padding: 6px 10px; }
.company-menu { position: absolute; top: 44px; left: 0; background: white; color: var(--text); border-radius: 12px; box-shadow: var(--shadow); min-width: 260px; padding: 6px; z-index: 8; }
.company-menu button { width: 100%; background: white; color: var(--text); text-align: left; }
.company-menu button:hover { background: var(--blue-soft); }
.logo-card { display: flex; align-items: center; gap: 10px; }
.person.active { border-color: var(--blue); background: var(--blue-soft); }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: flex; gap: 6px; overflow: auto; }
  .nav-btn { width: auto; white-space: nowrap; }
  .split { grid-template-columns: 1fr; }
}
