:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --ink: #171a2f;
  --muted: #70758b;
  --line: #e2e6f0;
  --nav: #101426;
  --primary: #4f46e5;
  --primary-2: #3730a3;
  --primary-soft: #ecebff;
  --cyan: #0ea5e9;
  --gold: #c0872f;
  --danger: #a93545;
  --success: #2563eb;
  --shadow: 0 22px 60px rgba(24, 30, 57, .12);
  --shadow-soft: 0 12px 30px rgba(24, 30, 57, .08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Tahoma, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(79, 70, 229, .12), transparent 28rem),
    radial-gradient(circle at 90% 0%, rgba(14, 165, 233, .12), transparent 24rem),
    linear-gradient(135deg, #f7f8fc 0%, var(--bg) 100%);
  letter-spacing: 0;
}

a { color: var(--primary); text-decoration: none; }
button, input, select { font: inherit; letter-spacing: 0; }
button, .primary-link, .secondary-link {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
button:hover, .primary-link:hover, .secondary-link:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
button:active, .primary-link:active, .secondary-link:active { transform: translateY(0); }
.secondary-link { background: var(--primary-soft); color: var(--primary); }
.danger-button { background: #fff0f2; color: var(--danger); }

input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus { border-color: rgba(79,70,229,.68); box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }
.time-12-control {
  display: block;
}
.time-input,
.time-12-control input,
.time-12-control select {
  direction: ltr;
  text-align: center;
  unicode-bidi: plaintext;
}
.time-input {
  min-height: 54px;
  font-weight: 900;
  font-size: 18px;
  padding-inline: 14px;
}
.password-field {
  position: relative;
  display: block;
}
.password-field input { padding-left: 76px; }
.password-toggle {
  position: absolute;
  inset: 6px auto 6px 6px;
  min-height: 32px;
  min-width: 58px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--primary);
  box-shadow: none;
  font-size: 13px;
}
.password-toggle:hover { box-shadow: none; transform: none; }
label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.5;
}
.absence-equivalent {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid rgba(79,70,229,.16);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
input[readonly][aria-disabled="true"] {
  background: #f4f6fb;
  color: #5f6478;
  cursor: not-allowed;
}
h1, h2 { margin: 0; line-height: 1.25; }
h1 { font-size: clamp(28px, 3vw, 44px); }
h2 { font-size: clamp(20px, 2vw, 28px); }
p { line-height: 1.75; }

.plain {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}
.plain::before {
  content: "";
  position: fixed;
  inset: 18px;
  border: 1px solid rgba(79, 70, 229, .14);
  border-radius: 24px;
  pointer-events: none;
}
.auth-card, .clock-card {
  width: min(100%, 470px);
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(226,230,240,.9);
  border-radius: 20px;
  padding: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: rise .28s ease both;
}
.auth-kicker, .eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}
.auth-card h1, .clock-card h1 { margin: 10px 0 22px; }
.login-card { background:
  linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.86)),
  radial-gradient(circle at top left, rgba(79,70,229,.18), transparent 18rem);
}
.site-credit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.site-credit a {
  color: var(--primary);
  font-weight: 900;
  transition: color .18s ease, transform .18s ease;
}
.site-credit a:hover {
  color: var(--primary-2);
  transform: translateY(-1px);
}
.form-grid, .settings-form { display: grid; gap: 15px; }
.employee-form { display: grid; gap: 14px; }

.app-shell {
  min-height: 100vh;
  width: 100%;
  display: grid !important;
  grid-template-columns: 280px minmax(0, 1fr) !important;
  align-items: stretch;
  direction: rtl;
}
.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  grid-column: 1;
  width: 280px;
  max-width: 280px;
  height: 100dvh;
  padding: 22px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(79,70,229,.22), transparent 34%),
    var(--nav);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  font-weight: 900;
  box-shadow: 0 16px 32px rgba(0,0,0,.25);
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand b { display: block; }
.brand small { display: block; margin-top: 4px; color: #aeb4ca; font-size: 11px; }
.sidebar nav { display: grid; align-content: start; gap: 8px; }
.sidebar a, .logout button {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: var(--radius);
  background: transparent;
  color: #e6e9f5;
  padding: 10px 12px;
  font-weight: 900;
  box-shadow: none;
}
.sidebar a span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255,255,255,.08);
  color: #cbd1e8;
  font-size: 11px;
}
.sidebar a:hover, .logout button:hover { background: rgba(255,255,255,.08); transform: translateX(-2px); box-shadow: none; }
.sidebar a.active {
  background: linear-gradient(90deg, rgba(79,70,229,.42), rgba(255,255,255,.08));
  box-shadow: inset -3px 0 0 var(--cyan);
}
.sidebar a.active span { background: #fff; color: var(--primary); }
.logout { margin: 0; }
.logout button { width: 100%; justify-content: center; color: #ffd8dd; }

.content {
  grid-column: 2;
  min-width: 0;
  width: 100%;
  padding: 22px clamp(16px, 3vw, 36px) 42px;
}
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 14px 16px;
  border: 1px solid rgba(226,230,240,.9);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}
.topbar > div:nth-child(2) { display: grid; gap: 4px; }
.topbar strong { font-size: 18px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions > span {
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.user-menu { position: relative; }
.user-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 13px;
  border-radius: 999px;
  background: var(--nav);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu > div {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 180px;
  z-index: 20;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  animation: rise .18s ease both;
}
.user-menu a, .user-menu button {
  width: 100%;
  min-height: 38px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}
.user-menu button { color: var(--danger); }
.menu-toggle { display: none; width: 44px; padding: 0; background: var(--nav); }
.scrim { display: none; }

.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(226,230,240,.9);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.94), rgba(255,255,255,.78)),
    radial-gradient(circle at 8% 12%, rgba(79,70,229,.18), transparent 20rem),
    radial-gradient(circle at 90% 0%, rgba(14,165,233,.16), transparent 18rem);
  box-shadow: var(--shadow-soft);
}
.hero-panel p { margin: 10px 0 0; color: var(--muted); }
.hero-panel.compact h1 { font-size: clamp(26px, 2.5vw, 38px); }

.metric-grid, .finance-grid, .detail-grid {
  display: grid;
  gap: 14px;
}
.metric-grid { grid-template-columns: repeat(5, minmax(140px, 1fr)); margin-bottom: 18px; }
.metric-card, .finance-grid article, .detail-card, .panel, .employee-profile, .employee-list {
  border: 1px solid rgba(226,230,240,.9);
  border-radius: 16px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow-soft);
}
.metric-card {
  min-height: 132px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.metric-card::after {
  content: "";
  position: absolute;
  width: 80px;
  height: 80px;
  left: -24px;
  bottom: -28px;
  border-radius: 50%;
  background: rgba(79,70,229,.1);
}
.metric-card span, .finance-grid span, .detail-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 900; margin-bottom: 10px; }
.metric-card strong, .finance-grid strong, .detail-card b { position: relative; z-index: 1; font-size: clamp(24px, 2.4vw, 34px); }
.metric-card small { display: block; margin-top: 8px; color: var(--muted); }
.metric-card.warning strong { color: var(--gold); }
.metric-card.accent strong, .finance-grid .net strong { color: var(--primary); }

.dashboard-redesign {
  display: grid;
  gap: 16px;
}
.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(18px, 2.6vw, 28px);
  border: 1px solid rgba(226,230,240,.92);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(248,249,253,.9)),
    radial-gradient(circle at 12% 0%, rgba(79,70,229,.15), transparent 20rem);
  box-shadow: var(--shadow-soft);
}
.dashboard-hero h1 {
  margin-top: 6px;
}
.dashboard-hero p {
  max-width: 650px;
  margin: 8px 0 0;
  color: var(--muted);
}
.dashboard-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.dashboard-hero-actions > span {
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 900;
}
.dashboard-alerts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}
.dashboard-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.dashboard-alert b {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
}
.dashboard-alert.warning b { background: #fff7e8; color: var(--gold); }
.dashboard-alert.danger b { background: #fff0f2; color: var(--danger); }
.dashboard-alert span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .85fr);
  gap: 14px;
}
.today-ops-card,
.finance-overview-card,
.attendance-chart-card,
.latest-timeline-card {
  padding: 18px;
  border: 1px solid rgba(226,230,240,.92);
  border-radius: 18px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-soft);
}
.today-stat-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.today-stat-main div {
  min-height: 116px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff, #f2f1ff);
  border: 1px solid rgba(79,70,229,.18);
}
.today-stat-main span,
.today-stat-grid span,
.finance-focus span,
.finance-split span,
.bar-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.today-stat-main b {
  display: block;
  margin-top: 8px;
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1;
}
.dashboard-progress {
  height: 12px;
  margin: 14px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ebf3;
}
.dashboard-progress span {
  display: block;
  width: var(--attendance-rate);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}
.today-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.today-stat-grid div,
.finance-split div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.today-stat-grid b,
.finance-split b {
  display: block;
  margin-top: 6px;
  font-size: clamp(22px, 2vw, 30px);
}
.finance-overview-card {
  display: grid;
  align-content: start;
}
.finance-focus strong {
  display: block;
  margin-top: 8px;
  color: var(--primary);
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1;
  overflow-wrap: anywhere;
}
.finance-stack {
  display: flex;
  height: 18px;
  margin: 18px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ebf3;
}
.finance-stack .remaining {
  width: var(--remaining-finance-rate);
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}
.finance-stack .spent {
  width: var(--spent-finance-rate);
  background: linear-gradient(90deg, var(--gold), var(--danger));
}
.finance-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.dashboard-lower-grid {
  display: grid;
  grid-template-columns: minmax(300px, .75fr) minmax(0, 1.25fr);
  gap: 14px;
  align-items: start;
}
.attendance-bars {
  display: grid;
  gap: 12px;
}
.bar-item {
  display: grid;
  grid-template-columns: 74px 46px 1fr;
  gap: 10px;
  align-items: center;
}
.bar-item b {
  font-size: 20px;
}
.bar-item i {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ebf3;
}
.bar-item i::before {
  content: "";
  display: block;
  width: var(--bar);
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}
.bar-item.present i::before { background: var(--cyan); }
.bar-item.late i::before { background: var(--gold); }
.bar-item.absent i::before { background: var(--danger); }
.dashboard-timeline {
  position: relative;
  display: grid;
  gap: 10px;
}
.timeline-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 5px var(--primary-soft);
}
.timeline-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.timeline-copy span,
.timeline-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.panel { padding: 18px; margin-bottom: 18px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.activity-list, .table-cards { display: grid; gap: 10px; }
.activity-item, .record-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}
.activity-item.has-thumb,
.record-card.with-photos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.activity-copy,
.record-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.activity-item span, .record-card span { color: var(--muted); font-size: 12px; font-weight: 900; }
.activity-item small, .record-card small, .record-card em { color: var(--muted); font-style: normal; }
.operation-card {
  border-style: solid;
}
.muted-operation {
  opacity: .72;
  background: #f7f8fc;
}
.muted-operation b {
  text-decoration: line-through;
}
.deduction-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.deduction-edit-form input {
  width: 150px;
  max-width: 100%;
}
.deduction-edit-form button {
  min-height: 42px;
}

.employees-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.employee-list {
  padding: 12px;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 122px);
  overflow: auto;
}
.search-box { margin: 0 0 10px; }
.employee-pill {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px 10px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  color: var(--ink);
  transition: background .18s ease, transform .18s ease;
}
.employee-pill:hover { background: var(--surface-2); transform: translateX(-2px); }
.employee-pill.active {
  background: var(--primary-soft);
  outline: 1px solid rgba(79,70,229,.2);
}
.employee-pill.disabled { opacity: .58; }
.employee-pill span, .avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  font-weight: 900;
}
.employee-pill b { align-self: end; }
.employee-pill small { grid-column: 2; color: var(--muted); }

.employee-profile { padding: 18px; min-height: 520px; }
.profile-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
.profile-head > div,
.profile-head > .profile-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.profile-head h1 { overflow-wrap: anywhere; }
.profile-head p { margin: 5px 0 0; color: var(--muted); }
.profile-tools {
  display: grid;
  gap: 10px;
  justify-items: end;
}
.profile-head > .profile-tools {
  display: grid;
  align-items: stretch;
  justify-items: end;
}
.month-switch {
  display: grid;
  grid-template-columns: 160px auto;
  gap: 8px;
}
.period-switch {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}
.period-switch label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.period-switch input {
  min-height: 42px;
}
.period-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.period-actions button,
.period-actions a {
  min-height: 42px;
  white-space: nowrap;
}
.employee-actions-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.employee-actions-bar form {
  display: grid;
  margin: 0;
}
.employee-actions-bar a,
.employee-actions-bar button {
  min-height: 40px;
  padding-inline: 14px;
}
.statement-download {
  position: relative;
  display: grid;
}
.statement-download summary {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
  box-shadow: var(--shadow-soft);
}
.statement-download summary::-webkit-details-marker {
  display: none;
}
.statement-download[open] summary {
  transform: translateY(-1px);
}
.statement-download form {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 12;
  width: min(280px, 82vw);
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: var(--shadow);
}
.statement-download label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.statement-download input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
}
.statement-download form button {
  width: 100%;
}
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
  padding-bottom: 4px;
}
.tabs a {
  flex: 0 0 auto;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}
.tabs a.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.finance-grid { grid-template-columns: repeat(5, minmax(120px, 1fr)); margin-bottom: 14px; }
.finance-grid article { padding: 16px; }
.finance-grid .net {
  background: linear-gradient(135deg, #fff, #f2f1ff);
  border-color: rgba(79,70,229,.25);
}
.detail-grid { grid-template-columns: repeat(6, 1fr); }
.detail-card { padding: 16px; }
.summary-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}
.salary-hero {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "copy chart"
    "legend legend";
  gap: 18px 22px;
  align-items: center;
  padding: clamp(18px, 2.4vw, 28px);
  border: 1px solid rgba(79,70,229,.22);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.96), rgba(246,247,255,.92)),
    radial-gradient(circle at 92% 8%, rgba(79,70,229,.14), transparent 18rem);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.salary-hero-copy { grid-area: copy; min-width: 0; }
.summary-kicker {
  display: inline-grid;
  place-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}
.salary-hero h2 {
  margin-top: 14px;
  color: var(--muted);
  font-size: clamp(17px, 1.6vw, 22px);
}
.salary-hero strong {
  display: block;
  margin-top: 6px;
  color: var(--primary);
  font-size: clamp(38px, 5vw, 68px);
  line-height: 1.02;
}
.salary-hero p {
  max-width: 520px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.salary-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.salary-breakdown div {
  min-width: 118px;
  padding: 10px 12px;
  border: 1px solid rgba(226,230,240,.86);
  border-radius: 12px;
  background: rgba(255,255,255,.74);
}
.salary-breakdown span,
.summary-mini-card span,
.work-stat-card span,
.work-compact-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.salary-breakdown b {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}
.payroll-donut {
  grid-area: chart;
  width: clamp(172px, 18vw, 232px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(
      var(--primary) 0 var(--remaining-end),
      var(--cyan) var(--remaining-end) var(--paid-end),
      var(--gold) var(--paid-end) var(--advance-end),
      var(--danger) var(--advance-end) var(--deduction-end),
      #e8ebf3 var(--deduction-end) 100%
    );
  box-shadow: inset 0 0 0 1px rgba(24,30,57,.04), 0 18px 38px rgba(24,30,57,.12);
}
.donut-core {
  width: 62%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
  text-align: center;
}
.donut-core span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.donut-core b {
  max-width: 90%;
  overflow-wrap: anywhere;
  font-size: clamp(18px, 1.8vw, 24px);
}
.chart-legend {
  grid-area: legend;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.legend-item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}
.legend-item.paid::before { background: var(--cyan); }
.legend-item.advances::before { background: var(--gold); }
.legend-item.deductions::before { background: var(--danger); }
.legend-item.earnings::before { background: #22c3a6; }
.summary-mini-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.summary-mini-card {
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-soft);
}
.summary-mini-card b {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(22px, 2.2vw, 32px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.summary-mini-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}
.summary-mini-card.due { border-color: rgba(79,70,229,.2); }
.summary-mini-card.paid { border-color: rgba(14,165,233,.24); }
.summary-mini-card.advances { border-color: rgba(192,135,47,.26); }
.summary-mini-card.deductions { border-color: rgba(169,53,69,.24); }
.summary-mini-card.earnings { border-color: rgba(34,195,166,.28); }
.summary-mini-card.earnings b { color: #0f8f78; }
.adjustments-section {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}
.adjustments-section + .adjustments-section {
  padding-top: 4px;
}
.adjustment-card {
  position: relative;
  overflow: hidden;
}
.adjustment-card::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 5px;
  background: var(--primary);
}
.adjustment-card.earning {
  border-color: rgba(34,195,166,.28);
}
.adjustment-card.earning::before {
  background: #22c3a6;
}
.adjustment-card.deduction {
  border-color: rgba(184,48,74,.24);
}
.adjustment-card.deduction::before {
  background: var(--danger);
}
.attendance-insights {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(226,230,240,.92);
  border-radius: 18px;
  background: rgba(255,255,255,.86);
  box-shadow: var(--shadow-soft);
}
.attendance-rate-label {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.attendance-layout {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.attendance-ring {
  width: min(118px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, #fff 66%, transparent 67%),
    conic-gradient(var(--primary) 0 var(--attendance-rate), #e8ebf3 var(--attendance-rate) 100%);
  border: 1px solid var(--line);
  text-align: center;
}
.absent-ring {
  background:
    radial-gradient(circle closest-side, #fff 66%, transparent 67%),
    conic-gradient(var(--danger) 0 var(--absence-rate), #e8ebf3 var(--absence-rate) 100%);
}
.attendance-ring span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.attendance-ring b {
  margin-top: 3px;
  font-size: 30px;
  line-height: 1;
}
.work-stat-card {
  min-height: 118px;
  display: grid;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}
.work-stat-card b {
  display: block;
  margin-top: 8px;
  font-size: clamp(24px, 2.4vw, 34px);
  line-height: 1.05;
}
.attendance-progress {
  height: 10px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ebf3;
}
.attendance-progress span {
  display: block;
  width: var(--attendance-rate);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}
.work-summary-section {
  margin-top: 16px;
  padding-top: 4px;
}
.work-summary-section .section-head {
  margin-bottom: 10px;
}
.work-summary-section h2 {
  font-size: clamp(18px, 1.6vw, 24px);
}
.work-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.work-summary-card {
  min-height: 94px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.work-summary-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.work-summary-card b {
  display: block;
  color: var(--ink);
  font-size: clamp(18px, 1.8vw, 25px);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.work-days-card b {
  font-size: clamp(17px, 1.45vw, 22px);
}
.compact-work-summary {
  margin-top: 14px;
}
.work-compact-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.work-compact-item {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.work-compact-item.primary {
  grid-column: span 2;
  background: linear-gradient(135deg, #fff, #f2f1ff);
  border-color: rgba(79,70,229,.22);
}
.work-compact-item b {
  display: block;
  margin-top: 7px;
  font-size: clamp(17px, 1.5vw, 23px);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.work-days-inline {
  grid-column: span 2;
}
.work-days-inline b {
  font-size: clamp(15px, 1.25vw, 19px);
}
.previous-due,
.payments-panel {
  margin-top: 14px;
}
.previous-due {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 14px;
}
.previous-due summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 900;
}
.previous-due .table-cards {
  margin-top: 12px;
}
.inline-form {
  display: grid;
  grid-template-columns: 160px 150px minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.actions-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.empty, .empty-state { color: var(--muted); }
.empty-state { display: grid; place-items: center; min-height: 360px; text-align: center; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background:
    radial-gradient(circle at 75% 8%, rgba(79,70,229,.16), transparent 32rem),
    rgba(16,20,38,.46);
  backdrop-filter: blur(5px);
}
.drawer {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  max-height: min(88vh, 920px);
  z-index: 40;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.94)),
    var(--surface);
  border: 1px solid rgba(226,230,240,.94);
  border-radius: 24px;
  box-shadow: var(--shadow);
  animation: modal-in .2s ease both;
}
.form-modal-card.large,
.drawer:not(.compact-drawer) {
  width: min(980px, calc(100vw - 80px));
}
.form-modal-card.compact,
.compact-drawer {
  width: min(560px, calc(100vw - 48px));
  max-height: min(78vh, 620px);
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-head > div {
  min-width: 0;
}
.drawer-head h2 {
  font-size: clamp(24px, 2.2vw, 34px);
  overflow-wrap: anywhere;
}
.drawer-head p {
  max-width: 620px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.modal-kicker {
  display: inline-flex;
  margin-bottom: 7px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
}
.drawer-head a {
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary);
  font-weight: 900;
  flex: 0 0 auto;
}
.compact-form {
  overflow: auto;
  padding: 18px 24px 24px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
}
.form-modal-card.compact .compact-form,
.compact-drawer .compact-form {
  grid-template-columns: 1fr;
}
.compact-form .days,
.compact-form button,
.form-section,
.form-actions { grid-column: 1 / -1; }
.form-section {
  padding: 16px;
  border: 1px solid rgba(226,230,240,.9);
  border-radius: 18px;
  background: rgba(248,249,253,.74);
}
.form-section h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 17px;
}
.form-section-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
}
.form-actions {
  position: sticky;
  bottom: -24px;
  z-index: 2;
  display: grid;
  padding: 14px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 28%);
}
.form-actions button {
  min-height: 54px;
  font-size: 18px;
}
fieldset {
  border: 1px dashed #c7ccdc;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface-2);
}
legend { padding: 0 8px; color: var(--muted); font-weight: 900; }
.inline, fieldset label { display: flex; align-items: center; gap: 7px; }
.inline input, fieldset input { width: auto; min-height: auto; accent-color: var(--primary); }

@media (max-width: 1240px) and (min-width: 901px) {
  .form-modal-card.large,
  .drawer:not(.compact-drawer) { width: min(860px, calc(100vw - 48px)); }
  .compact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.settings-hub {
  max-width: 1080px;
  margin-inline: auto;
}
.settings-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.settings-entry-card {
  min-height: 280px;
  align-content: end;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.settings-entry-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.settings-entry-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.8;
}
.settings-entry-icon {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--ink), var(--primary));
  box-shadow: 0 18px 42px rgba(79,70,229,.18);
  font-size: 28px;
  font-weight: 900;
}
.disabled-link {
  opacity: .58;
  pointer-events: none;
}
.settings-hub-form {
  display: grid;
  grid-template-columns: minmax(260px, .9fr) minmax(320px, 1.15fr);
  gap: 18px;
  align-items: stretch;
}
.settings-card {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 24px;
  border: 1px solid rgba(221,226,239,.92);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.96), rgba(248,250,255,.9)),
    radial-gradient(circle at 12% 0%, rgba(20,184,166,.11), transparent 16rem);
  box-shadow: 0 24px 70px rgba(18,24,40,.08);
}
.settings-card-system {
  grid-column: 1 / -1;
  grid-template-columns: minmax(230px, .42fr) minmax(280px, 1fr);
  align-items: end;
}
.settings-site-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.settings-site-form .settings-card {
  grid-column: auto;
}
.settings-card-identity,
.settings-card-logo {
  min-height: 330px;
  align-content: center;
}
.settings-card-system .settings-card-head {
  grid-column: 1 / -1;
}
.settings-card-head {
  display: grid;
  gap: 6px;
}
.settings-card-head span {
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}
.settings-card-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
}
.settings-owner {
  min-height: 122px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.settings-owner span,
.brand-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, var(--ink), var(--primary));
  font-weight: 900;
  box-shadow: 0 18px 42px rgba(79,70,229,.2);
}
.settings-owner span {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  font-size: 24px;
}
.settings-owner b {
  min-width: 0;
  color: var(--ink);
  font-size: 24px;
  overflow-wrap: anywhere;
}
.brand-upload {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.brand-preview {
  width: 96px;
  height: 96px;
  border-radius: 26px;
  font-size: 36px;
  flex: 0 0 auto;
}
.brand-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-file {
  flex: 1;
}
.brand-file input {
  margin-top: 10px;
  width: 100%;
}
.brand-file input::file-selector-button {
  margin-inline-end: 10px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
  cursor: pointer;
}
.settings-save {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}
.settings-save button {
  width: min(100%, 320px);
}
.management-users-grid .employee-card-main {
  min-height: 260px;
}
.muted-menu-item {
  display: block;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.readonly-mode .content form:not(.employee-search-form):not(.logout),
.readonly-mode .content .card-actions,
.readonly-mode .content .quick-add,
.readonly-mode .content .floating-add,
.readonly-mode .content .form-actions,
.readonly-mode .content .primary-link,
.readonly-mode .content .buttonlike {
  display: none !important;
}

.clock-card {
  width: min(100%, 520px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.86)),
    radial-gradient(circle at top left, rgba(79,70,229,.18), transparent 20rem);
}
.clock-status {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 18px 0;
}
.clock-status div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}
.clock-status span { display: block; color: var(--muted); font-size: 12px; font-weight: 900; margin-bottom: 8px; }
.clock-status b { direction: ltr; display: block; text-align: center; }
.clock-status small {
  display: block;
  margin-top: 6px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}
.clock-deadlines {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 16px;
}
.clock-deadlines span {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.clock-form { display: grid; grid-template-columns: 1fr; gap: 12px; }
.clock-form button {
  width: 100%;
  min-height: 92px;
  border-radius: 16px;
  font-size: 19px;
  box-shadow: 0 14px 30px rgba(27,33,62,.16);
}
.clock-form button small {
  display: block;
  margin-top: 7px;
  font-size: 11px;
  color: rgba(255,255,255,.76);
}
.clock-form button:disabled {
  cursor: not-allowed;
  opacity: .72;
  filter: grayscale(.18);
  transform: none;
  box-shadow: none;
}
.clock-in { background: linear-gradient(135deg, var(--primary), var(--cyan)); }
.clock-out { background: linear-gradient(135deg, var(--nav), #28304f); }
.clock-done { background: linear-gradient(135deg, #7d8291, #a4a9b6); }
.camera-panel {
  position: fixed;
  inset: auto 18px 18px auto;
  z-index: 75;
  width: min(420px, calc(100vw - 36px));
  padding: 14px;
  border: 1px solid rgba(226,230,240,.96);
  border-radius: 20px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
.camera-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.camera-head button {
  min-height: 36px;
  padding: 7px 10px;
  background: var(--surface-2);
  color: var(--muted);
}
.camera-view {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: 18px;
  background: #111827;
}
.camera-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.face-guide {
  position: absolute;
  inset: 18% 24%;
  border: 3px solid rgba(255,255,255,.86);
  border-radius: 48% 48% 44% 44%;
  box-shadow: 0 0 0 999px rgba(16,20,38,.26);
}
.capture-button {
  width: 100%;
  margin-top: 12px;
  min-height: 52px;
}
.camera-panel p {
  margin: 10px 0 0;
  color: var(--danger);
  font-weight: 900;
}
.camera-panel p[data-tone="info"] {
  color: var(--muted);
}
.camera-panel p[data-tone="success"] {
  color: var(--success);
}
.camera-panel p[data-tone="warning"] {
  color: #b45309;
}
.camera-panel p:empty {
  display: none;
}
.clock-permission-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17,24,39,.46);
  backdrop-filter: blur(8px);
}
.clock-permission-layer[hidden] {
  display: none;
}
.clock-permission-box {
  width: min(440px, 100%);
  padding: 20px;
  border: 1px solid rgba(226,230,240,.96);
  border-radius: 20px;
  background: rgba(255,255,255,.98);
  box-shadow: var(--shadow);
}
.clock-permission-box h2 {
  margin: 0 0 10px;
  color: var(--nav);
  font-size: 21px;
  line-height: 1.45;
}
.clock-permission-box p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.8;
}
.clock-permission-box[data-state="denied"] p {
  color: var(--danger);
}
.clock-permission-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 16px;
}
.clock-permission-actions button {
  min-height: 48px;
}
.clock-permission-actions .muted-button {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
}
.attendance-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex: 0 0 auto;
}
.attendance-thumb {
  width: 72px;
  height: 72px;
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(79,70,229,.18);
  background: var(--surface-2);
  box-shadow: 0 10px 22px rgba(24, 30, 57, .08);
}
.attendance-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.attendance-thumb span {
  position: absolute;
  inset: auto 6px 6px 6px;
  display: grid;
  place-items: center;
  min-height: 20px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: var(--primary);
  font-size: 10px;
  font-weight: 900;
}
.attendance-location-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.extension-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.extension-badges span {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}
.extension-card {
  border-color: rgba(79,70,229,.24);
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(236,235,255,.72));
}
.extension-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.extension-actions form { margin: 0; }
.extension-actions button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}
.attendance-location-list a,
.muted-location {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.attendance-location-list a:hover {
  color: var(--primary);
}
.latest-thumb {
  width: 76px;
  height: 76px;
}
.photo-layer {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(16,20,38,.78);
}
.photo-layer.open { display: grid; }
.photo-layer img {
  max-width: min(92vw, 720px);
  max-height: 82vh;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.photo-layer button {
  position: fixed;
  top: 18px;
  left: 18px;
  background: #fff;
  color: var(--ink);
}
.logout.top { margin: 0 0 10px; text-align: left; }
.logout.top button { width: auto; background: var(--surface-2); color: var(--muted); box-shadow: none; }
.danger-text { color: var(--danger); direction: ltr; text-align: left; }

.toast {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 14px;
  color: #fff;
  background: var(--nav);
  box-shadow: var(--shadow);
  transition: opacity .2s ease, transform .2s ease;
}
.toast.danger { background: var(--danger); }
.toast.warning { background: var(--gold); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slide-in {
  from { transform: translateX(105%); }
  to { transform: translateX(0); }
}
@keyframes modal-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(.985); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes sheet-in {
  from { opacity: 0; transform: translate(-50%, 24px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid,
  .dashboard-lower-grid {
    grid-template-columns: 1fr;
  }
  .finance-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid, .work-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-dashboard {
    grid-template-columns: 1fr;
  }
  .summary-mini-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .work-compact-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .work-compact-item.primary,
  .work-days-inline {
    grid-column: span 1;
  }
  .settings-hub-form,
  .settings-card-system {
    grid-template-columns: 1fr;
  }
  .settings-card-system {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block !important;
  }
  .sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(84vw, 310px);
    max-width: min(84vw, 310px);
    height: 100dvh;
    z-index: 40;
    transform: translateX(105%);
    transition: transform .22s ease;
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(16,20,38,.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: inline-grid; place-items: center; }
  .content { padding: 14px 14px 28px; }
  .topbar { position: sticky; top: 10px; z-index: 30; }
  .top-actions { display: none; }
  .settings-hub {
    max-width: none;
  }
  .settings-hub-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .settings-entry-grid,
  .settings-site-form {
    grid-template-columns: 1fr;
  }
  .settings-card {
    padding: 18px;
    border-radius: 18px;
  }
  .settings-card-head h2 {
    font-size: 25px;
  }
  .brand-upload {
    align-items: stretch;
  }
  .dashboard-hero {
    display: grid;
    align-items: start;
  }
  .dashboard-hero-actions {
    justify-content: stretch;
  }
  .dashboard-hero-actions > span,
  .dashboard-hero-actions a {
    flex: 1 1 150px;
  }
  .hero-panel, .profile-head { display: grid; align-items: start; }
  .profile-head h1 {
    font-size: clamp(26px, 8vw, 36px);
  }
  .profile-tools {
    width: 100%;
    justify-items: stretch;
  }
  .employee-actions-bar {
    justify-content: stretch;
  }
  .employee-actions-bar a,
  .employee-actions-bar form,
  .employee-actions-bar button {
    flex: 1 1 120px;
  }
  .employees-workspace { grid-template-columns: 1fr; }
  .employee-list {
    position: relative;
    top: auto;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }
  .search-box { grid-column: 1 / -1; }
  .month-switch, .period-switch, .inline-form, .compact-form { grid-template-columns: 1fr; }
  .period-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .salary-hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "copy"
      "chart"
      "legend";
    justify-items: center;
    text-align: center;
  }
  .salary-hero p {
    margin-inline: auto;
  }
  .salary-breakdown,
  .chart-legend {
    justify-content: center;
  }
  .summary-mini-grid,
  .attendance-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .work-compact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .drawer {
    inset: auto auto 0 50%;
    transform: translateX(-50%);
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: 92vh;
    border-radius: 24px 24px 0 0;
    animation: sheet-in .22s ease both;
  }
  .form-modal-card.large,
  .form-modal-card.compact,
  .compact-drawer,
  .drawer:not(.compact-drawer) {
    width: calc(100vw - 20px);
  }
  .drawer-head {
    display: grid;
    grid-template-columns: 1fr;
    padding: 18px 18px 14px;
    gap: 12px;
  }
  .drawer-head a {
    justify-self: start;
  }
  .drawer-head h2 {
    font-size: 26px;
  }
  .drawer-head p {
    font-size: 12px;
  }
  .compact-form {
    padding: 14px 18px 20px;
    grid-template-columns: 1fr;
  }
  .form-section {
    padding: 14px;
    border-radius: 16px;
  }
  .form-section-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .plain { padding: 14px; }
  .site-credit {
    margin-top: 20px;
    font-size: 11px;
    line-height: 1.7;
  }
  .auth-card, .clock-card { padding: 22px; border-radius: 18px; }
  .metric-grid, .finance-grid, .detail-grid, .work-summary-grid, .clock-status, .clock-form { grid-template-columns: 1fr; }
  .brand-upload,
  .settings-owner {
    flex-direction: column;
    align-items: stretch;
  }
  .brand-preview {
    width: 82px;
    height: 82px;
    border-radius: 22px;
  }
  .settings-save button {
    width: 100%;
  }
  .dashboard-redesign {
    gap: 12px;
  }
  .dashboard-hero,
  .today-ops-card,
  .finance-overview-card,
  .attendance-chart-card,
  .latest-timeline-card {
    padding: 14px;
    border-radius: 16px;
  }
  .dashboard-hero h1 {
    font-size: clamp(28px, 9vw, 38px);
  }
  .dashboard-hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-hero-actions > span {
    grid-column: 1 / -1;
  }
  .today-stat-main,
  .today-stat-grid,
  .finance-split {
    grid-template-columns: 1fr;
  }
  .today-stat-main div {
    min-height: 96px;
  }
  .bar-item {
    grid-template-columns: 64px 38px 1fr;
    gap: 8px;
  }
  .timeline-item {
    grid-template-columns: 14px minmax(0, 1fr);
  }
  .timeline-item .attendance-thumb {
    grid-column: 2;
    width: 58px;
    height: 58px;
  }
  .camera-panel {
    inset: auto 10px 10px 10px;
    width: auto;
    border-radius: 18px;
  }
  .employee-profile, .panel { padding: 14px; }
  .salary-hero {
    padding: 16px;
    gap: 14px;
    text-align: right;
    justify-items: stretch;
  }
  .salary-hero strong {
    font-size: clamp(32px, 10vw, 44px);
  }
  .salary-breakdown,
  .chart-legend {
    justify-content: flex-start;
  }
  .salary-breakdown div {
    flex: 1 1 120px;
    min-width: 0;
  }
  .payroll-donut {
    justify-self: center;
    width: min(180px, 68vw);
  }
  .summary-mini-grid,
  .work-compact-grid {
    grid-template-columns: 1fr;
  }
  .summary-mini-grid,
  .attendance-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .summary-mini-card,
  .work-stat-card,
  .attendance-ring {
    min-height: 92px;
  }
  .attendance-ring {
    width: min(118px, 46vw);
  }
  .attendance-ring {
    background:
      radial-gradient(circle closest-side, #fff 62%, transparent 63%),
      conic-gradient(var(--primary) 0 var(--attendance-rate), #e8ebf3 var(--attendance-rate) 100%);
  }
  .absent-ring {
    background:
      radial-gradient(circle closest-side, #fff 62%, transparent 63%),
      conic-gradient(var(--danger) 0 var(--absence-rate), #e8ebf3 var(--absence-rate) 100%);
  }
  .work-compact-item {
    min-height: 72px;
  }
  .work-days-inline b {
    font-size: 16px;
  }
  .employee-actions-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .employee-actions-bar a,
  .employee-actions-bar details,
  .employee-actions-bar form,
  .employee-actions-bar button {
    width: 100%;
  }
  .statement-download form {
    right: auto;
    left: 0;
  }
  .employee-actions-bar form:last-child {
    grid-column: 1 / -1;
  }
  .tabs { margin-inline: -4px; padding-inline: 4px; }
  .drawer { width: calc(100vw - 20px); }
  .record-card { word-break: break-word; }
  .activity-item.has-thumb,
  .record-card.with-photos {
    gap: 10px;
  }
  .attendance-thumb,
  .latest-thumb {
    width: 56px;
    height: 56px;
    border-radius: 12px;
  }
  .attendance-thumb span {
    min-height: 18px;
    font-size: 9px;
    inset: auto 4px 4px 4px;
  }
}

@media (max-width: 360px) {
  .summary-mini-grid,
  .attendance-layout {
    grid-template-columns: 1fr;
  }
}

.employee-page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}
.employee-page-head h1 { font-size: clamp(30px, 3.4vw, 48px); }
.employee-search-form {
  width: min(100%, 340px);
  margin: 0;
}
.employee-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 360px));
  justify-content: start;
  gap: 14px;
  padding-bottom: 92px;
}
.employee-card {
  min-height: 178px;
  position: relative;
  padding: 0;
  border: 1px solid rgba(226,230,240,.96);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.86)),
    radial-gradient(circle at 0 0, rgba(79,70,229,.12), transparent 13rem);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.employee-card-main {
  min-height: 178px;
  display: grid;
  grid-template-columns: 56px 1fr;
  align-content: start;
  gap: 10px 12px;
  padding: 18px 18px 18px 74px;
  color: var(--ink);
}
.employee-card:hover {
  transform: translateY(-3px);
  border-color: rgba(79,70,229,.28);
  box-shadow: var(--shadow);
}
.employee-card.disabled { opacity: .72; }
.employee-card-avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}
.employee-card b {
  align-self: end;
  font-size: 20px;
}
.employee-card small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 800;
}
.employee-card-meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.employee-card-meta span,
.status-chip {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.card-actions {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 4;
}
.card-menu-button {
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  color: var(--muted);
  box-shadow: none;
  font-size: 22px;
  line-height: 1;
}
.card-menu-button:hover {
  background: #fff;
  color: var(--primary);
}
.card-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 148px;
  display: none;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}
.card-actions.open .card-menu {
  display: grid;
  gap: 4px;
}
.card-menu a,
.card-menu button {
  width: 100%;
  min-height: 36px;
  justify-content: flex-start;
  display: flex;
  padding: 8px 10px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-size: 13px;
  font-weight: 900;
}
.card-menu a:hover,
.card-menu button:hover {
  background: var(--surface-2);
  transform: none;
}
.card-menu .danger-menu-item {
  color: var(--danger);
}
.status-chip {
  justify-self: end;
  align-self: start;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface-2);
}
.status-chip.active,
.status-text.active { color: var(--primary); }
.status-chip.inactive,
.status-text.inactive { color: var(--danger); }
.floating-add {
  position: fixed;
  left: 26px;
  bottom: 26px;
  z-index: 30;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  box-shadow: 0 18px 36px rgba(79,70,229,.32);
}
.employee-quick-add {
  position: fixed;
  left: 26px;
  bottom: 26px;
  z-index: 31;
}
.employee-quick-add summary {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  box-shadow: 0 18px 36px rgba(79,70,229,.32);
}
.employee-quick-add summary::-webkit-details-marker { display: none; }
.employee-quick-add.quick-add-direct {
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--cyan));
  color: #fff;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  box-shadow: 0 18px 36px rgba(79,70,229,.32);
}
.employee-quick-add.quick-add-direct:hover {
  color: #fff;
  transform: translateY(-2px);
}
.employee-quick-add div {
  position: absolute;
  left: 0;
  bottom: 72px;
  display: grid;
  gap: 8px;
  min-width: 190px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}
.employee-quick-add a {
  min-height: 44px;
  display: grid;
  align-items: center;
  padding: 11px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}
.employee-quick-add a:hover {
  background: var(--primary-soft);
  color: var(--primary);
}
.compact-drawer {
  width: min(560px, calc(100vw - 48px));
}
@media (max-width: 900px) {
  .compact-drawer {
    width: calc(100vw - 20px);
  }
}
.employee-file {
  max-width: 100%;
  min-width: 0;
  padding: clamp(16px, 2.5vw, 24px);
  border: 1px solid rgba(226,230,240,.92);
  border-radius: 20px;
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.employee-file .profile-head {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.back-link {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.warning-button {
  background: #fff7e8;
  color: var(--gold);
}
.buttonlike {
  border: 0;
}
.confirm-layer {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16,20,38,.54);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.confirm-layer.open {
  opacity: 1;
  pointer-events: auto;
}
.confirm-box {
  width: min(100%, 390px);
  padding: 22px;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 20px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
  transform: translateY(10px) scale(.98);
  transition: transform .18s ease;
}
.confirm-layer.open .confirm-box {
  transform: translateY(0) scale(1);
}
.confirm-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 900;
}
.confirm-box[data-tone="danger"] .confirm-icon {
  background: #fff0f2;
  color: var(--danger);
}
.confirm-box[data-tone="warning"] .confirm-icon {
  background: #fff7e8;
  color: var(--gold);
}
.confirm-box h2 {
  font-size: 24px;
  margin-bottom: 8px;
}
.confirm-box p {
  margin: 0;
  color: var(--muted);
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.confirm-cancel {
  background: var(--surface-2);
  color: var(--muted);
}
.confirm-submit.danger {
  background: var(--danger);
}
.confirm-submit.warning {
  background: var(--gold);
}

@media (max-width: 900px) {
  .employee-page-head {
    align-items: stretch;
    display: grid;
  }
  .employee-search-form {
    width: 100%;
  }
  .employee-card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .floating-add {
    left: 18px;
    bottom: 18px;
    width: 56px;
    height: 56px;
  }
  .employee-quick-add {
    left: 18px;
    bottom: 18px;
  }
  .employee-quick-add summary {
    width: 56px;
    height: 56px;
  }
  .employee-quick-add.quick-add-direct {
    width: 56px;
    height: 56px;
  }
  .employee-quick-add div {
    bottom: 66px;
  }
  .employee-file .profile-head {
    display: grid;
  }
}
