:root {
  --indigo: #3730a3;
  --indigo-dark: #312e81;
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1480px; margin: 0 auto; padding: 18px 16px 90px; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.accent-line { height: 3px; background: linear-gradient(90deg, #4f46e5, #7c3aed, #0ea5e9); }
.brand { display: flex; gap: 10px; align-items: center; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--indigo); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
}
.brand strong { display: block; font-size: 14px; }
.brand span { font-size: 12px; color: var(--muted); }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.clock {
  background: #f1f5f9; border-radius: 10px; padding: 6px 10px;
  font-size: 12px; text-align: right; line-height: 1.25;
}
.lang {
  border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px;
  background: #fff; font-size: 12px; font-weight: 600;
}
.user-chip { display: flex; gap: 8px; align-items: center; }
.avatar {
  width: 32px; height: 32px; border-radius: 8px; background: #e0e7ff;
  color: var(--indigo); display: grid; place-items: center; font-weight: 700; font-size: 12px;
}
.user-chip b { display: block; font-size: 12px; }
.user-chip small { color: var(--muted); font-size: 11px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.card h1, .card h2 { margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 16px 0; }
.field { display: grid; gap: 6px; font-size: 13px; }
.field span { color: var(--muted); font-weight: 600; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px; border: 1px solid transparent; padding: 10px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer; background: var(--indigo); color: #fff;
}
.btn:hover { background: var(--indigo-dark); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn.ghost:hover { background: #f8fafc; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { padding: 7px 12px; font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; font-size: 11px; letter-spacing: .04em;
  color: #94a3b8; text-transform: uppercase; padding: 10px 8px; border-bottom: 1px solid var(--line);
}
td { padding: 12px 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.emp-name { font-weight: 600; }
.emp-code { color: var(--muted); font-size: 12px; }
.badge {
  display: inline-flex; border-radius: 999px; padding: 3px 9px;
  font-size: 11px; font-weight: 700;
}
.badge.paid, .badge.ok, .badge.approved, .badge.active, .badge.present, .badge.reviewed { background: #ecfdf5; color: #047857; }
.badge.processed, .badge.submitted, .badge.leave { background: #eff6ff; color: #1d4ed8; }
.badge.warn, .badge.pending, .badge.half-day { background: #fffbeb; color: #b45309; }
.badge.bad, .badge.rejected, .badge.absent, .badge.important { background: #fef2f2; color: #b91c1c; }
.badge.inactive, .badge.normal, .badge.week-off { background: #f1f5f9; color: #475569; }

.flash { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: #ecfdf5; color: #065f46; }
.flash.err { background: #fef2f2; color: #991b1b; }

.back {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #f8fafc;
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600;
  margin-bottom: 12px;
}
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0 0 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: 0 8px 24px rgba(15,23,42,.03); }
.stat b { display: block; font-size: 28px; margin-top: 8px; }
.stat span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  border: 0; border-radius: 999px; padding: 9px 16px; font-weight: 700; font-size: 13px;
  background: #f1f5f9; color: #475569; cursor: pointer;
}
.tab.active { background: #312e81; color: #fff; }

.module-board { background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 16px; box-shadow: 0 8px 24px rgba(15,23,42,.03); }
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.mod {
  position: relative;
  display: block;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  padding: 16px;
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.mod:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(15,23,42,.08); }
.mod .bar { position: absolute; inset: 0 0 auto 0; height: 4px; }
.mod .icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; font-weight: 800; margin-bottom: 14px; font-size: 14px;
}
.mod h3 { margin: 0 0 6px; font-size: 15px; }
.mod p { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }

.tone-indigo .bar, .tone-indigo .icon { background: #4f46e5; }
.tone-sky .bar, .tone-sky .icon { background: #0284c7; }
.tone-amber .bar, .tone-amber .icon { background: #f59e0b; }
.tone-emerald .bar, .tone-emerald .icon { background: #059669; }
.tone-violet .bar, .tone-violet .icon { background: #7c3aed; }
.tone-rose .bar, .tone-rose .icon { background: #e11d48; }
.tone-blue .bar, .tone-blue .icon { background: #2563eb; }
.tone-cyan .bar, .tone-cyan .icon { background: #0891b2; }
.tone-orange .bar, .tone-orange .icon { background: #ea580c; }
.tone-fuchsia .bar, .tone-fuchsia .icon { background: #c026d3; }
.tone-teal .bar, .tone-teal .icon { background: #0d9488; }
.tone-slate .bar, .tone-slate .icon { background: #334155; }

.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: linear-gradient(160deg, #0f172a, #312e81 55%, #1e3a8a);
}
.login-card {
  width: min(440px, 100%); background: #fff; border-radius: 22px; padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-card h1 { margin: 8px 0; }
.note {
  background: #eef2ff; border-radius: 14px; padding: 12px; font-size: 13px; color: #3730a3; margin-top: 14px;
}
.grid-2 { display: grid; grid-template-columns: 1.1fr .9fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.table-scroll { overflow-x: auto; }
.cut { color: #b91c1c; font-weight: 600; }
.free { color: #047857; font-weight: 600; }
.list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.history-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.history-card h3 { margin: 0 0 8px; font-size: 16px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 13px; }
.kv div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed #eef2f7; padding: 4px 0; }
.rule-box {
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  border-radius: 14px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px;
}
.desk {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  background: var(--indigo); color: #fff; border: 0; border-radius: 999px;
  padding: 12px 16px; font-weight: 700; box-shadow: 0 10px 24px rgba(55,48,163,.35);
  cursor: pointer;
}
.desk .count {
  background: #fff; color: var(--indigo); border-radius: 999px; padding: 2px 7px; margin-left: 6px; font-size: 12px;
}
.desk-panel {
  display: none; position: fixed; right: 18px; bottom: 78px; z-index: 30;
  width: min(340px, calc(100vw - 32px)); background: #fff; border: 1px solid var(--line);
  border-radius: 20px; padding: 16px; box-shadow: 0 18px 40px rgba(15,23,42,.18);
}
.desk-panel.open { display: block; }
.year-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.month-box { border: 1px solid var(--line); border-radius: 16px; padding: 10px; background: #fbfefe; }
.month-box h4 { margin: 0 0 8px; font-size: 13px; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; font-size: 10px; color: #94a3b8; font-weight: 700; }
.cal-cells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; margin-top: 4px; }
.cal-cells span {
  min-height: 26px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 600;
}
.cal-cells .hol { background: var(--indigo); color: #fff; }
.cal-cells .leave { background: #d1fae5; color: #065f46; }
.cal-cells .pend { background: #fef3c7; color: #92400e; }
.cal-cells .sun { color: #cbd5e1; }
.tabs-inline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
@media (max-width: 1100px) {
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .year-grid, .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .module-grid, .year-grid, .grid-2, .grid-3, .kv { grid-template-columns: 1fr; }
  .clock { display: none; }
}
