:root {
  --bg: #0d0e10; --panel: #15171a; --panel2: #1b1e22; --line: #262a30; --line2: #353a42;
  --text: #ebe9e4; --muted: #8d939c; --accent: #ffb020; --accent-ink: #1a1203;
  --green: #3ecf8e; --blue: #5aa9ff; --red: #ff5d5d; --amber: #ffb020;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-image:
    radial-gradient(900px 420px at 85% -80px, rgba(255,176,32,.10), transparent 70%),
    radial-gradient(circle at 1px 1px, #1d2024 1px, transparent 1.3px);
  background-size: auto, 22px 22px;
  background-attachment: fixed;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
svg { display: block; }

/* buttons & fields */
.btn {
  font: inherit; font-size: 14px; font-weight: 550; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); cursor: pointer;
  text-decoration: none; transition: background .12s, border-color .12s;
}
.btn:hover { background: #23272c; border-color: #454b55; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #ffc14d; }
.btn.danger { color: var(--red); border-color: #55292c; background: #1f1415; }
.btn.danger:hover { background: #2a1819; }
.btn.good { color: var(--green); border-color: #1f4a37; background: #101c17; }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 7px; }
.btn.wide { width: 100%; padding: 11px; font-size: 15px; }
.btn.big { padding: 13px 22px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; line-height: 0; }
.icon-btn:hover { color: var(--text); background: var(--panel2); }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.field input, .field select, .field textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; font-size: 15px; color: var(--text);
  background: #101214; border: 1px solid var(--line2); border-radius: 9px; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,176,32,.15); }
.field textarea { min-height: 84px; resize: vertical; }
.field .hint { display: block; margin-top: 4px; font-size: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 10px; }
.with-btn { display: flex; gap: 8px; align-items: end; }
.with-btn .field { flex: 1; margin: 0; }

/* login */
.login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-art { padding: 36px 48px; display: flex; flex-direction: column; justify-content: center; gap: 14px; border-right: 1px solid var(--line); background: linear-gradient(160deg, #121316, #0d0e10); }
.login-art .brand { position: absolute; top: 30px; left: 48px; }
.login-art .art { width: 100%; max-width: 520px; margin: 0 auto; }
.login-art h2 { font-size: 24px; font-weight: 650; max-width: 440px; margin-top: 8px; }
.login-art p { color: var(--muted); max-width: 440px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 30px; }
.login-form form { width: 100%; max-width: 340px; }
.login-form h1 { margin-bottom: 6px; }
.login-form .muted { margin-bottom: 22px; }
.login-form .small { margin-top: 18px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }

/* app shell */
#app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; border-right: 1px solid var(--line); background: rgba(13,14,16,.85); backdrop-filter: blur(6px); }
.side .brand { padding: 0 8px 18px; }
#nav { flex: 1; overflow-y: auto; }
.nav-group { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #656b74; padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; margin-bottom: 2px; border-radius: 9px; color: #b3b8c0; text-decoration: none; font-size: 14.5px; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.current { background: #20231f; color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item .lock { margin-left: auto; opacity: .6; }
.nav-item .count { margin-left: auto; background: var(--accent); color: var(--accent-ink); border-radius: 10px; font-size: 12px; font-weight: 700; padding: 0 7px; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.me-text { min-width: 0; flex: 1; line-height: 1.25; }
.me-text b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { color: var(--muted); font-size: 12px; }

.main { padding: 28px 36px 80px; max-width: 1180px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { color: var(--muted); margin-top: 4px; max-width: 620px; }

.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 11px 14px; margin-bottom: 18px; border-radius: 10px; border: 1px solid #5a4411; background: #1f1808; color: #ffd98a; }
.banner .btn { margin-left: auto; }
.banner.info { border-color: #1d3f63; background: #0e1a28; color: #a9d0ff; }

/* cards & layout */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card > h2 { margin-bottom: 4px; }
.card > .sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; align-items: start; }
.g2 { grid-template-columns: 1.15fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stack { display: grid; gap: 16px; align-content: start; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head .sub { color: var(--muted); font-size: 13px; }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c, var(--line2)); }
.stat small { color: var(--muted); font-size: 13px; }
.stat b { display: block; font-size: 28px; font-weight: 650; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; }

/* chips, avatars */
.chip { display: inline-block; padding: 1px 9px; border-radius: 20px; font-size: 12px; font-weight: 550; background: #23262b; color: #b9bec6; white-space: nowrap; }
.chip.green { background: #12281f; color: var(--green); }
.chip.blue { background: #11233a; color: var(--blue); }
.chip.amber { background: #2c2109; color: var(--amber); }
.chip.red { background: #301517; color: var(--red); }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 650; font-size: 13px; color: #0d0e10; background: var(--av, #ffb020); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person b { display: block; font-weight: 550; }
.person small { color: var(--muted); font-size: 12.5px; display: block; }

/* tables / lists */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px 10px 0; border-bottom: 1px solid #1d2024; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td .btn + .btn { margin-left: 6px; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.empty svg { width: 44px; height: 44px; margin: 0 auto 8px; stroke: #4b515a; fill: none; stroke-width: 1.5; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #1d2024; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }

/* today checklist */
.today-top { display: flex; gap: 22px; align-items: center; margin-bottom: 8px; }
.ring text { fill: var(--text); font-size: 24px; font-weight: 650; }
.ring text.sm { fill: var(--muted); font-size: 11px; font-weight: 500; }
.steps { margin-top: 14px; }
.step { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.step .dot { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 2px solid var(--line2); color: var(--muted); font-weight: 650; font-size: 13px; }
.step.done .dot { background: var(--green); border-color: var(--green); color: #0d0e10; }
.step.done .dot svg { width: 16px; height: 16px; stroke-width: 3; }
.step.current .dot { border-color: var(--accent); color: var(--accent); }
.step .grow { flex: 1; min-width: 0; }
.step .grow b { display: block; font-weight: 600; }
.step .grow span { color: var(--muted); font-size: 13.5px; }
.step.done .grow b { color: var(--muted); text-decoration: line-through; text-decoration-color: #4b515a; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { text-align: center; padding: 9px 0 8px; border-radius: 10px; border: 1px solid var(--line); background: #111316; font-size: 12px; color: var(--muted); }
.day b { display: block; color: var(--text); font-size: 15px; font-weight: 600; margin: 2px 0 6px; }
.day i { display: block; width: 9px; height: 9px; border-radius: 50%; margin: 0 auto; background: #2b2f35; }
.day.present i { background: var(--green); } .day.on_leave i { background: var(--blue); } .day.absent i { background: var(--red); }
.day.today { border-color: var(--accent); }
.day.off { opacity: .45; }

/* stacked bar + donut */
.bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #202328; gap: 2px; }
.bar span { display: block; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.legend b { color: var(--text); font-weight: 600; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut text { fill: var(--text); font-size: 20px; font-weight: 650; }

/* kanban */
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 9px; overflow: hidden; }
.seg button { font: inherit; font-size: 13.5px; padding: 6px 14px; background: none; color: var(--muted); border: 0; cursor: pointer; }
.seg button.on { background: var(--panel2); color: var(--text); }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.col { background: #111316; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.col-head i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--c); }
.col-head span { color: var(--muted); font-weight: 500; }
.task { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px; margin-bottom: 8px; }
.task b { display: block; font-weight: 550; margin-bottom: 2px; word-break: break-word; }
.task p { color: var(--muted); font-size: 13px; margin-bottom: 8px; word-break: break-word; }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.task select { width: 100%; font: inherit; font-size: 13px; padding: 5px 7px; color: var(--text); background: #101214; border: 1px solid var(--line2); border-radius: 7px; }
.late { color: var(--red); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .h { text-align: center; font-size: 12px; color: var(--muted); padding-bottom: 2px; }
.cal .c { aspect-ratio: 1.15; border-radius: 9px; border: 1px solid var(--line); background: #111316; padding: 5px 7px; font-size: 13px; color: var(--muted); position: relative; }
.cal .c.blank { border: 0; background: none; }
.cal .c.present { background: #102319; border-color: #1f4a37; color: var(--green); }
.cal .c.on_leave { background: #0f1c2e; border-color: #1d3f63; color: var(--blue); }
.cal .c.absent { background: #261214; border-color: #55292c; color: var(--red); }
.cal .c.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal .c.off { opacity: .4; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav b { min-width: 130px; text-align: center; font-weight: 600; }

/* reports */
.report { padding: 14px 0; border-top: 1px solid var(--line); }
.report:first-child { border-top: 0; padding-top: 0; }
.report .lbl { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: #6a7079; margin-top: 8px; }
.report p { white-space: pre-wrap; word-break: break-word; }
.note { margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--accent); background: #17140c; border-radius: 4px; font-size: 14px; }

/* gate */
.gate { max-width: 520px; margin: 40px auto; text-align: center; padding: 34px 26px; }
.gate svg { width: 64px; height: 64px; margin: 0 auto 14px; stroke: var(--accent); fill: none; stroke-width: 1.6; }
.gate p { color: var(--muted); margin: 8px 0 20px; }

/* credentials */
.cred { background: #101214; border: 1px solid var(--line2); border-radius: 10px; padding: 14px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; line-height: 1.9; word-break: break-all; }
.cred span { color: var(--muted); display: inline-block; min-width: 80px; }

/* dialog + toast */
dialog { border: 1px solid var(--line2); border-radius: 14px; padding: 0; width: min(480px, 94vw); background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.65); }
dialog form { padding: 22px; }
dialog h2 { font-size: 18px; margin-bottom: 4px; }
dialog .lead { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
#toast { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 50; }
.toast { padding: 10px 14px; border-radius: 10px; background: #1d2d25; border: 1px solid #1f4a37; color: #bff0d8; box-shadow: 0 8px 30px rgba(0,0,0,.5); max-width: 340px; }
.toast.bad { background: #2a1819; border-color: #55292c; color: #ffc4c4; }

@media (max-width: 980px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  #app { display: block; }
  .side { position: fixed; z-index: 20; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 0; border-right: 0; border-top: 1px solid var(--line); background: rgba(13,14,16,.96); }
  .side .brand, .nav-group, .me-text, .me .avatar { display: none; }
  #nav { display: flex; overflow-x: auto; padding: 4px; }
  .nav-item { flex-direction: column; gap: 2px; font-size: 11px; padding: 7px 10px; margin: 0; min-width: 62px; text-align: center; white-space: nowrap; }
  .nav-item.current { box-shadow: none; }
  .nav-item .lock, .nav-item .count { position: absolute; margin: 0; transform: translate(14px, -6px); }
  .nav-item { position: relative; }
  .me { border: 0; padding: 0 4px; }
  .main { padding: 18px 16px 100px; }
  h1 { font-size: 22px; }
  .row2 { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr; }
  #toast { left: 16px; right: 16px; bottom: 84px; }
}
