:root {
  --ink: #333333;
  --ink-strong: #141419;
  --panel: #ffffff;
  --panel2: #f8f8f8;
  --page: #f3f3f3;
  --line: #e7e7e7;
  --line-strong: #d6d6d6;
  --muted: #909090;
  --accent: #f07c00;
  --accent-hover: #d96f00;
  --accent-soft: #fff7e8;
  --success: #359d3f;
  --success-soft: #edf8ee;
  --danger: #dc472e;
  --danger-soft: #fff1ee;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 10px 14px rgba(0, 0, 0, .06);
  --shadow-float: 0 5px 8px rgba(17, 18, 17, .14);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Cera Pro", "Avenir Next", Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
html { background: var(--page); color: var(--ink); font-family: var(--font); }
body { margin: 0; min-height: 100vh; background: var(--page); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { outline-color: var(--accent); }
button { border-radius: var(--radius); }

.skip {
  position: fixed; top: -60px; left: 16px; z-index: 99;
  padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-weight: 700;
}
.skip:focus { top: 12px; }

.app-shell { --sidebar-width: 260px; min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) 1fr; transition: grid-template-columns .24s var(--ease); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 20;
  width: var(--sidebar-width); padding: 22px 18px 18px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--panel);
  box-shadow: 4px 0 18px rgba(17, 18, 17, .04);
  transition: width .24s var(--ease), padding .24s var(--ease);
}
.sidebar-collapse {
  position: absolute; top: 28px; right: -15px; z-index: 2;
  width: 30px; height: 30px; padding: 0; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; color: #737373;
  box-shadow: 0 4px 12px rgba(17,18,17,.1); cursor: pointer;
  transition: color .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
}
.sidebar-collapse:hover, .sidebar-collapse:focus-visible { border-color: var(--accent); color: var(--accent-hover); transform: scale(1.06); }
.sidebar-collapse svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .24s var(--ease); }
.brand { margin: 20px auto; border-bottom: 1px solid var(--line); }
.brand img { display: block; width: 122px; height: 66px; object-fit: contain; object-position: center; transition: width .24s var(--ease); }
.brand small, .sidebar small {
  display: block; color: var(--muted); font-size: 9px; line-height: 1.45;
  font-weight: 700; letter-spacing: .08em;
}
.brand small { margin-top: 5px; }
nav { display: grid; gap: 3px; overflow-y: auto; padding: 2px 0 12px; }
nav button {
  position: relative; display: grid; grid-template-columns: 27px minmax(0,1fr); gap: 7px; align-items: center;
  min-height: 42px; padding: 10px 11px; border: 0;
  background: transparent; color: #4c4c4c; text-align: left;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: color .18s var(--ease), background .18s var(--ease), transform .18s var(--ease);
}
.nav-icon { width: 19px; height: 19px; fill: none; stroke: #9b9b9b; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: stroke .18s var(--ease), transform .18s var(--ease); }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav button:hover, nav button:focus-visible { background: var(--panel2); color: var(--ink-strong); }
nav button:hover .nav-icon, nav button:focus-visible .nav-icon { stroke: var(--ink-strong); transform: translateX(1px); }
nav button.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 700; }
nav button.active::before {
  content: ""; position: absolute; inset: 7px auto 7px 0; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
nav button.active .nav-icon { stroke: var(--accent); }
.sidebar-foot {
  margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 9px 1fr 34px; gap: 10px; align-items: center;
}
.sidebar-foot strong { display: block; color: var(--ink-strong); font-size: 12px; }
.sidebar-foot button {
  width: 34px; height: 34px; border: 1px solid var(--line); background: #fff;
  color: var(--muted); cursor: pointer;
}
.sidebar-foot button:hover { border-color: var(--accent); color: var(--accent); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(53, 157, 63, .12); }
.mobile-head { display: none; }

@media (min-width: 781px) {
  .app-shell.sidebar-collapsed { --sidebar-width: 80px; }
  .sidebar-collapsed .sidebar { padding-inline: 12px; }
  .sidebar-collapsed .sidebar-collapse svg { transform: rotate(180deg); }
  .sidebar-collapsed .brand { margin: 20px auto 18px; }
  .sidebar-collapsed .brand img { width: 48px; }
  .sidebar-collapsed .brand small, .sidebar-collapsed .nav-label, .sidebar-collapsed .sidebar-foot > .pulse, .sidebar-collapsed .sidebar-foot > div { display: none; }
  .sidebar-collapsed nav button { grid-template-columns: 1fr; justify-items: center; padding-inline: 10px; }
  .sidebar-collapsed nav button.active::before { inset-block: 8px; }
  .sidebar-collapsed .sidebar-foot { grid-template-columns: 1fr; padding-inline: 0; }
  .sidebar-collapsed .sidebar-foot button { margin: auto; }
}

main { grid-column: 2; min-width: 0; padding: 30px clamp(22px, 3.5vw, 56px) 70px; }
.view { max-width: 1500px; margin: auto; animation: rise .3s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.eyebrow {
  margin: 0; color: var(--accent); font-size: 10px; line-height: 1.4;
  font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
}
.page-head {
  min-height: 92px; margin-bottom: 24px; padding: 6px 0 20px;
  display: flex; align-items: end; justify-content: space-between; gap: 24px;
  border-bottom: 1px solid var(--line-strong);
}
.page-head h1 {
  margin: 7px 0 0; color: var(--ink-strong);
  font-size: clamp(32px, 4vw, 48px); line-height: 1.05;
  font-weight: 900; letter-spacing: -.035em;
}
.page-head > div:last-child { display: flex; align-items: flex-end; gap: 16px; }
.page-head .head-meta { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; text-align: right; }

.primary, .ghost, .danger {
  min-height: 44px; padding: 0 18px; border: 1px solid transparent;
  font-weight: 700; cursor: pointer; transition: .18s var(--ease);
}
.primary { background: var(--accent); color: #fff; box-shadow: 0 4px 10px rgba(240, 124, 0, .22); }
.primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 14px rgba(240, 124, 0, .25); }
.primary:active { transform: translateY(0); }
.ghost { border-color: var(--line-strong); background: #fff; color: var(--ink); }
.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.danger { border-color: #efc9c2; background: #fff; color: var(--danger); }
.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.danger:disabled { border-color: var(--line); background: var(--panel2); color: #bbb; cursor: not-allowed; }
.row-actions { display: flex; gap: 7px; }
.row-actions .ghost, .row-actions .danger { min-height: 36px; padding: 0 11px; font-size: 11px; }

.toolbar { margin-bottom: 16px; display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.toolbar label, .login-card label, .entity-form label {
  color: #666; font-size: 11px; font-weight: 700;
}
.toolbar input, .toolbar select,
.login-card input, .entity-form input, .entity-form select, .entity-form textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; color: var(--ink); transition: border-color .18s, box-shadow .18s;
}
.toolbar input, .toolbar select { display: block; height: 44px; margin-top: 6px; }
.employee-filters { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.employee-filters label { flex: 1 1 175px; min-width: 160px; }
.employee-filter-count { margin-left: auto; padding: 0 4px 12px; color: var(--muted); font-size: 11px; font-weight: 700; align-self: end; }
.employee-filter-count strong { color: var(--ink-strong); font-size: 14px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(240, 124, 0, .12); }

.metric-grid {
  display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px;
  margin-bottom: 24px;
}
.metric {
  position: relative; min-height: 132px; padding: 18px;
  overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel); box-shadow: 0 2px 9px rgba(179, 179, 179, .18);
}
.metric::after {
  content: ""; position: absolute; inset: auto -20px -25px auto;
  width: 76px; height: 76px; border-radius: 50%; background: var(--panel2);
}
.metric strong {
  position: relative; z-index: 1; display: block; margin: 19px 0 7px;
  color: var(--ink-strong); font-size: clamp(34px, 3.5vw, 50px); line-height: 1;
  font-weight: 900; letter-spacing: -.04em;
}
.metric span { color: #666; font-size: 11px; font-weight: 700; }
.metric small { position: relative; z-index: 1; color: var(--muted); }
.metric.success { border-top: 3px solid var(--success); background: linear-gradient(145deg,#fff 45%,var(--success-soft)); }
.metric.success strong { color: var(--success); }
.metric.alert { border-top: 3px solid var(--danger); }
.metric.alert strong { color: var(--danger); }
.metric.warn { border-top: 3px solid var(--accent); }
.metric.warn strong { color: var(--accent); }
.metric-filter {
  width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer;
  appearance: none; transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.metric-filter:hover { transform: translateY(-3px); border-color: #e5b77c; box-shadow: 0 10px 24px rgba(126, 82, 28, .12); }
.metric-filter:focus-visible { outline: 3px solid rgba(240, 124, 0, .3); outline-offset: 3px; }
.metric-filter.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(240, 124, 0, .13), 0 10px 24px rgba(126, 82, 28, .1); }
.metric-filter.selected::before {
  content: ""; position: absolute; top: 13px; right: 13px; z-index: 2;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(240, 124, 0, .13);
}
.metric-filter.success:hover { border-color: var(--success); box-shadow: 0 10px 24px rgba(53,157,63,.14); }
.metric-filter.success:focus-visible { outline-color: rgba(53,157,63,.34); }
.metric-filter.success.selected { border-color: var(--success); box-shadow: 0 0 0 3px rgba(53,157,63,.14), 0 10px 24px rgba(53,157,63,.12); }
.metric-filter.success.selected::before { background: var(--success); box-shadow: 0 0 0 4px rgba(53,157,63,.14); }

.workforce-grid { margin-bottom: 24px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.workforce-card {
  overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; box-shadow: 0 2px 9px rgba(179,179,179,.18);
}
.workforce-card > header {
  min-height: 78px; padding: 17px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  border-bottom: 1px solid var(--line); background: linear-gradient(120deg,#fff 60%,#edf7f0);
}
.workforce-card.positions > header { background: linear-gradient(120deg,#fff 60%,#fff3e4); }
.workforce-card h2 { margin: 4px 0 0; color: var(--ink-strong); font-size: 19px; }
.workforce-total { display: grid; grid-template-columns: auto auto; gap: 5px; align-items: baseline; white-space: nowrap; }
.workforce-total strong { color: var(--success); font-size: 25px; line-height: 1; }
.workforce-card.positions .workforce-total strong { color: var(--accent-hover); }
.workforce-total span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.workforce-card ul { margin: 0; padding: 7px 20px 13px; list-style: none; }
.workforce-card li { padding: 9px 0 8px; border-bottom: 1px solid #f1f0ed; }
.workforce-card li:last-child { border-bottom: 0; }
.workforce-line { margin-bottom: 7px; display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.workforce-line strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.workforce-line span { color: var(--muted); font-size: 9px; white-space: nowrap; }
.workforce-line span b { color: var(--ink-strong); font-size: 15px; }
.workforce-track { width: 100%; height: 5px; display: block; overflow: hidden; border: 0; border-radius: 10px; appearance: none; background: var(--panel2); }
.workforce-track::-webkit-progress-bar { border-radius: 10px; background: var(--panel2); }
.workforce-track::-webkit-progress-value { border-radius: 10px; background: linear-gradient(90deg,#4c9e60,#8fc89c); }
.workforce-track::-moz-progress-bar { border-radius: 10px; background: linear-gradient(90deg,#4c9e60,#8fc89c); }
.workforce-card.positions .workforce-track::-webkit-progress-value { background: linear-gradient(90deg,var(--accent),#f4b15e); }
.workforce-card.positions .workforce-track::-moz-progress-bar { background: linear-gradient(90deg,var(--accent),#f4b15e); }

.trend-grid { margin-bottom: 24px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.trend-card { padding: 19px 20px 17px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: 0 2px 9px rgba(179,179,179,.18); }
.trend-card > header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.trend-card h2 { margin: 4px 0 0; color: var(--ink-strong); font-size: 19px; }
.trend-total { display: flex; align-items: baseline; gap: 6px; }
.trend-total strong { color: var(--ink-strong); font-size: 24px; line-height: 1; }
.trend-total span { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.trend-bars { height: 174px; margin-top: 16px; display: grid; grid-template-columns: repeat(7,minmax(34px,1fr)); gap: 8px; align-items: end; }
.trend-column { height: 100%; min-width: 0; display: grid; grid-template-rows: 22px 1fr 31px; gap: 5px; text-align: center; }
.trend-column > strong { color: var(--ink-strong); font-size: 12px; }
.trend-track { height: 111px; min-height: 0; overflow: hidden; border-radius: 4px 4px 2px 2px; background: var(--panel2); }
.trend-track progress { width: 100%; height: 111px; display: block; border: 0; appearance: none; writing-mode: vertical-rl; direction: rtl; background: var(--panel2); }
.trend-track progress::-webkit-progress-bar { background: var(--panel2); }
.trend-track progress::-webkit-progress-value { background: var(--success); }
.trend-track progress::-moz-progress-bar { background: var(--success); }
.trend-card.late .trend-track progress::-webkit-progress-value { background: var(--accent); }
.trend-card.late .trend-track progress::-moz-progress-bar { background: var(--accent); }
.trend-card.absent .trend-track progress::-webkit-progress-value { background: var(--danger); }
.trend-card.absent .trend-track progress::-moz-progress-bar { background: var(--danger); }
.trend-column small { display: grid; color: var(--muted); font-size: 9px; line-height: 1.25; }
.trend-column small b { color: #666; font-size: 9px; text-transform: uppercase; }

.ranking-grid { margin-bottom: 24px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.ranking-card {
  overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; box-shadow: 0 2px 9px rgba(179,179,179,.18);
}
.ranking-card > header {
  padding: 18px 20px 15px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  border-bottom: 1px solid var(--line); background: linear-gradient(135deg,#fff 68%,var(--accent-soft));
}
.ranking-card.incomplete > header { background: linear-gradient(135deg,#fff 68%,#f4f1ff); }
.ranking-card h2 { margin: 4px 0 0; color: var(--ink-strong); font-size: 19px; }
.ranking-period { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.ranking-card ol { margin: 0; padding: 0; list-style: none; }
.ranking-card li {
  min-height: 72px; padding: 11px 18px; display: grid; grid-template-columns: 30px minmax(0,1fr) auto; gap: 12px; align-items: center;
  border-bottom: 1px solid #f0f0f0;
}
.ranking-card li:last-child { border-bottom: 0; }
.rank-number {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
  background: var(--panel2); color: #777; font-size: 11px; font-weight: 900;
}
.ranking-card li:first-child .rank-number { background: var(--accent); color: #fff; box-shadow: 0 4px 10px rgba(240,124,0,.22); }
.ranking-card.incomplete li:first-child .rank-number { background: #7765bd; box-shadow: 0 4px 10px rgba(119,101,189,.2); }
.rank-person { min-width: 0; }
.rank-person strong { display: block; overflow: hidden; color: var(--ink-strong); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.rank-person small { display: block; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { min-width: 115px; display: grid; grid-template-columns: auto 1fr; column-gap: 5px; align-items: baseline; text-align: right; }
.rank-score > strong { color: var(--accent-hover); font-size: 22px; line-height: 1; }
.ranking-card.incomplete .rank-score > strong { color: #6653ad; }
.rank-score > span { color: #777; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.rank-score > small { grid-column: 1 / -1; margin-top: 4px; color: var(--muted); font-size: 9px; }
.ranking-empty { padding: 28px 20px; color: var(--muted); font-size: 12px; text-align: center; }

.panel {
  margin-top: 18px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel); box-shadow: 0 2px 14px rgba(0, 0, 0, .035);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; border-bottom: 1px solid var(--line); background: #fff;
}
.panel-head h2 { margin: 0; color: var(--ink-strong); font-size: 15px; font-weight: 700; }
.table-wrap { overflow: auto; }
.data-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.data-table th {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel2); color: #777; font-size: 10px;
  font-weight: 700; letter-spacing: .04em; text-align: left; text-transform: uppercase;
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; color: var(--ink); font-size: 13px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fffaf4; }
.data-table tbody tr.recently-edited td { animation: employee-row-confirmed 4.2s var(--ease) both; }
.data-table tbody tr.recently-edited td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.data-table tbody tr.recently-edited:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
@keyframes employee-row-confirmed {
  0%, 28% { background: #fff0d6; }
  58% { background: #fff8ec; }
  100% { background: #fff; }
}
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.employee-avatar-button, .employee-avatar-fallback {
  width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--line); border-radius: 50%; background: var(--panel2);
}
.employee-avatar-button { padding: 0; cursor: zoom-in; transition: transform .18s var(--ease), border-color .18s var(--ease); }
.employee-avatar-button:hover, .employee-avatar-button:focus-visible { transform: scale(1.08); border-color: var(--accent); }
.employee-avatar-button img { width: 100%; height: 100%; object-fit: cover; }
.employee-avatar-fallback { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .05em; }
.status {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px;
  border-radius: 999px; background: var(--panel2); color: #666;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.status.online::before, .status.worked::before, .status.present::before, .status.synced::before, .status.active::before, .status.sent::before { background: var(--success); }
.status.present { background: #edf8f0; color: #27733d; }
.status.offline::before, .status.failed::before, .status.absent::before, .status.terminated::before { background: var(--danger); }
.status.pending::before, .status.limited::before, .status.incomplete::before { background: var(--accent); }
.empty { padding: 58px 20px; color: var(--muted); text-align: center; }

.month-filters {
  padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; box-shadow: 0 2px 9px rgba(179, 179, 179, .12);
}
.month-filters label { flex: 0 1 210px; }
.month-filters .month-employee-filter { flex: 1 1 360px; }
.employee-list-person-filter { flex: 2 1 320px; min-width: 260px; }
.employee-list-person-filter > label { display: block; }
.employee-search-control { position: relative; display: block; }
.month-employee-filter input[type=search], .employee-list-person-filter input[type=search] { padding-right: 38px; background-color: #fff; }
.month-employee-filter input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
.employee-list-person-filter input[type=search]::-webkit-search-cancel-button { display: none; }
.employee-search-clear {
  position: absolute; top: 14px; right: 9px; z-index: 2; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 19px; line-height: 1; cursor: pointer;
}
.employee-search-clear:hover, .employee-search-clear:focus-visible { background: var(--panel2); color: var(--ink-strong); }
.employee-search-results {
  position: absolute; top: calc(100% + 6px); right: 0; left: 0; z-index: 30;
  max-height: 286px; overflow-y: auto; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  background: #fff; box-shadow: 0 14px 30px rgba(20,20,25,.16);
}
.employee-search-option {
  padding: 10px 11px; display: flex; justify-content: space-between; gap: 14px; align-items: center;
  border-radius: var(--radius); color: var(--ink); cursor: pointer;
}
.employee-search-option:hover, .employee-search-option.active { background: var(--accent-soft); color: var(--accent-hover); }
.employee-search-option span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.employee-search-option strong { margin-right: 7px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; }
.employee-search-option small { flex: 0 1 auto; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.employee-search-empty { padding: 18px 12px; color: var(--muted); font-size: 11px; text-align: center; }
.month-summary {
  margin: 18px 0; padding: 20px 22px; display: flex; justify-content: space-between; gap: 24px; align-items: center;
  border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius-lg);
  background: linear-gradient(105deg, #fff 0 68%, var(--accent-soft) 100%); box-shadow: 0 2px 14px rgba(0,0,0,.035);
}
.month-summary h2 { margin: 5px 0 4px; color: var(--ink-strong); font-size: 22px; }
.month-summary p { margin: 0; color: var(--muted); font-size: 12px; }
.month-summary-person { min-width: 0; display: flex; align-items: center; gap: 15px; }
.month-summary-person > div { min-width: 0; }
.month-employee-photo {
  width: 58px; height: 58px; flex: 0 0 58px; display: grid; place-items: center;
  border: 2px solid #fff; border-radius: 50%; background: var(--panel2); object-fit: cover;
  box-shadow: 0 0 0 1px var(--line-strong), 0 5px 14px rgba(20,20,25,.1);
}
.month-employee-initials { color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .06em; }
.month-summary-actions { display: flex; align-items: center; gap: 24px; }
.month-summary-actions dl { margin: 0; display: flex; gap: 34px; }
.month-summary-actions dl div { min-width: 92px; }
.month-summary dt { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.month-summary dd { margin: 4px 0 0; color: var(--ink-strong); font-size: 26px; font-weight: 900; }
.month-recalculate { white-space: nowrap; }
.month-recalculate:disabled { opacity: .62; cursor: wait; }
.month-calendar-panel {
  overflow-x: auto; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.035);
}
.month-weekdays, .month-calendar { min-width: 900px; display: grid; grid-template-columns: repeat(7, minmax(115px, 1fr)); gap: 8px; }
.month-weekdays { margin-bottom: 8px; }
.month-weekdays span { padding: 7px 10px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: center; text-transform: uppercase; }
.month-day {
  min-height: 150px; padding: 13px; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.month-day:hover { z-index: 1; transform: translateY(-2px); border-color: #e5b77c; box-shadow: 0 8px 20px rgba(126,82,28,.1); }
.month-day-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.month-day-head strong { color: var(--ink-strong); font-size: 20px; font-weight: 900; }
.month-day-head span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.month-day dl { margin: 12px 0 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.month-day dl div { min-width: 0; }
.month-day dt { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.month-day dd { margin: 3px 0 0; color: var(--ink-strong); font-family: "SFMono-Regular", Consolas, monospace; font-size: 14px; font-weight: 700; }
.month-day-status { margin-top: auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.month-day-status > span:not(.status) { color: var(--muted); font-size: 10px; }
.month-worked-duration { color: var(--ink-strong); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; white-space: nowrap; }
.month-day.is-day-off { background: repeating-linear-gradient(-45deg,#fafafa,#fafafa 7px,#f5f5f5 7px,#f5f5f5 14px); }
.day-off-mark { flex: 1; display: grid; place-content: center; justify-items: center; gap: 5px; color: var(--muted); }
.day-off-mark span { font-size: 24px; line-height: 1; }
.day-off-mark strong { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.month-day.has-no-data { background: var(--panel2); opacity: .72; }
.month-day-spacer { min-height: 1px; }

.login-shell {
  min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 500px);
  align-items: center; gap: clamp(40px, 8vw, 130px); padding: clamp(28px, 7vw, 110px);
  background: linear-gradient(135deg, #fff 0 50%, var(--page) 50% 100%);
}
.login-mark { display: grid; place-items: center; }
.login-mark img { width: min(520px, 85%); filter: drop-shadow(0 14px 20px rgba(0, 0, 0, .07)); }
.login-card {
  position: relative; padding: clamp(30px, 4vw, 50px);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; box-shadow: var(--shadow);
}
.login-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; border-radius: 10px 10px 0 0; background: var(--accent); }
.login-card h1 {
  margin: 14px 0 18px; color: var(--ink-strong);
  font-size: clamp(42px, 5vw, 62px); line-height: .98; font-weight: 900; letter-spacing: -.05em;
}
.muted { color: var(--muted); line-height: 1.55; }
.login-card label, .entity-form label { display: grid; gap: 7px; margin: 17px 0; }
.login-card .primary { width: 100%; margin-top: 10px; display: flex; justify-content: space-between; align-items: center; }
.error { min-height: 20px; color: var(--danger); font-size: 12px; }

dialog {
  width: min(820px, calc(100% - 30px)); max-height: 90vh; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; color: var(--ink); box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
}
dialog::backdrop { background: rgba(20, 20, 25, .42); backdrop-filter: blur(2px);-webkit-backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 5px 0 0; color: var(--ink-strong); font-size: 28px; }
.modal-head button { border: 0; background: transparent; color: var(--muted); font-size: 29px; cursor: pointer; }
.modal-head button:hover { color: var(--danger); }
.entity-form { padding: 10px 26px 28px; overflow: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.entity-form .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.entity-form label.check-line {
  min-height: 44px; margin: 17px 0; display: flex; align-items: center; align-self: end; gap: 10px;
  color: var(--ink); cursor: pointer; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;
}
.entity-form .check-line input[type=checkbox] {
  appearance: auto; width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px;
  margin: 0; padding: 0; border: 0; box-shadow: none; accent-color: var(--accent); cursor: pointer;
}
.entity-form .check-line input[type=checkbox]:focus { box-shadow: none; }
.entity-form .check-line input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.field-note { margin-top: 6px; display: block; color: var(--muted); font-size: 10px; font-weight: 500; line-height: 1.4; }
.photo-note { align-self: center; padding: 12px; border-radius: var(--radius); background: var(--panel2); color: var(--muted); font-size: 11px; line-height: 1.45; }
.employee-editor { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 26px; }
.employee-photo-editor { padding-top: 17px; }
.employee-photo-frame {
  position: relative; width: 200px; aspect-ratio: 3 / 4; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel2);
  box-shadow: 0 8px 22px rgba(37, 35, 31, .1);
}
.employee-photo-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.employee-photo-frame img[hidden], .employee-photo-frame div[hidden] { display: none; }
.employee-photo-frame > div {
  width: 100%; height: 100%; display: grid; place-content: center; gap: 5px; color: #aaa;
  font-size: 10px; font-weight: 800; line-height: 1.4; letter-spacing: .08em; text-align: center;
}
.employee-photo-frame > div strong { color: var(--ink); font-family: Georgia, serif; font-size: 25px; letter-spacing: .04em; }
.employee-photo-picker {
  width: 200px; margin-top: 12px; padding: 10px 12px; display: block; border: 1px dashed #b9b4aa;
  border-radius: var(--radius); background: #fff; color: var(--ink); font-size: 11px; font-weight: 800;
  text-align: center; cursor: pointer; transition: border-color .2s, background .2s;
}
.employee-photo-picker:hover { border-color: var(--accent); background: var(--accent-soft); }
.employee-photo-picker input[type=file] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.photo-guidance { width: 200px; margin: 10px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.photo-validation {
  width: 200px; min-height: 58px; padding: 10px 11px; display: grid; gap: 3px; align-content: center;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2); font-size: 10px; line-height: 1.35;
}
.photo-validation strong { color: var(--ink); }
.photo-validation span { color: var(--muted); }
.photo-validation.ready { border-color: #a9d3b6; background: #eef8f1; }
.photo-validation.ready strong { color: #286b3d; }
.photo-validation.error { border-color: #e8b6ad; background: var(--danger-soft); }
.photo-validation.error strong { color: #8a3527; }
.photo-validation.processing { border-color: #d8c587; background: #fff9e7; }
.photo-validation.processing strong::before {
  content: ''; width: 9px; height: 9px; margin-right: 7px; display: inline-block; vertical-align: -1px;
  border: 2px solid #d0b24f; border-right-color: transparent; border-radius: 50%; animation: photo-spin .8s linear infinite;
}
@keyframes photo-spin { to { transform: rotate(360deg); } }
.entity-form button:disabled { opacity: .55; cursor: wait; }
.employee-photo-large { margin: 14px auto 0; text-align: center; }
.employee-photo-large img { display: block; width: min(340px, 100%); max-height: 54vh; margin: auto; border-radius: var(--radius-lg); object-fit: contain; background: var(--panel2); box-shadow: var(--shadow); }
.employee-photo-large figcaption { margin-top: 14px; color: var(--muted); font-size: 12px; }
.weekday-grid { display: grid; grid-template-columns: 55px 1fr 1fr; gap: 8px; align-items: center; }
.weekday-grid input { min-height: 38px; }

#toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  padding: 14px 18px; border-radius: var(--radius); background: var(--ink-strong); color: #fff;
  box-shadow: var(--shadow-float); transform: translateY(100px); opacity: 0; transition: .25s;
}
.toast-show { transform: none !important; opacity: 1 !important; }
.alert-line {
  margin: 15px 0; padding: 14px 16px; border: 1px solid #f2d2cc; border-left: 4px solid var(--danger);
  border-radius: var(--radius); background: var(--danger-soft); color: #7d3327;
}
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.setting-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: 0 2px 9px rgba(179, 179, 179, .12); }
.setting-card h3 { margin-top: 0; color: var(--ink-strong); }
.setting-card code { color: var(--accent-hover); }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .trend-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .workforce-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-105%); transition: .25s var(--ease); box-shadow: 10px 0 30px rgba(0, 0, 0, .12); }
  .sidebar-collapse { display: none; }
  .sidebar.open { transform: none; }
  .mobile-head {
    position: sticky; top: 0; z-index: 15; height: 62px; padding: 0 18px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);-webkit-backdrop-filter: blur(12px);
  }
  .mobile-head button { border: 0; background: transparent; color: var(--ink); font-size: 21px; }
  .mobile-head img { width: 82px; height: 46px; object-fit: contain; }
  .mobile-head span { color: var(--muted); font-size: 12px; font-weight: 700; }
  main { padding: 22px 16px 60px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 36px; }
  .page-head > div:last-child { flex-direction: column; align-items: flex-end; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .metric { min-height: 112px; padding: 15px; }
  .metric strong { margin-top: 14px; font-size: 36px; }
  .trend-grid { grid-template-columns: 1fr; }
  .workforce-card > header { padding-inline: 15px; }
  .workforce-card ul { padding-inline: 15px; }
  .ranking-grid { grid-template-columns: 1fr; }
  .ranking-card li { padding-inline: 13px; grid-template-columns: 28px minmax(0,1fr) auto; gap: 9px; }
  .rank-score { min-width: 94px; }
  .login-shell { display: block; padding: 20px; background: var(--page); }
  .login-mark { margin: 5vh auto 3vh; }
  .login-mark img { width: 190px; }
  .login-card { max-width: 480px; margin: 0 auto 8vh; }
  .form-grid, .settings-grid { grid-template-columns: 1fr; }
  .employee-editor { grid-template-columns: 1fr; }
  .employee-photo-editor { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px 14px; align-items: start; }
  .employee-photo-frame { width: 112px; grid-row: 1 / 4; }
  .employee-photo-picker, .photo-guidance, .photo-validation { width: auto; margin: 0; }
  .month-summary { align-items: flex-start; }
  .month-summary-actions { align-items: flex-start; flex-wrap: wrap; gap: 14px 18px; }
  .month-summary-actions dl { gap: 18px; }
  .month-calendar-panel { overflow: visible; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .month-weekdays, .month-day-spacer { display: none; }
  .month-calendar { min-width: 0; grid-template-columns: 1fr; gap: 8px; }
  .month-day { min-height: 0; display: grid; grid-template-columns: 56px minmax(0,1fr) auto; gap: 12px; align-items: center; }
  .month-day-head { padding: 0 12px 0 0; border: 0; border-right: 1px solid var(--line); }
  .month-day dl { margin: 0; }
  .month-day-status { margin: 0; }
  .day-off-mark { min-height: 42px; grid-column: 2 / 4; display: flex; justify-content: flex-start; }
}

@media (max-width: 460px) {
  .page-head { display: block; }
  .page-head > div:last-child { margin-top: 16px; flex-direction: row; align-items: center; justify-content: space-between; }
  .page-head .head-meta { text-align: left; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .month-summary { display: block; }
  .month-summary-actions { margin-top: 16px; }
  .month-recalculate { width: 100%; }
  .month-day { grid-template-columns: 48px 1fr; }
  .month-day-status { grid-column: 2; }
  .day-off-mark { grid-column: 2; }
}

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