:root {
  color-scheme: light;
  --bg: #f3efe8;
  --bg-strong: #e9dfd1;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: #ffffff;
  --ink: #1f2421;
  --muted: #667066;
  --line: rgba(85, 94, 88, 0.18);
  --accent: #17594a;
  --accent-soft: #d9eee7;
  --accent-2: #b66a2c;
  --danger: #b53d34;
  --warn: #9c6b1d;
  --ok: #1f7a4b;
  --shadow: 0 20px 50px rgba(34, 41, 37, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(182, 106, 44, 0.12), transparent 26%),
    radial-gradient(circle at bottom right, rgba(23, 89, 74, 0.14), transparent 30%),
    linear-gradient(180deg, #f8f4ed 0%, #f1ece4 100%);
}

body.workflow-embed {
  background: #f5f1ea;
}

body.nav-open {
  overflow: hidden;
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  filter: brightness(0.97);
  transform: translateY(-1px);
}

button.secondary {
  background: #edf3ef;
  color: var(--ink);
}

a.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 16px;
  border-radius: 12px;
  background: #edf3ef;
  color: var(--ink);
  text-decoration: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(23, 89, 74, 0.28);
  outline-offset: 2px;
}

input, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.hidden { display: none !important; }

.mobile-nav-backdrop {
  display: none;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr minmax(320px, 420px);
  gap: 28px;
  align-items: center;
  padding: 40px;
}

body.workflow-embed .login-shell {
  grid-template-columns: minmax(320px, 520px);
  justify-content: center;
  padding: 28px;
}

body.workflow-embed .login-art {
  display: none;
}

.login-art,
.login-panel,
.panel,
.metric,
.sidebar-note {
  backdrop-filter: blur(10px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.login-art {
  border-radius: 28px;
  padding: 44px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(160deg, rgba(23, 89, 74, 0.9), rgba(15, 41, 37, 0.9)),
    var(--panel);
  color: #fff;
}

.login-art .eyebrow,
.login-art .support-copy {
  color: rgba(255, 255, 255, 0.82);
}

.login-art h1 {
  margin: 10px 0 12px;
  max-width: 620px;
  font-size: clamp(34px, 4vw, 60px);
  line-height: 1.02;
}

.support-copy {
  max-width: 480px;
  font-size: 16px;
}

.login-panel {
  border-radius: 24px;
  padding: 28px;
  display: grid;
  gap: 16px;
}

.login-head h2 {
  margin: 6px 0 4px;
  font-size: 30px;
}

.form-error {
  min-height: 20px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

body.workflow-embed .app-shell {
  min-height: auto;
  grid-template-columns: minmax(0, 1fr);
}

body.workflow-embed .sidebar {
  display: none;
}

body.workflow-embed .sidebar {
  padding: 18px;
}

body.workflow-embed .content {
  padding: 18px 18px 28px;
}

.sidebar {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: rgba(20, 32, 30, 0.96);
  color: #edf7f1;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.mobile-nav-toggle,
.mobile-nav-close {
  display: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f0c47d, #d98b4c);
  color: #1f2421;
  font-weight: 800;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: rgba(237, 247, 241, 0.72);
}

.nav-grid {
  display: grid;
  gap: 8px;
}

.nav,
.ghost {
  text-align: left;
  background: transparent;
  color: #edf7f1;
  border: 1px solid transparent;
}

.nav.active,
.nav:hover,
.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-note {
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #edf7f1;
  box-shadow: none;
}

.sidebar-note p {
  margin: 6px 0 0;
  color: rgba(237, 247, 241, 0.74);
  font-size: 13px;
}

.ghost {
  margin-top: auto;
}

.content {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

body.workflow-embed .topbar {
  position: static;
  align-items: center;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(85, 94, 88, 0.12);
  box-shadow: 0 14px 32px rgba(34, 41, 37, 0.08);
  backdrop-filter: blur(14px);
}

body.workflow-embed .topbar > div:first-child {
  display: flex;
  align-items: center;
  min-width: 0;
}

body.workflow-embed #mobileNavToggle,
body.workflow-embed #todayLabel {
  display: none;
}

.topbar h2 {
  margin: 6px 0 0;
  font-size: 34px;
  line-height: 1;
}

body.workflow-embed .topbar h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
}

.topbar-actions,
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

body.workflow-embed .topbar-actions {
  justify-content: flex-end;
  gap: 8px;
}

body.workflow-embed .topbar-actions button {
  padding: 10px 14px;
}

.status-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

body.workflow-embed .status-chip {
  background: rgba(23, 89, 74, 0.06);
  border-color: rgba(23, 89, 74, 0.1);
}

.view { display: none; }
.view.active { display: block; }

#dashboard.view.active {
  display: grid;
  gap: 24px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

#dashboard .metric-grid {
  gap: 18px;
  margin-bottom: 0;
}

.metric {
  border-radius: 22px;
  padding: 18px;
}

#dashboard .metric {
  padding: 22px 20px;
  border-radius: 24px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
}

#dashboard .metric strong {
  margin-top: 14px;
}

.metric.accent {
  background: linear-gradient(135deg, rgba(23, 89, 74, 0.96), rgba(20, 45, 41, 0.96));
  color: #fff;
}

.metric.accent span {
  color: rgba(255, 255, 255, 0.75);
}

.split-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.9fr);
  gap: 16px;
}

#dashboard .split-panels {
  gap: 22px;
}

.stack-panels {
  display: grid;
  gap: 16px;
}

#dashboard .stack-panels {
  gap: 18px;
}

.panel {
  border-radius: 24px;
  padding: 20px;
}

#dashboard .panel {
  padding: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

#dashboard .panel-head {
  margin-bottom: 18px;
}

.panel h3 {
  margin: 0;
  font-size: 20px;
}

.panel-head p {
  margin: 6px 0 0;
}

.today-attendance-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 244, 237, 0.95));
  border: 1px solid rgba(85, 94, 88, 0.14);
}

.today-attendance-head {
  align-items: flex-end;
  margin-bottom: 18px;
}

#dashboard .today-attendance-head {
  margin-bottom: 24px;
}

.today-attendance-title {
  display: grid;
  gap: 6px;
}

#dashboard .today-attendance-title {
  gap: 8px;
}

.today-attendance-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

#dashboard .today-attendance-actions {
  gap: 12px;
}

.today-attendance-actions input {
  min-width: 160px;
}

.today-attendance-shell {
  display: grid;
  gap: 14px;
}

#dashboard .today-attendance-shell {
  gap: 18px;
}

.today-attendance-summary {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

#dashboard .today-attendance-summary {
  gap: 14px;
}

.today-attendance-summary-item {
  min-width: 0;
  flex: 0 0 auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(85, 94, 88, 0.12);
}

#dashboard .today-attendance-summary-item {
  padding: 15px 16px;
  border-radius: 18px;
}

.today-attendance-summary-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.today-attendance-summary-item strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  color: var(--ink);
}

.today-table-wrap {
  border-radius: 20px;
  border-color: rgba(85, 94, 88, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.today-table-wrap.compact {
  max-height: 430px;
}

table#todayTable {
  min-width: 0;
}

table#todayTable thead th {
  background: linear-gradient(180deg, #faf7f2, #f4eee4);
  color: #566156;
  letter-spacing: 0.08em;
}

table#todayTable tbody tr:hover {
  background: rgba(245, 241, 233, 0.72);
}

table#todayTable td {
  padding-top: 14px;
  padding-bottom: 14px;
}

.attendance-person-cell,
.attendance-inline-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.attendance-person-cell strong,
.attendance-inline-meta strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.attendance-person-cell span,
.attendance-inline-meta span {
  color: var(--muted);
  font-size: 12px;
}

.attendance-inline-meta.is-late strong {
  color: var(--warn);
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 24px;
}

#dashboard .summary-card strong {
  margin-top: 12px;
}

#dashboard .summary-card p,
#dashboard .panel-head p,
#dashboard .today-attendance-title p {
  line-height: 1.6;
}

.mobile-summary-panel {
  display: none;
}

.mobile-inner-panel {
  margin-top: 12px;
}

.mobile-section-toggle {
  display: none;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
}

.table-wrap.compact {
  max-height: 360px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(92, 102, 96, 0.12);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8f5f0;
  color: #586158;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(245, 240, 232, 0.9);
}

.mini-row strong {
  font-size: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.present { background: #e1f4e7; color: var(--ok); }
.badge.absent { background: #f8e1de; color: var(--danger); }
.badge.half { background: #f6ebd2; color: var(--warn); }
.badge.missing { background: #dde8f5; color: #315f97; }
.badge.missingout { background: #dde8f5; color: #315f97; }
.badge.shorthours { background: #f3e2d5; color: #93552c; }
.badge.leave { background: #ece4fb; color: #6b49a8; }
.badge.holiday { background: #fce8d8; color: #a05c16; }
.badge.weeklyoff { background: #eceff1; color: #5a6772; }
.badge.manual { background: #dbeaf7; color: #295b84; }
.badge.locked { background: #e8edf3; color: #415161; }

.salary-editor {
  display: flex;
  gap: 8px;
  align-items: center;
}

.salary-editor input {
  min-width: 120px;
}

.employees-layout {
  grid-template-columns: minmax(300px, 0.78fr) minmax(0, 1.22fr);
}

.employee-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-grid,
.sync-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.fallback-form {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.fallback-form + .fallback-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-actions button,
.inline-actions a.secondary {
  min-width: 92px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(12, 18, 17, 0.4);
}

.side-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  width: min(560px, 100vw);
  padding: 24px;
  overflow: auto;
  background: #f8f4ee;
  box-shadow: -24px 0 48px rgba(12, 18, 17, 0.2);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.drawer-form {
  display: grid;
  gap: 16px;
}

.drawer-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drawer-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(170, 152, 128, 0.18);
}

.read-only-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.drawer-form input[readonly] {
  color: #5c5a56;
  background: #efe8de;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

.full-span {
  grid-column: 1 / -1;
}

.drawer-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  font: inherit;
  resize: vertical;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.drawer-actions button {
  min-width: 160px;
}

.document-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.attendance-status-stack {
  display: grid;
  gap: 8px;
}

.attendance-row-note {
  display: grid;
  gap: 6px;
}

.mobile-row-toggle-head,
.mobile-row-toggle-cell {
  display: none;
}

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

  .split-panels {
    grid-template-columns: 1fr;
  }

  .settings-grid,
  .sync-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 3;
    width: min(82vw, 320px);
    transform: translateX(-100%);
    transition: transform 180ms ease;
    overflow: auto;
    box-shadow: 0 28px 60px rgba(10, 17, 15, 0.34);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: block;
    border: 0;
    padding: 0;
    background: rgba(17, 24, 22, 0.42);
    cursor: pointer;
  }

  .mobile-nav-toggle,
  .mobile-nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
  }

  .mobile-nav-close {
    margin-left: auto;
  }

  .nav-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-head,
  .topbar-actions,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .metric-grid,
  .settings-grid,
  .sync-grid,
  .employee-form-grid {
    grid-template-columns: 1fr;
  }

  #dashboard.view.active {
    gap: 18px;
  }

  #dashboard .metric-grid {
    gap: 14px;
  }

  .content {
    padding: 16px;
  }

  .desktop-summary-card {
    display: none;
  }

  .mobile-summary-panel {
    display: block;
    margin-bottom: 14px;
    padding: 14px;
  }

  .mobile-summary-panel .mobile-section-toggle {
    display: block;
    width: 100%;
  }

  .topbar h2 {
    font-size: 30px;
  }

  .panel,
  .metric,
  .login-panel,
  .login-art {
    border-radius: 20px;
  }

  .topbar-actions > *,
  .toolbar > *,
  .panel-head .toolbar,
  .panel-head input,
  .panel-head .toolbar input,
  .panel-head .toolbar button,
  .salary-editor input,
  .salary-editor button,
  .inline-actions button,
  .inline-actions a.secondary,
  .drawer-actions button,
  .drawer-actions a.secondary {
    width: 100%;
  }

  .panel-head .toolbar {
    gap: 10px;
  }

  .today-attendance-head,
  .today-attendance-actions,
  .today-attendance-summary {
    align-items: stretch;
    flex-direction: column;
  }

  #dashboard .split-panels,
  #dashboard .stack-panels {
    gap: 16px;
  }

  #dashboard .panel,
  #dashboard .metric {
    padding: 20px 18px;
  }

  #dashboard .today-attendance-head {
    margin-bottom: 18px;
  }

  #dashboard .today-attendance-shell {
    gap: 16px;
  }

  .today-attendance-actions input,
  .today-attendance-actions button {
    width: 100%;
  }

  .status-chip {
    white-space: normal;
  }

  .topbar {
    gap: 12px;
  }

  .topbar > div:first-child {
    display: grid;
    gap: 6px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar-actions .status-chip {
    order: 1;
  }

  .topbar-actions #deviceFetchBtn {
    order: 2;
  }

  .topbar-actions #ontimeSyncBtn {
    order: 3;
  }

  .dashboard-secondary-panel,
  .mobile-secondary-panel {
    padding-top: 16px;
  }

  .employee-list-panel {
    order: 1;
  }

  .employee-form-panel {
    order: 2;
  }

  .employee-form-panel .panel-head {
    margin-bottom: 10px;
  }

  .employee-form-panel .panel-head p {
    margin-top: 4px;
  }

  .mobile-section-toggle {
    display: block;
    width: 100%;
    min-height: 46px;
    border-radius: 14px;
  }

  .mobile-collapsible.collapsed {
    display: none;
  }

  .mobile-secondary-panel > .panel-head {
    margin-bottom: 10px;
  }

  .mobile-secondary-panel > .mobile-collapsible,
  .employee-form-panel > .mobile-collapsible {
    margin-top: 12px;
  }

  .salary-editor {
    flex-direction: column;
    align-items: stretch;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  table,
  .table-wrap.compact {
    min-width: 0;
    max-height: none;
  }

  table thead {
    display: none;
  }

  table tbody {
    display: grid;
    gap: 12px;
  }

  table tr {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: 18px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(34, 41, 37, 0.05);
  }

  table td {
    display: grid;
    grid-template-columns: minmax(92px, 120px) minmax(0, 1fr);
    gap: 10px;
    padding: 0;
    border-bottom: 0;
    word-break: break-word;
  }

  .mobile-row-toggle-cell {
    display: block;
  }

  .mobile-row-toggle-cell::before {
    display: none;
  }

  .mobile-row-toggle-cell button {
    width: 100%;
  }

  table tr[data-collapsible="true"]:not(.expanded) td.mobile-detail {
    display: none;
  }

  table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
  }

  table td[data-label="Action"],
  table td[data-label="Salary"] {
    grid-template-columns: 1fr;
  }

  table td.mobile-primary {
    gap: 6px;
  }

  table td.mobile-primary::before {
    font-size: 11px;
  }

  table td[data-label="Action"]::before,
  table td[data-label="Salary"]::before {
    margin-bottom: 4px;
  }

  table#todayTable td:first-child,
  table#employeeTable td:first-child,
  table#attendanceTable td:first-child,
  table#leaveTable td:first-child,
  table#salaryTable td:first-child,
  table#deviceTable td:first-child,
  table#syncLogTable td:first-child {
    padding-top: 2px;
  }

  table#todayTable tr {
    gap: 12px;
    border-radius: 20px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 244, 237, 0.96));
  }

  table#todayTable td[data-label="Employee"],
  table#todayTable td[data-label="Status"] {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  table#todayTable td[data-label="Employee"] strong {
    font-size: 17px;
  }

  table#todayTable td[data-label="Late"] strong,
  table#todayTable td[data-label="Work time"] strong {
    font-size: 15px;
  }

  table#employeeTable tr,
  table#attendanceTable tr,
  table#salaryTable tr,
  table#deviceTable tr {
    gap: 12px;
  }

  table#employeeTable td[data-label="Name"],
  table#attendanceTable td[data-label="Name"],
  table#salaryTable td[data-label="Name"],
  table#deviceTable td[data-label="Device"] {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  table#employeeTable td[data-label="Name"] strong,
  table#deviceTable td[data-label="Device"] strong {
    font-size: 17px;
  }

  table#employeeTable td[data-label="Salary"] .salary-editor {
    gap: 8px;
  }

  table#salaryTable td[data-label="Net"] strong {
    font-size: 22px;
  }

  table#attendanceTable td[data-label="Status"],
  table#employeeTable td[data-label="Source"],
  table#deviceTable td[data-label="Status"],
  table#deviceTable td[data-label="SDK"] {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  table#deviceSetupTable td[data-label="Details"],
  table#deviceLogTable td[data-label="Message"],
  table#syncLogTable td[data-label="Message"] {
    word-break: break-word;
  }

  .mini-list {
    gap: 8px;
  }

  .mini-row {
    padding: 10px 12px;
  }

  .side-drawer {
    width: min(100vw, 480px);
    padding: 18px 16px 22px;
  }

  .drawer-head,
  .drawer-note {
    align-items: stretch;
    flex-direction: column;
  }

  .drawer-grid,
  .read-only-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .login-shell {
    padding: 16px;
    gap: 16px;
  }

  .login-art {
    min-height: 280px;
    padding: 24px;
  }

  .login-art h1 {
    font-size: 32px;
  }

  .content {
    padding: 14px;
  }

  .topbar {
    margin-bottom: 16px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  #dashboard.view.active {
    gap: 16px;
  }

  #dashboard .metric-grid {
    gap: 12px;
  }

  .metric strong {
    font-size: 22px;
  }

  #dashboard .metric,
  #dashboard .panel {
    padding: 18px 16px;
  }

  .today-attendance-panel {
    padding: 16px;
  }

  .panel {
    padding: 14px;
    border-radius: 18px;
  }

  .status-chip {
    padding: 9px 12px;
    font-size: 13px;
  }

  .mini-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .summary-card strong,
  .panel h3 {
    line-height: 1.15;
  }

  #dashboard .split-panels,
  #dashboard .stack-panels {
    gap: 14px;
  }

  #dashboard .today-attendance-summary {
    gap: 10px;
  }

  #dashboard .today-attendance-summary-item {
    padding: 13px 14px;
  }

  .employees-layout {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    gap: 8px;
  }

  .status-chip,
  .topbar-actions button,
  .toolbar button,
  .toolbar input,
  .panel-head input,
  .drawer-form input,
  .drawer-form textarea {
    min-height: 48px;
  }

  table td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  table td::before {
    font-size: 11px;
  }

  table tr {
    gap: 8px;
    padding: 12px;
  }

  table#employeeTable td[data-label="Salary"] .salary-editor,
  table#employeeTable td[data-label="Action"] {
    gap: 8px;
  }

  table#employeeTable td[data-label="Salary"] button,
  table#employeeTable td[data-label="Action"] button {
    width: 100%;
  }

  .dashboard-secondary-panel,
  .mobile-secondary-panel,
  .mobile-summary-panel {
    margin-top: 0;
  }

  .side-drawer {
    width: 100vw;
    padding: 16px 14px 24px;
  }
}
