:root {
  color-scheme: light;
  --bg:#edf2f7;
  --surface:#ffffff;
  --surface-soft:#f7fafc;
  --ink:#172033;
  --muted:#64748b;
  --line:#d9e2ef;
  --accent:#0b5cab;
  --accent-dark:#08457f;
  --accent-soft:#edf6ff;
  --nav:#0a2f55;
  --nav-2:#0d4e88;
  --gold:#c8942f;
  --success:#047857;
  --warning:#b7791f;
  --danger:#b42318;
  --rose:#be123c;
  --shadow:0 1px 2px rgba(15,23,42,.04), 0 14px 34px rgba(8,40,75,.08);
}
* { box-sizing:border-box; }
html { min-width:0; }
body { margin:0; font-family:"Segoe UI", Arial, sans-serif; color:var(--ink); background:linear-gradient(135deg,#f8fbff 0,#eef3f8 44%,#e7edf5 100%); }
a { color:inherit; text-decoration:none; }

.wrap { min-height:100vh; display:grid; place-items:center; padding:24px; }
.wrap .card { width:min(470px, 100%); border-radius:14px; padding:36px; }
.wrap .card:before { content:"EK"; position:static; display:inline-grid; place-items:center; width:58px; height:58px; margin-bottom:18px; border-radius:50%; background:var(--gold); color:#172033; font-weight:900; font-size:15px; border:2px solid rgba(255,255,255,.84); box-shadow:0 8px 20px rgba(200,148,47,.28); }
.wrap p { color:var(--muted); line-height:1.5; }
.wrap button { width:100%; margin-top:20px; }
.note, .alert { margin-top:16px; padding:12px 14px; border-radius:10px; font-size:14px; }
.note { background:var(--accent-soft); color:var(--accent); }
.alert { background:#fff1f0; color:var(--danger); border:1px solid #fecdca; }
.layout { display:grid; grid-template-columns:280px minmax(0, 1fr); min-height:100vh; }
.sidebar { position:sticky; top:0; height:100vh; overflow:auto; padding:20px 14px; background:linear-gradient(180deg,var(--nav),var(--nav-2)); color:#e5edf7; border-right:1px solid rgba(255,255,255,.10); box-shadow:12px 0 36px rgba(8,40,75,.14); }
.brand { display:flex; align-items:center; gap:12px; min-height:54px; font-size:20px; font-weight:900; line-height:1.05; margin-bottom:8px; padding:0 8px; }
.brand:before { content:"EK"; display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px; border-radius:50%; background:var(--gold); color:#172033; font-size:14px; box-shadow:0 8px 20px rgba(200,148,47,.28); border:2px solid rgba(255,255,255,.30); }
.sub { color:#b9c9dd; font-size:13px; line-height:1.4; margin:0 8px 20px 62px; }
.nav { display:grid; gap:14px; }
.nav-section { display:grid; gap:6px; }
.nav-title { padding:8px 10px 2px; color:#afc6df; font-size:11px; font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
.nav a { display:flex; align-items:center; min-height:40px; padding:9px 11px; border-radius:9px; color:#d7e3f1; font-size:14px; font-weight:800; border:1px solid transparent; transition:.16s ease; }
.nav a:hover, .nav a.active { color:#fff; background:rgba(255,255,255,.14); border-color:rgba(255,255,255,.18); transform:translateX(2px); }
.nav a.active { box-shadow:inset 3px 0 0 var(--gold); }
.nav form { margin:0; }
.nav .logout-button { width:100%; justify-content:flex-start; min-height:40px; margin:0; padding:9px 11px; border-radius:9px; color:#ffe4e6; background:rgba(136,19,55,.55); border:1px solid rgba(255,255,255,.13); font-size:14px; font-weight:800; }
.main { min-width:0; padding:0 30px 30px; }
.hero { display:flex; justify-content:space-between; gap:18px; align-items:center; margin:0 -30px 24px; padding:20px 30px; background:rgba(255,255,255,.94); border-bottom:1px solid var(--line); box-shadow:0 1px 2px rgba(15,23,42,.03); backdrop-filter:blur(10px); }
.hero-main { display:flex; gap:14px; align-items:center; min-width:0; }
.hero-main:before { content:""; width:6px; height:56px; flex:0 0 6px; border-radius:999px; background:linear-gradient(180deg,var(--accent),var(--gold)); }
.hero-meta { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; align-items:center; }
.user-pill { display:inline-flex; align-items:center; gap:8px; min-height:34px; padding:7px 10px; border-radius:999px; background:#f1f5f9; border:1px solid var(--line); color:#334155; font-size:13px; font-weight:800; }
.user-pill small { color:var(--muted); font-weight:700; }
h1, h3 { margin:0; font-weight:850; letter-spacing:0; }
h1 { font-size:27px; line-height:1.18; }
h3 { font-size:18px; margin-bottom:16px; }
.muted { color:var(--muted); }
.grid { display:grid; gap:16px; }
.cards { grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); margin-bottom:20px; }
.card, .panel { background:rgba(255,255,255,.97); border:1px solid var(--line); border-radius:10px; box-shadow:var(--shadow); }
.card { position:relative; padding:18px 17px 16px; overflow:hidden; display:block; transition:.16s ease; }
.card:before { content:""; position:absolute; inset:0 auto 0 0; width:4px; background:var(--accent); }
.card.success:before, .badge.success { background:var(--success); }
.card.warning:before, .badge.warning { background:var(--warning); }
.card.danger:before, .badge.danger { background:var(--danger); }
.card.neutral:before { background:#94a3b8; }
.card:nth-child(2):before { background:var(--rose); }
.card:nth-child(3):before { background:var(--success); }
.card:nth-child(4):before { background:var(--gold); }
.card:hover, .card.active { border-color:#8dbbe7; box-shadow:0 0 0 3px rgba(11,92,171,.10), var(--shadow); transform:translateY(-1px); }
.card.active { background:#f8fbff; }
.card b { display:block; font-size:32px; line-height:1; margin-top:9px; color:#0f172a; }
.panel { padding:20px; margin-bottom:18px; overflow:auto; }
.notice-row { display:grid; gap:10px; margin-bottom:18px; }
.notice { padding:12px 14px; border-radius:10px; border:1px solid var(--line); background:#f8fafc; color:#334155; font-size:14px; }
.notice.warning { background:#fff7ed; color:#9a3412; border-color:#fed7aa; }
.notice.danger { background:#fff1f2; color:#9f1239; border-color:#fecdd3; }
.notice.success { background:#ecfdf5; color:#047857; border-color:#abefc6; }
.table-wrap { width:100%; overflow-x:auto; }
table { width:100%; border-collapse:separate; border-spacing:0; font-size:13.5px; min-width:760px; }
th, td { text-align:left; padding:10px 11px; border-bottom:1px solid #e8eef6; vertical-align:top; overflow-wrap:anywhere; }
th { color:#475569; font-weight:900; background:#f7f9fc; font-size:11px; text-transform:uppercase; position:sticky; top:0; z-index:1; }
tbody tr:nth-child(even) td { background:#fbfdff; }
tr:hover td { background:#f4f8fc; }
form.inline, form.filters { display:grid; grid-template-columns:repeat(auto-fit, minmax(178px, 1fr)); gap:12px; align-items:end; }
form.filters { margin-bottom:16px; padding:14px; background:#f8fbff; border:1px solid var(--line); border-radius:10px; }
label { display:block; color:#344054; font-size:13px; font-weight:750; margin-bottom:6px; }
input, select, textarea { width:100%; min-height:40px; padding:9px 11px; border-radius:9px; border:1px solid var(--line); background:#fff; color:var(--ink); font-size:14px; outline:none; }
textarea { min-height:92px; resize:vertical; }
input:focus, select:focus, textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(11,99,206,.12); }
button, .button { display:inline-flex; align-items:center; justify-content:center; min-height:40px; background:var(--accent); color:#fff; border:0; border-radius:9px; padding:9px 15px; cursor:pointer; font-weight:800; font-size:14px; transition:.16s ease; white-space:nowrap; }
button:hover, .button:hover { background:var(--accent-dark); }
.button.secondary, button.secondary { background:#eef6ff; color:var(--accent); border:1px solid #bdd7f0; }
button.danger, .button.danger { background:#fff1f2; color:var(--danger); border:1px solid #fecdd3; }
button.ghost, .button.ghost { background:transparent; color:var(--accent); border:1px solid transparent; }
.flash { margin-bottom:18px; padding:13px 15px; border-radius:10px; background:#ecfdf3; color:#027a48; border:1px solid #abefc6; font-weight:700; }
.badge { display:inline-block; min-width:42px; text-align:center; padding:4px 9px; border-radius:999px; background:#eff6ff; color:var(--accent); font-weight:800; font-size:12px; }
.badge.out { background:#fff1f2; color:var(--rose); }
.badge.in, .badge.success { background:#ecfdf5; color:var(--success); }
.badge.warn, .badge.warning { background:#fff7ed; color:#c2410c; }
.badge.neutral { background:#f1f5f9; color:#475569; }
.status { display:inline-flex; align-items:center; gap:7px; padding:5px 10px; border-radius:999px; background:#ecfdf5; color:#047857; font-weight:800; font-size:12px; }
.status:before { content:""; width:7px; height:7px; border-radius:50%; background:currentColor; }
.status.off { background:#f1f5f9; color:#64748b; }
.warn { color:var(--danger); }
.sort { color:#334155; font-weight:900; }
.sort:hover { color:var(--accent); }
.table-meta { display:flex; justify-content:space-between; gap:14px; align-items:center; margin-bottom:12px; color:var(--muted); font-size:13px; }
.empty { padding:22px; text-align:center; color:var(--muted); background:#f8fafc; border:1px dashed var(--line); border-radius:10px; }
.actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.actions form { margin:0; }
.split { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(280px,.8fr); gap:18px; }
.employee-cell { display:flex; align-items:center; gap:10px; min-width:220px; }
.avatar { width:42px; height:42px; border-radius:50%; object-fit:cover; background:#f1f5f9; border:2px solid #fff; box-shadow:0 0 0 1px var(--line); flex:0 0 42px; }
.avatar.sm { width:34px; height:34px; flex-basis:34px; }
.avatar.placeholder { display:grid; place-items:center; color:#334155; font-weight:800; background:#e2e8f0; }
code { background:#f1f5f9; color:#334155; padding:2px 6px; border-radius:4px; }
@media (max-width: 1100px) {
  .layout { grid-template-columns:240px minmax(0,1fr); }
  .main { padding:0 20px 24px; }
  .hero { margin:0 -20px 20px; padding:18px 20px; }
}
@media (max-width: 900px) {
  .layout, .split { grid-template-columns:1fr; }
  .sidebar { position:static; height:auto; border-right:0; border-bottom:1px solid var(--line); }
  .nav { gap:10px; }
  .nav-section { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .nav-title { grid-column:1 / -1; }
  .main { padding:0 14px 18px; }
  .hero { margin:0 -14px 18px; padding:18px 14px; align-items:flex-start; flex-direction:column; }
  .hero-meta { justify-content:flex-start; }
  .sub { margin-left:0; }
}
@media (max-width: 640px) {
  .sidebar { padding:16px 12px; }
  .nav-section { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .nav a { font-size:13px; padding:9px 10px; }
  h1 { font-size:23px; }
  .panel { padding:14px; }
  .has-scroll-hint::before {
    content:"Таблицу можно прокрутить вправо \2192";
    display:inline-flex;
    align-items:center;
    min-height:28px;
    margin:0 0 10px;
    padding:6px 10px;
    border-radius:999px;
    background:#f1f5f9;
    color:#64748b;
    border:1px solid #dbe5f0;
    font-size:12px;
    font-weight:800;
  }
  .card b { font-size:28px; }
  form.inline, form.filters { grid-template-columns:1fr; }
  button, .button { width:100%; }
}

/* Dashboard refresh */
body { background:#eef3f8; }
.main { background:linear-gradient(180deg,#f7fbff 0,#eef3f8 260px,#eef3f8 100%); }
.hero { border-bottom-color:#dce7f3; }
.hero h1 { font-size:30px; color:#0f172a; }
.hero .muted { color:#475569; font-weight:650; }
.panel { border-radius:14px; box-shadow:0 1px 2px rgba(15,23,42,.05),0 18px 42px rgba(8,40,75,.08); }
.section-head { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin-bottom:16px; }
.section-head h3 { margin-bottom:4px; font-size:19px; color:#111827; }
.section-head p { margin:0; color:#64748b; font-size:13px; font-weight:650; }
.dashboard-shell { display:grid; gap:18px; }
.dashboard-notices { grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); }
.kpi-grid { display:grid; grid-template-columns:repeat(4,minmax(180px,1fr)); gap:16px; }
.kpi-card { position:relative; min-height:142px; padding:20px 20px 18px; border-radius:16px; background:#fff; border:1px solid #dce7f3; box-shadow:0 1px 2px rgba(15,23,42,.05),0 18px 38px rgba(8,40,75,.09); overflow:hidden; transition:.16s ease; }
.kpi-card:hover { transform:translateY(-2px); border-color:#9cc3e7; box-shadow:0 0 0 3px rgba(11,92,171,.08),0 18px 38px rgba(8,40,75,.10); }
.kpi-card:before { content:""; position:absolute; inset:0 auto 0 0; width:6px; background:#64748b; }
.kpi-card span { display:block; color:#26354a; font-size:14px; font-weight:900; }
.kpi-card b { display:block; margin:12px 0 10px; color:#0f172a; font-size:42px; line-height:1; letter-spacing:0; }
.kpi-card small { color:#64748b; font-size:13px; line-height:1.35; font-weight:700; }
.kpi-card.success:before { background:#059669; }
.kpi-card.warning:before { background:#d97706; }
.kpi-card.danger:before { background:#dc2626; }
.kpi-card.info:before { background:#2563eb; }
.kpi-card.neutral:before, .kpi-card.muted-card:before { background:#94a3b8; }
.dashboard-grid { display:grid; grid-template-columns:minmax(280px,.9fr) minmax(320px,1fr) minmax(320px,1fr); gap:18px; align-items:stretch; }
.chart-panel, .timeline-panel { min-height:306px; overflow:hidden; }
.donut-wrap { display:grid; grid-template-columns:190px 1fr; gap:20px; align-items:center; }
.donut { width:184px; height:184px; border-radius:50%; display:grid; place-items:center; background:conic-gradient(#059669 0 var(--inside-end), #2563eb var(--inside-end) var(--out-end), #cbd5e1 var(--out-end) 100%); box-shadow:inset 0 0 0 1px rgba(15,23,42,.06); }
.donut:before { content:""; position:absolute; width:112px; height:112px; border-radius:50%; background:#fff; box-shadow:0 0 0 1px #e2e8f0; }
.donut > div { position:relative; z-index:1; text-align:center; }
.donut b { display:block; font-size:38px; line-height:1; color:#0f172a; }
.donut span { display:block; margin-top:5px; color:#64748b; font-size:12px; font-weight:900; text-transform:uppercase; }
.legend-list { display:grid; gap:11px; }
.legend-list div { display:grid; grid-template-columns:14px 1fr auto; gap:9px; align-items:center; min-height:34px; color:#334155; font-weight:800; }
.legend-list b { font-size:18px; color:#0f172a; }
.legend-dot { width:11px; height:11px; border-radius:50%; display:inline-block; background:#94a3b8; }
.legend-dot.success { background:#059669; }
.legend-dot.info { background:#2563eb; }
.legend-dot.muted { background:#cbd5e1; }
.bar-chart { display:grid; gap:18px; padding-top:4px; }
.bar-row { display:grid; grid-template-columns:128px 1fr 42px; gap:12px; align-items:center; }
.bar-row span { color:#334155; font-size:13px; font-weight:900; }
.bar-row div { height:18px; border-radius:999px; background:#edf2f7; overflow:hidden; border:1px solid #e2e8f0; }
.bar-row i { display:block; height:100%; min-width:4px; border-radius:999px; }
.bar-row i.success { background:#059669; }
.bar-row i.warning { background:#d97706; }
.bar-row i.danger { background:#dc2626; }
.bar-row b { color:#0f172a; font-size:18px; text-align:right; }
.event-timeline { display:grid; gap:10px; }
.timeline-item { display:grid; grid-template-columns:42px 1fr; gap:10px; align-items:center; padding:10px 0; border-bottom:1px solid #edf2f7; }
.timeline-item:last-child { border-bottom:0; }
.timeline-type { display:inline-grid; place-items:center; width:36px; height:28px; border-radius:999px; font-size:12px; font-weight:900; background:#eff6ff; color:#2563eb; }
.timeline-item.in .timeline-type { background:#ecfdf5; color:#047857; }
.timeline-item.out .timeline-type { background:#eff6ff; color:#2563eb; }
.timeline-item strong { display:block; color:#111827; }
.timeline-item small { color:#64748b; font-weight:700; }
.segmented { display:flex; flex-wrap:wrap; gap:8px; }
.segmented a { min-height:34px; display:inline-flex; align-items:center; padding:7px 11px; border-radius:999px; background:#f1f5f9; color:#334155; border:1px solid #dbe5f0; font-size:13px; font-weight:850; }
.segmented a.active, .segmented a:hover { background:#0b5cab; color:#fff; border-color:#0b5cab; }
.presence-table td, .presence-table th { padding:12px 11px; }
.badge.info { background:#eff6ff; color:#2563eb; }
.badge.danger { background:#fff1f2; color:#be123c; }
.code-badge { display:inline-flex; align-items:center; min-height:26px; padding:3px 9px; border-radius:999px; background:#eef6ff; color:#0b5cab; border:1px solid #bdd7f0; font-size:12px; font-weight:900; }
.employee-cell strong { color:#111827; line-height:1.25; }
.employee-cell .muted { font-size:12px; font-weight:750; }
.avatar { border-radius:12px; width:46px; height:46px; flex-basis:46px; }
.avatar.sm { width:36px; height:36px; flex-basis:36px; border-radius:10px; }
table { font-size:14px; }
th { font-size:12px; color:#334155; background:#eef4fb; }
td { color:#243244; }
.report-summary { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px; margin-bottom:16px; }
.mini-card { padding:14px 15px; border-radius:12px; border:1px solid #dce7f3; background:#fff; box-shadow:0 1px 2px rgba(15,23,42,.04); }
.mini-card span { display:block; color:#64748b; font-size:12px; font-weight:900; text-transform:uppercase; }
.mini-card b { display:block; margin-top:7px; color:#0f172a; font-size:28px; line-height:1; }
.mini-card.warning { border-color:#fed7aa; background:#fffaf0; }
.mini-card.neutral { background:#f8fafc; }
@media (max-width: 1320px) { .kpi-grid { grid-template-columns:repeat(2,minmax(180px,1fr)); } .dashboard-grid { grid-template-columns:1fr 1fr; } .timeline-panel { grid-column:1 / -1; } }
@media (max-width: 760px) { .kpi-grid, .dashboard-grid, .donut-wrap { grid-template-columns:1fr; } .kpi-card b { font-size:36px; } .donut { margin:auto; } .section-head { flex-direction:column; } .bar-row { grid-template-columns:100px 1fr 34px; } }

.donut { position:relative; }

/* Visual polish: clearer dashboard and charts */
:root {
  --page-bg:#f3f6fa;
  --surface-strong:#ffffff;
  --cyan:#0891b2;
  --violet:#6d5dfc;
}

body {
  background:
    radial-gradient(circle at 18% 0%, rgba(8,145,178,.10), transparent 28%),
    linear-gradient(180deg,#f8fbff 0,#eef3f8 46%,#edf2f7 100%);
}

.layout {
  background:transparent;
}

.sidebar {
  background:linear-gradient(180deg,#082843 0,#0b3f67 58%,#123c50 100%);
}

.brand {
  font-size:18px;
}

.nav a,
.nav .logout-button {
  border-radius:8px;
}

.main {
  background:transparent;
  padding-bottom:34px;
}

.hero {
  position:sticky;
  top:0;
  z-index:5;
  background:rgba(255,255,255,.88);
  border-bottom-color:#d9e5f2;
}

.hero h1 {
  font-size:32px;
}

.panel {
  border-color:#d7e3f0;
  background:rgba(255,255,255,.96);
}

.dashboard-shell {
  gap:20px;
}

.dashboard-notices {
  gap:12px;
}

.notice {
  margin:0;
  font-weight:750;
}

.kpi-grid {
  grid-template-columns:repeat(4,minmax(190px,1fr));
  gap:14px;
}

.kpi-card {
  min-height:132px;
  padding:18px 18px 16px;
  border-radius:12px;
  background:
    linear-gradient(135deg,rgba(255,255,255,.96),rgba(248,251,255,.96));
}

.kpi-card:after {
  content:"";
  position:absolute;
  top:16px;
  right:16px;
  width:42px;
  height:42px;
  border-radius:12px;
  background:rgba(100,116,139,.10);
  pointer-events:none;
  z-index:0;
}

.kpi-card.success:after { background:rgba(5,150,105,.13); }
.kpi-card.warning:after { background:rgba(217,119,6,.14); }
.kpi-card.danger:after { background:rgba(220,38,38,.12); }
.kpi-card.info:after { background:rgba(8,145,178,.14); }

.kpi-card span {
  position:relative;
  z-index:1;
  max-width:calc(100% - 48px);
  color:#334155;
}

.kpi-card b {
  position:relative;
  z-index:1;
  font-size:40px;
}

.kpi-card small {
  position:relative;
  z-index:1;
  color:#53657a;
}

.dashboard-grid {
  grid-template-columns:minmax(360px,1.05fr) minmax(360px,1fr) minmax(320px,.95fr);
  gap:18px;
}

.chart-panel,
.timeline-panel,
.presence-panel {
  border-radius:12px;
}

.chart-panel {
  min-height:360px;
  display:flex;
  flex-direction:column;
}

.section-head {
  align-items:center;
  padding-bottom:13px;
  border-bottom:1px solid #e5edf6;
}

.section-head h3 {
  font-size:20px;
}

.section-head p {
  color:#53657a;
}

.donut-wrap {
  flex:1;
  grid-template-columns:220px minmax(0,1fr);
  gap:24px;
  padding-top:8px;
}

.donut {
  width:220px;
  height:220px;
  background:
    conic-gradient(
      #059669 0 var(--inside-end),
      #0891b2 var(--inside-end) var(--out-end),
      #94a3b8 var(--out-end) 100%
    );
  box-shadow:
    inset 0 0 0 1px rgba(15,23,42,.08),
    0 18px 34px rgba(8,40,75,.13);
}

.donut:before {
  width:132px;
  height:132px;
  background:linear-gradient(180deg,#fff,#f8fbff);
  box-shadow:0 0 0 1px #dbe5f0, 0 8px 18px rgba(15,23,42,.07);
}

.donut b {
  font-size:44px;
}

.donut span {
  color:#475569;
}

.legend-list {
  gap:12px;
}

.legend-list div {
  grid-template-columns:16px minmax(0,1fr) auto;
  min-height:46px;
  padding:9px 11px;
  border:1px solid #e1eaf4;
  border-radius:10px;
  background:#f8fbff;
}

.legend-list span {
  display:flex;
  justify-content:space-between;
  gap:10px;
  min-width:0;
}

.legend-list small {
  color:#64748b;
  font-weight:900;
}

.legend-dot {
  width:12px;
  height:12px;
  box-shadow:0 0 0 4px rgba(148,163,184,.15);
}

.legend-dot.success { box-shadow:0 0 0 4px rgba(5,150,105,.15); }
.legend-dot.info { background:#0891b2; box-shadow:0 0 0 4px rgba(8,145,178,.15); }
.legend-dot.muted { background:#94a3b8; }

.bar-chart {
  flex:1;
  align-content:center;
  gap:22px;
  padding:10px 2px 4px;
}

.bar-row {
  grid-template-columns:136px minmax(120px,1fr) 54px;
  gap:14px;
}

.bar-row span {
  color:#243244;
}

.bar-row div {
  height:26px;
  background:#eef3f8;
  border-color:#d9e5f2;
  box-shadow:inset 0 1px 2px rgba(15,23,42,.05);
}

.bar-row i {
  min-width:8px;
  box-shadow:inset 0 -8px 16px rgba(255,255,255,.16);
}

.bar-row i.success { background:linear-gradient(90deg,#047857,#10b981); }
.bar-row i.warning { background:linear-gradient(90deg,#b45309,#f59e0b); }
.bar-row i.danger { background:linear-gradient(90deg,#be123c,#ef4444); }

.bar-row b {
  font-size:21px;
}

.event-timeline {
  gap:0;
}

.timeline-item {
  grid-template-columns:48px 1fr;
  padding:12px 0;
}

.timeline-type {
  width:40px;
  height:32px;
}

.presence-panel {
  overflow:hidden;
}

.presence-panel .section-head {
  align-items:flex-start;
}

.segmented a {
  border-radius:8px;
}

.presence-table th,
.presence-table td {
  padding:13px 12px;
}

@media (max-width: 1320px) {
  .dashboard-grid {
    grid-template-columns:1fr 1fr;
  }
}

@media (max-width: 900px) {
  .hero {
    position:static;
  }

  .kpi-grid,
  .dashboard-grid {
    grid-template-columns:1fr;
  }

  .chart-panel {
    min-height:auto;
  }
}

@media (max-width: 760px) {
  .hero h1 {
    font-size:25px;
  }

  .donut-wrap {
    grid-template-columns:1fr;
    justify-items:stretch;
  }

  .donut {
    width:206px;
    height:206px;
  }

  .bar-row {
    grid-template-columns:1fr 58px;
    gap:8px 12px;
  }

  .bar-row span {
    grid-column:1 / -1;
  }
}

/* Strong admin redesign */
:root {
  --ink:#111827;
  --muted:#5b677a;
  --line:#d7e0ec;
  --accent:#0f766e;
  --accent-dark:#115e59;
  --accent-soft:#e7f8f5;
  --nav:#10233f;
  --nav-2:#12324f;
  --gold:#f4b942;
  --success:#059669;
  --warning:#d97706;
  --danger:#dc2626;
  --shadow:0 10px 28px rgba(16,35,63,.08), 0 2px 6px rgba(16,35,63,.05);
}

html {
  background:#eef3f7;
}

body {
  color:#111827;
  background:
    linear-gradient(135deg,rgba(15,118,110,.10) 0,transparent 28%),
    linear-gradient(225deg,rgba(244,185,66,.12) 0,transparent 26%),
    #eef3f7;
}

.wrap {
  background:
    linear-gradient(135deg,rgba(16,35,63,.94),rgba(15,118,110,.78)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.08'%3E%3Cpath d='M0 40h180M0 100h180M0 160h180M40 0v180M100 0v180M160 0v180'/%3E%3C/g%3E%3C/svg%3E");
}

.wrap .card {
  border:0;
  border-radius:18px;
  background:rgba(255,255,255,.96);
  box-shadow:0 24px 70px rgba(0,0,0,.22);
}

.wrap .card:before {
  background:linear-gradient(135deg,#f4b942,#ffe08a);
}

.wrap h1 {
  font-size:34px;
}

.wrap input {
  min-height:46px;
  border-radius:12px;
}

.wrap button {
  min-height:48px;
  border-radius:12px;
  background:linear-gradient(135deg,#0f766e,#0f8f83);
}

.layout {
  grid-template-columns:292px minmax(0,1fr);
}

.sidebar {
  padding:22px 16px;
  background:
    linear-gradient(180deg,rgba(16,35,63,.98),rgba(18,50,79,.98)),
    linear-gradient(135deg,rgba(244,185,66,.16),transparent 45%);
  box-shadow:18px 0 45px rgba(16,35,63,.18);
}

.brand {
  min-height:64px;
  padding:0 10px 16px;
  margin-bottom:0;
  border-bottom:1px solid rgba(255,255,255,.12);
  font-size:21px;
}

.brand:before {
  width:50px;
  height:50px;
  flex-basis:50px;
  border-radius:14px;
  background:linear-gradient(135deg,#f4b942,#ffe08a);
}

.sub {
  margin:14px 10px 22px;
  color:#c4d3e4;
}

.nav {
  gap:18px;
}

.nav-title {
  padding-left:12px;
  color:#9fb6cc;
}

.nav a {
  min-height:46px;
  padding:11px 13px;
  border-radius:12px;
  color:#dce8f5;
  background:rgba(255,255,255,.04);
}

.nav a:hover,
.nav a.active {
  transform:none;
  background:rgba(255,255,255,.13);
  border-color:rgba(255,255,255,.18);
}

.nav a.active {
  color:#fff;
  box-shadow:inset 4px 0 0 #f4b942, 0 8px 18px rgba(0,0,0,.12);
}

.nav .logout-button {
  min-height:46px;
  border-radius:12px;
}

.main {
  padding:0 34px 36px;
}

.hero {
  margin:0 -34px 28px;
  padding:22px 34px;
  background:rgba(255,255,255,.92);
  box-shadow:0 10px 30px rgba(16,35,63,.08);
}

.hero-main:before {
  width:8px;
  flex-basis:8px;
  background:linear-gradient(180deg,#0f766e,#f4b942);
}

.hero h1 {
  font-size:34px;
}

.user-pill {
  min-height:38px;
  border-radius:12px;
  background:#fff;
}

.notice {
  border-radius:12px;
  box-shadow:0 1px 0 rgba(16,35,63,.03);
}

.kpi-grid {
  grid-template-columns:repeat(4,minmax(200px,1fr));
}

.kpi-card {
  min-height:150px;
  border-radius:14px;
  border:1px solid #d5e0ec;
  background:#fff;
}

.kpi-card:before {
  width:7px;
}

.kpi-card:after {
  width:48px;
  height:48px;
  border-radius:14px;
}

.kpi-card b {
  font-size:46px;
}

.dashboard-grid {
  grid-template-columns:minmax(400px,1.05fr) minmax(400px,1fr) minmax(340px,.9fr);
}

.panel {
  border-radius:14px;
  border:1px solid #d5e0ec;
  background:#fff;
  box-shadow:var(--shadow);
}

.chart-panel {
  min-height:392px;
}

.section-head {
  margin-bottom:18px;
}

.section-head h3 {
  font-size:21px;
}

.donut-wrap {
  grid-template-columns:250px minmax(0,1fr);
}

.donut {
  width:250px;
  height:250px;
  background:
    conic-gradient(
      #059669 0 var(--inside-end),
      #0ea5a3 var(--inside-end) var(--out-end),
      #9ca3af var(--out-end) 100%
    );
}

.donut:before {
  width:148px;
  height:148px;
}

.donut b {
  font-size:52px;
}

.legend-list div {
  min-height:54px;
  border-radius:12px;
}

.legend-list b {
  font-size:22px;
}

.bar-chart {
  gap:24px;
}

.bar-row {
  grid-template-columns:150px minmax(130px,1fr) 58px;
}

.bar-row div {
  height:30px;
}

.bar-row b {
  font-size:24px;
}

table {
  border-spacing:0;
}

th {
  background:#eef4f8;
  color:#233247;
}

td {
  background:#fff;
}

tbody tr:nth-child(even) td {
  background:#fbfdff;
}

input,
select,
textarea {
  min-height:44px;
  border-radius:11px;
}

button,
.button {
  min-height:44px;
  border-radius:11px;
  background:#0f766e;
}

button:hover,
.button:hover {
  background:#115e59;
}

.button.secondary,
button.secondary {
  background:#e7f8f5;
  color:#0f766e;
  border-color:#b9ded8;
}

@media (max-width: 1320px) {
  .dashboard-grid,
  .kpi-grid {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns:1fr;
  }

  .main {
    padding:0 16px 24px;
  }

  .hero {
    margin:0 -16px 20px;
    padding:18px 16px;
  }

  .dashboard-grid,
  .kpi-grid {
    grid-template-columns:1fr;
  }
}

@media (max-width: 760px) {
  .donut-wrap {
    grid-template-columns:1fr;
  }

  .donut {
    width:220px;
    height:220px;
  }

  .bar-row {
    grid-template-columns:1fr 58px;
  }
}

/* ============================================================
   Dynamic layout layer — responsive drawer, collapsible
   sidebar, hamburger control and motion polish.
   ============================================================ */

.layout {
  transition: grid-template-columns .26s cubic-bezier(.4,0,.2,1);
}

/* Hamburger button in the hero */
.menu-toggle {
  display:inline-flex;
  flex-direction:column;
  justify-content:center;
  gap:5px;
  flex:0 0 auto;
  width:44px;
  height:44px;
  min-height:44px;
  padding:0;
  margin-right:4px;
  border-radius:12px;
  background:#0f766e;
  border:0;
  cursor:pointer;
  box-shadow:0 6px 16px rgba(15,118,110,.28);
}
.menu-toggle span {
  display:block;
  width:20px;
  height:2px;
  margin:0 auto;
  border-radius:2px;
  background:#fff;
  transition:transform .22s ease, opacity .22s ease;
}
.menu-toggle:hover { background:#115e59; }
.menu-toggle:focus-visible { outline:3px solid rgba(15,118,110,.35); outline-offset:2px; }

/* Close (×) button shown only inside the mobile drawer */
.sidebar-close {
  display:none;
  position:absolute;
  top:14px;
  right:14px;
  width:36px;
  height:36px;
  min-height:36px;
  padding:0;
  border:0;
  border-radius:10px;
  background:rgba(255,255,255,.12);
  color:#fff;
  font-size:24px;
  line-height:1;
  cursor:pointer;
}
.sidebar-close:hover { background:rgba(255,255,255,.22); }

/* Backdrop behind the mobile drawer */
.sidebar-overlay {
  position:fixed;
  inset:0;
  z-index:40;
  background:rgba(8,18,34,.5);
  backdrop-filter:blur(2px);
  opacity:0;
  transition:opacity .26s ease;
}
body.sidebar-open .sidebar-overlay { opacity:1; }

/* Smooth nav + scroll behaviour */
html { scroll-behavior:smooth; }
.nav a { transition:background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease; }
.nav a:active { transform:scale(.98); }

/* ---- Desktop: collapsible sidebar (hide to reclaim width) ---- */
@media (min-width: 901px) {
  body.sidebar-collapsed .layout { grid-template-columns: 0 minmax(0,1fr); }
  body.sidebar-collapsed .sidebar {
    padding-left:0;
    padding-right:0;
    overflow:hidden;
    box-shadow:none;
    pointer-events:none;
  }
  body.sidebar-collapsed .sidebar > * { opacity:0; transition:opacity .14s ease; }
}

/* ---- Mobile / tablet: off-canvas slide-in drawer ---- */
@media (max-width: 900px) {
  .layout { grid-template-columns:1fr; }

  .sidebar {
    position:fixed;
    top:0;
    left:0;
    z-index:50;
    width:min(300px, 86vw);
    height:100vh;
    height:100dvh;
    overflow-y:auto;
    border-right:1px solid rgba(255,255,255,.12);
    border-bottom:0;
    transform:translateX(-100%);
    transition:transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow:24px 0 60px rgba(8,24,45,.34);
  }
  body.sidebar-open .sidebar { transform:translateX(0); }

  /* Single readable column inside the drawer */
  .nav-section { grid-template-columns:1fr; }
  .nav a { font-size:15px; }
  .sidebar-close { display:block; }
  .sub { margin-left:0; }

  /* Lock background scroll while the drawer is open */
  body.sidebar-open { overflow:hidden; }
}

/* Show the hamburger only where the drawer/collapse applies usefully */
@media (min-width: 901px) {
  .sidebar-overlay { display:none; }
}

/* Entrance motion for content panels */
@media (prefers-reduced-motion: no-preference) {
  .panel, .kpi-card, .mini-card {
    animation:ekadrRise .4s cubic-bezier(.4,0,.2,1) both;
  }
  @keyframes ekadrRise {
    from { opacity:0; transform:translateY(8px); }
    to   { opacity:1; transform:none; }
  }
}

/* ============================================================
   Brand logo + navigation icons
   ============================================================ */

/* Drop the legacy "EK" monogram badges — replaced by real logo */
.brand:before { content:none; display:none; }
.wrap .card:before { content:none; display:none; }

/* Sidebar logo card (logo sits on white, sidebar is dark) */
.brand-logo-wrap {
  margin:2px 6px 14px;
  padding:9px 12px;
  border-radius:14px;
  background:#fff;
  box-shadow:0 10px 24px rgba(8,24,45,.22);
  overflow:hidden;
}
.brand-logo {
  display:block;
  width:100%;
  height:74px;
  object-fit:cover;
  object-position:center;
}
.brand {
  display:block;
  min-height:auto;
  margin:0 0 2px;
  padding:0 10px;
  border-bottom:0;
  font-size:17px;
  font-weight:900;
  letter-spacing:.01em;
}

/* Login screen logo */
.login-logo {
  display:block;
  width:100%;
  height:104px;
  object-fit:cover;
  object-position:center;
  margin:0 0 18px;
  border-radius:12px;
  background:#fff;
  box-shadow:0 6px 18px rgba(16,35,63,.08);
}

/* Navigation icons */
.nav a {
  gap:11px;
}
.nav a svg,
.nav .logout-button svg {
  width:19px;
  height:19px;
  flex:0 0 19px;
  opacity:.82;
  transition:opacity .16s ease, transform .16s ease;
}
.nav a span,
.nav .logout-button span {
  flex:1 1 auto;
  min-width:0;
}
.nav a:hover svg,
.nav a.active svg {
  opacity:1;
}
.nav a.active svg {
  color:#f4b942;
}
.nav .logout-button {
  display:inline-flex;
  align-items:center;
  gap:11px;
}
.nav .logout-button svg {
  opacity:.95;
}

/* Hide labels (icon-only rail) when sidebar is collapsed on desktop —
   not used currently, but keeps icons crisp if width tightens */
@media (max-width: 900px) {
  .brand-logo { height:64px; }
}
