:root {
  --bg: #f3f6fb;
  --bg-soft: #ecf1f9;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --surface-3: #eef3fb;
  --border: #dce5f3;
  --border-strong: #c5d2e8;
  --text: #111b2e;
  --muted: #667a98;
  --primary: #2258cb;
  --primary-dark: #1a44a8;
  --primary-soft: #eaf0ff;
  --success: #0f8b6c;
  --success-soft: #e7f8f2;
  --danger: #cc3b38;
  --danger-soft: #fdecec;
  --warning: #b87416;
  --warning-soft: #fff3de;
  --info: #355fd0;
  --radius: 14px;
  --shadow-sm: 0 4px 14px rgba(21, 39, 75, 0.06);
  --shadow-md: 0 12px 26px rgba(21, 39, 75, 0.1);
  --shadow-lg: 0 20px 42px rgba(21, 39, 75, 0.14);
  --focus: 0 0 0 3px rgba(34, 88, 203, 0.16);
  --app-header-height: 66px;
  --sidebar-width: 292px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  font-family: "Source Sans 3", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(920px 380px at -6% -12%, #d9e7ff 0%, rgba(217, 231, 255, 0) 60%),
    radial-gradient(760px 360px at 105% -15%, #d1e1ff 0%, rgba(209, 225, 255, 0) 56%),
    linear-gradient(180deg, #f8fbff 0, var(--bg) 230px, #eef3fa 100%);
  font-size: 15px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

.app-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(34, 88, 203, 0.02) 1px, transparent 1px), linear-gradient(90deg, rgba(34, 88, 203, 0.02) 1px, transparent 1px);
  background-size: 24px 24px;
  z-index: -1;
}

a { color: var(--primary); text-decoration: none; font-weight: 700; }
a:hover { color: var(--primary-dark); text-decoration: none; }

h1, h2, h3, h4 {
  font-family: "Manrope", system-ui, sans-serif;
  letter-spacing: 0;
  margin: 0 0 12px;
  color: #111827;
}
h2 { font-size: clamp(22px, 2vw, 30px); }
h3 { font-size: 18px; margin-top: 18px; }
h4 { font-size: 15px; margin-top: 14px; }
p { margin: 0 0 12px; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 66px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
}

.sidebar-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 12px;
  border-color: var(--border-strong);
  background: #fff;
  color: var(--primary);
}

.sidebar-toggle svg,
.sidebar-close svg {
  width: 18px;
  height: 18px;
}

.sidebar-close {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 12px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.app-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-logo{
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}
.app-brand b {
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #122349;
  white-space: nowrap;
}
.app-subtitle { color: var(--muted); font-size: 13px; white-space: nowrap; }
.app-header-right { display: flex; align-items: center; gap: 12px; }
.app-meta { color: var(--muted); font-size: 13px; }

.wrap {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 18px;
  animation: appFadeIn 0.28s ease both;
}

.card,
.login-card,
.panel,
.stat,
.hero,
.att-card,
.section,
.notif-prompt,
.gps-box,
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card { padding: 16px; }
.card .card { box-shadow: none; }

.card h3,
.card h4 {
  margin-bottom: 10px;
}

footer {
  color: var(--muted);
  text-align: center;
  padding: 18px;
  font-size: 13px;
}

button,
.btn,
.btnLink,
input[type="submit"],
input[type="button"] {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 8px 12px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

button:hover,
.btn:hover,
.btnLink:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(34, 88, 203, 0.2);
}

button:focus-visible,
.btn:focus-visible,
.btnLink:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn-outline,
.btn.b-ghost,
.btn.b-outline,
.btn.b-amber {
  background: #fff;
  color: var(--primary);
  border-color: var(--border-strong);
}

.btn-outline:hover,
.btn.b-ghost:hover,
.btn.b-outline:hover,
.btn.b-amber:hover {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: #b9c8ee;
}

.btn-green { background: var(--success); border-color: var(--success); }
.btn-amber { background: var(--warning); border-color: var(--warning); }
.btn-gray { background: #475569; border-color: #475569; }
.btn-red { background: var(--danger); border-color: var(--danger); }
.btn-blue { background: var(--primary); border-color: var(--primary); }

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.nav {
  width: 100%;
}

.nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: #233657;
  font-size: 13px;
  font-weight: 800;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav a {
  white-space: nowrap;
  flex: 0 0 auto;
}

.nav a:hover {
  background: #f4f8ff;
  border-color: #c6d4ec;
  color: var(--primary-dark);
  transform: translateY(-1px);
}

.sr-only{
  position:absolute!important;
  width:1px!important;
  height:1px!important;
  padding:0!important;
  margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  border:0!important;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.form-control {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fbfdff;
  color: var(--text);
  padding: 9px 12px;
  font: inherit;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea { min-height: 104px; resize: vertical; }
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus,
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus);
}

input[type="checkbox"],
input[type="radio"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  border-radius: 3px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #ffffff, #f7faff);
  font-size: 12px;
  font-weight: 700;
  color: #1e2f4f;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.check-item:hover {
  border-color: #b9c8ee;
  background: #f3f7ff;
}

.check-item:has(input:focus-visible) {
  box-shadow: var(--focus);
}

.check-item input[type="checkbox"],
.check-item input[type="radio"] {
  width: 16px;
  height: 16px;
  min-height: 16px;
  flex: 0 0 auto;
  accent-color: #1f53bf;
}

.dashboard-shell {
  display: grid;
  gap: 12px;
  width: min(1220px, 100%);
  margin: 0 auto;
}

.dashboard-section {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.dashboard-section:hover {
  transform: translateY(-1px);
  border-color: #cfdcf1;
  box-shadow: var(--shadow-md);
}

.dashboard-section > h3:first-child {
  margin: 0 0 12px;
  padding: 0 0 10px;
  font-size: 17px;
  line-height: 1.25;
  border-bottom: 1px solid #e5ebf6;
}

.dashboard-section > p.muted:first-child {
  margin-top: -6px;
}

.dashboard-section > .tableWrap,
.dashboard-section > form,
.dashboard-section > .nav,
.dashboard-section > .btns {
  margin-top: 10px;
}

.dashboard-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.dashboard-nav a {
  min-height: 42px;
  border-radius: 12px;
}

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.dash-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-title img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.dash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
}

.dash-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #d8c7c7;
  background: #fff;
  color: #9e2f2f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  flex: 0 0 auto;
}

.dash-logout:hover {
  background: #fff3f3;
  border-color: #e1b5b5;
  color: #842424;
}

.dashboard-kpis .card{
  border-radius:16px;
  border:1px solid #d7e2f4;
  background:#fff;
  position:relative;
  overflow:hidden;
  min-height: 110px;
  display: grid;
  align-content: start;
  gap: 4px;
}
.dashboard-kpis .card::after{
  content:"";
  position:absolute;
  top:-28px;
  right:-24px;
  width:84px;
  height:84px;
  border-radius:50%;
  background:radial-gradient(circle,#cfe0ff 0%,rgba(207,224,255,0) 68%);
}

.dashboard-kpis .card h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #5e7391;
}

.dashboard-kpis .card p {
  margin: 0;
  font-size: 14px;
  color: #4a5f7c;
}

.dashboard-kpis .card p b {
  display: block;
  margin-bottom: 2px;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 30px;
  line-height: 1;
  color: #102750;
}

.emp-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 12px;
}

.emp-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-card {
  border: 1px solid #dde6f5;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(20, 38, 70, 0.06);
}

.task-card > div:first-child {
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.3;
  margin-bottom: 6px;
}

.task-card.green { border-left: 4px solid #0f8f72; }
.task-card.red { border-left: 4px solid #c73535; }
.task-card.orange { border-left: 4px solid #b7791f; }

.task-meta {
  font-size: 12px;
  color: #5b6e87;
}

.urgent {
  color: #c73535;
  font-weight: 800;
  margin-left: 6px;
}

.sales-modal {
  position: fixed;
  inset: 0;
  background: rgba(12, 18, 31, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 14px;
}

.sales-modal .card {
  width: min(560px, 95vw);
  max-height: 88vh;
  overflow: auto;
}

.notif-lock {
  padding: 10px;
  border: 1px dashed #c73535;
  background: #fff1f2;
  border-radius: 8px;
  margin-bottom: 12px;
}

.att-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.att-day {
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  padding: 6px;
  font-size: 12px;
}

.att-day.present { background: #ecfdf5; }
.att-day.leave { background: #fff7ed; }
.att-day.absent { background: #fff1f2; }

form {
  display: grid;
  gap: 10px;
  max-width: 940px;
}

form p { margin: 0; }
label,
.form-label {
  display: block;
  margin-bottom: 5px;
  color: #425875;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.muted { color: var(--muted); }
.hr, hr {
  height: 1px;
  border: 0;
  margin: 18px 0;
  background: var(--border);
}

.tableWrap, .tw, .dtable, .attWrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 8px;
  color: #586f90;
  font-size: 12px;
  font-weight: 700;
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: #475569;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

td { color: #243044; }
tbody tr, table tr { transition: background 0.14s ease; }
tr:hover td { background: #f9fbff; }
tr:last-child td { border-bottom: 0; }
.row-detail-row,
[data-row-detail] {
  cursor: pointer;
}

.row-detail-row:hover td,
.row-detail-row:focus-visible td,
[data-row-detail]:hover {
  background: #f4f8ff;
}
.notif-unread td {
  background: #f3f8ff;
}

.table-pagination {
  margin: 10px 2px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.table-pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}

.table-pagination a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.table-pagination a.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.table-pagination a[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.45;
}

.pill,
.emp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.p-green, .pill-green, .p-teal, .prio-low, .p-lo {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bfe9dc;
}
.p-red, .pill-red, .prio-veryhigh, .p-vh, .p-veryhigh {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f4c7c7;
}
.p-blue, .prio-medium, .p-md, .p-medium {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #c7d6ff;
}
.p-hi, .prio-high, .p-high {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #f3d68d;
}
.p-slate, .pill-gray, .p-low {
  color: #475569;
  background: #eef2f7;
  border-color: #d8e0ea;
}

.s-green { color: var(--success); font-weight: 800; }
.s-orange { color: var(--warning); font-weight: 800; }
.s-red { color: var(--danger); font-weight: 800; }

.flash,
.flash-ok,
.flash-err,
.result {
  border-radius: var(--radius);
  padding: 10px 12px;
  border: 1px solid;
  box-shadow: var(--shadow-sm);
}
.flash, .flash-ok, .result-ok { background: var(--success-soft); border-color: #bfe9dc; color: #09634f; }
.flash-err, .result-err { background: var(--danger-soft); border-color: #f4c7c7; color: #922424; }

.installBar {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 901px) {
  .installBar {
    display: none !important;
  }
}

.installBar .emp-nav {
  margin-left: auto;
  gap: 8px;
}

.btns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.log {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--surface-2);
}
.ll { display: block; margin-bottom: 6px; font-size: 12px; }
.lok { color: var(--success); }
.lwarn { color: var(--warning); }
.lerr { color: var(--danger); }
.linfo, .lgray { color: var(--muted); }

.monthBar,
.attLegend,
.section-hd,
.panel-hd,
.tb-left,
.tb-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.monthBar,
.section-hd,
.panel-hd {
  justify-content: space-between;
}

.legendDot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}
.dotGreen { background: #10b981; }
.dotRed { background: #ef4444; }
.attCal { min-width: 860px; }
.attCell { min-width: 92px; font-size: 12px; }
.attGreen { background: #ecfdf5; }
.attRed { background: #fff1f2; }

.login-wrapper {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.login-card {
  width: min(430px, 94vw);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  animation: appLiftIn 0.36s ease both;
}
.login-card h2 { margin-bottom: 18px; }
.login-card form { max-width: none; }
.login-card .error { color: var(--danger); margin-top: 12px; font-weight: 800; }

#noteModal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}

#noteModal > div {
  width: min(560px, 96vw);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  animation: appLiftIn 0.18s ease both;
}

#noteModal > div > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.noteBtn {
  width: 38px;
  min-height: 34px;
  padding: 0;
  background: #fff;
  color: var(--primary);
  border-color: var(--border-strong);
}
.noteBtn[data-empty="1"] {
  color: var(--muted);
  background: var(--surface-2);
}

/* Manager and employee workspace */
.page-manager .wrap,
.page-manager_dashboard .wrap,
.page-employee .wrap,
.page-employee_dashboard .wrap {
  max-width: none;
}

.page-manager .page-content-card,
.page-manager_dashboard .page-content-card,
.page-employee .page-content-card,
.page-employee_dashboard .page-content-card {
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.sb {
  position: fixed;
  top: var(--app-header-height);
  left: 0;
  bottom: 0;
  z-index: 88;
  width: min(88vw, 320px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  background: #111827;
  color: #cbd5e1;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
  transform: translateX(-102%);
  transition: transform 0.22s ease;
}

.sb a { color: inherit; text-decoration: none; }
.sb-ic {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.sb-ic svg {
  width: 16px;
  height: 16px;
}
.sb-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.sb-label { margin-bottom: 12px; }
.sb-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
.sb-brand > div { min-width: 0; }
.sb-app-name { color: #fff; font-family: "Manrope", system-ui, sans-serif; font-weight: 800; }
.sb-app-sub, .sb-date { color: #94a3b8; font-size: 12px; }
.sb-app-name,
.sb-app-sub {
  overflow-wrap: anywhere;
}
.sb-date { margin-top: 10px; }
.sb-label {
  margin-top: 16px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}
.sb-nav { display: grid; gap: 6px; }
.sb-a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 12px;
  justify-content: flex-start;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e5eefc;
  text-align: left;
  text-decoration: none;
  white-space: normal;
  box-sizing: border-box;
  box-shadow: none;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}
.sb-a:hover, .sb-a.on {
  background: rgba(59, 130, 246, 0.26);
  color: #fff;
  transform: translateX(0);
  border-color: rgba(96, 165, 250, 0.4);
}
.sb-a svg { width: 16px; height: 16px; flex: 0 0 auto; }
.sb-badge {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 900;
}

.row-detail-backdrop {
  position: fixed;
  top: var(--app-header-height);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 91;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(3px);
}

.row-detail-drawer {
  position: fixed;
  top: var(--app-header-height);
  right: 0;
  bottom: 0;
  z-index: 92;
  width: min(42vw, 460px);
  min-width: 340px;
  max-width: 100vw;
  padding: 18px;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(102%);
  transition: transform 0.22s ease;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}

body.row-detail-open .row-detail-drawer {
  transform: translateX(0);
}

.row-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.row-detail-kicker {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin-bottom: 4px;
}

.row-detail-head h3 {
  margin: 0;
  font-size: 20px;
}

.row-detail-close {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 12px;
  border-color: var(--border);
  background: #fff;
  color: var(--primary);
}

.row-detail-body {
  overflow: auto;
  padding-right: 4px;
}

.row-detail-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 14px;
}

.row-detail-fields {
  display: grid;
  gap: 10px;
}

.row-detail-field {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 10px 12px;
}

.row-detail-field-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
}

.row-detail-field-value {
  color: var(--text);
  font-size: 14px;
  word-break: break-word;
}

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

.row-detail-actions .btnLink,
.row-detail-actions .btn-outline {
  flex: 1 1 140px;
}

.main {
  min-height: 100vh;
  margin-left: 0;
  padding: 16px;
}

.sidebar-backdrop {
  position: fixed;
  top: var(--app-header-height);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 86;
  display: none;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

body.sidebar-open {
  overflow: hidden;
}
body.sidebar-open .sb {
  transform: translateX(0);
  box-shadow: var(--shadow-lg);
}
body.sidebar-open .sidebar-backdrop {
  display: block;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}
.tb-greeting { font-family: "Manrope", system-ui, sans-serif; font-weight: 800; color: #111827; }
.tb-date, .tb-urole { color: var(--muted); font-size: 13px; }
.tb-user { display: flex; align-items: center; gap: 8px; }
.tb-ava {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 900;
}

.pg { display: grid; gap: 14px; margin-top: 14px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  padding: 14px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-lbl { color: var(--muted); font-size: 13px; font-weight: 800; }
.stat-val {
  margin-top: 4px;
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 26px;
  font-weight: 900;
  color: #111827;
}
.stat-tag { color: var(--muted); font-size: 12px; }

.panel { overflow: hidden; }
.panel-hd {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface-2);
}
.panel-bd { padding: 14px; }
.ph-left, .ph-right { display: flex; align-items: center; gap: 9px; }
.ph-title { font-family: "Manrope", system-ui, sans-serif; font-weight: 800; }
.ph-sub, .ph-count { color: var(--muted); font-size: 12px; }
.ph-chev { width: 16px; height: 16px; transition: transform 0.16s ease; }
.op .ph-chev { transform: rotate(180deg); }
.op .panel-bd { display: block; }
.panel:not(.op) .panel-bd { display: none; }

.emp-chip {
  color: #334155;
  background: #f8fafc;
  border-color: var(--border);
}
.foot { margin-top: 8px; }
.foot-txt { color: var(--muted); text-align: center; font-size: 12px; }
.mob-btn { display: none; }

.btn-new,
.btn-logout,
button.btn-primary,
.attBtn,
.btn.btn-gold,
.btn.b-cop {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.emp-dash { padding: 16px; }
.hero {
  padding: 18px;
  margin-bottom: 12px;
  background: #111827;
  color: #fff;
  border-color: #111827;
  box-shadow: var(--shadow-md);
}
.hero h1, .hero h2, .hero h3 { color: #fff; }
.hero-sub { color: #cbd5e1; }
.att-card { padding: 14px; margin-bottom: 12px; }
.section { padding: 14px; margin-bottom: 12px; }
.section-title { font-family: "Manrope", system-ui, sans-serif; font-weight: 900; }
.section-desc { color: var(--muted); }
.form-group { margin-bottom: 10px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}
.modal-backdrop.show { display: flex; }
.modal {
  width: min(540px, 94vw);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  animation: appLiftIn 0.2s ease both;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-close {
  width: 36px;
  min-height: 36px;
  padding: 0;
  background: #fff;
  color: var(--muted);
  border-color: var(--border);
}

/* Subtle cascade for section entrance */
.dashboard-shell > * {
  animation: appLiftIn 0.24s ease both;
}
.dashboard-shell > *:nth-child(2) { animation-delay: 0.02s; }
.dashboard-shell > *:nth-child(3) { animation-delay: 0.04s; }
.dashboard-shell > *:nth-child(4) { animation-delay: 0.06s; }
.dashboard-shell > *:nth-child(5) { animation-delay: 0.08s; }

@keyframes appFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes appLiftIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { position: static; }
  .tb-left, .tb-right { width: 100%; justify-content: space-between; }
}

@media (max-width: 900px) {
  .sb {
    transform: translateX(-102%);
  }
  .sidebar-backdrop { display: none; }
  .main { margin-left: 0; padding: 58px 10px 10px; }
  .mob-btn {
    position: fixed;
    top: 10px;
    left: 12px;
    z-index: 75;
    display: inline-grid;
    place-items: center;
    width: 38px;
    min-height: 38px;
    padding: 0;
    background: #fff;
    color: var(--primary);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
  }
  .topbar, .panel-bd { padding: 10px; }
  .emp-dash { padding: 10px; }
  .hero { margin-top: 8px; }
  .section-hd { align-items: flex-start; flex-direction: column; }
  .installBar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 700px) {
  body {
    font-size: 14px;
    --app-header-height: 56px;
  }
  .sb {
    width: min(92vw, 340px);
    max-width: 100vw;
    padding: 14px 14px 16px;
  }
  .wrap { padding: 10px; }
  .card { padding: 14px; }
  .stat-grid { grid-template-columns: 1fr; }
  .app-header { padding: 10px 12px; min-height: 56px; }
  .app-subtitle, .app-meta { display: none; }
  .row { grid-template-columns: 1fr; }
  .login-card button,
  form button,
  form .btn,
  form .btnLink,
  .btns .btn {
    width: 100%;
  }

  .nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    margin-bottom: 12px;
  }

  .nav a {
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .dashboard-section {
    border-radius: 14px;
    padding: 12px;
  }

  .dashboard-section > h3:first-child {
    font-size: 16px;
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .dashboard-kpis .card p b {
    font-size: 26px;
  }

  .dash-logout {
    min-height: 34px;
    padding: 5px 10px;
    font-size: 11px;
  }

  .modal-close, .mob-btn, .noteBtn { width: auto; }
  .monthBar { flex-direction: column; align-items: flex-start; }
  .modal { width: min(96vw, 96vw); }
  th, td { padding: 8px 9px; }

  .emp-shell {
    padding-bottom: 12px;
  }

  .page-manager .dashboard-shell,
  .page-manager_dashboard .dashboard-shell {
    padding-bottom: 12px;
  }

  .dash-head {
    position: sticky;
    top: 0;
    z-index: 25;
    background: rgba(243, 246, 251, 0.96);
    padding: 4px 0 8px;
    backdrop-filter: blur(8px);
  }

  .dash-title {
    min-width: 0;
    font-size: 20px;
    line-height: 1.2;
  }

  .row-detail-drawer {
    top: var(--app-header-height);
    width: 100vw;
    min-width: 0;
    border-left: 0;
    border-radius: 0;
    padding: 14px;
  }

  .row-detail-actions .btnLink,
  .row-detail-actions .btn-outline {
    flex: 1 1 100%;
  }

  .tableWrap,
  .tw,
  .dtable,
  .attWrap {
    overflow: visible;
  }

  table.responsive-stack {
    min-width: 0;
    border: 0;
    background: transparent;
  }

  table.responsive-stack tr.rs-head {
    display: none;
  }

  table.responsive-stack,
  table.responsive-stack tbody,
  table.responsive-stack tr,
  table.responsive-stack td {
    display: block;
    width: 100%;
  }

  table.responsive-stack tr {
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 6px 8px;
    box-shadow: var(--shadow-sm);
  }

  table.responsive-stack td {
    border: 0;
    border-bottom: 1px dashed #dce4f2;
    padding: 8px 4px;
    display: grid;
    grid-template-columns: minmax(92px, 42%) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    text-align: left;
  }

  table.responsive-stack td:last-child {
    border-bottom: 0;
  }

  table.responsive-stack td[colspan] {
    grid-template-columns: 1fr;
  }

  table.responsive-stack td[colspan]::before {
    display: none;
  }

  table.responsive-stack td::before {
    content: attr(data-label);
    font-family: "Manrope", system-ui, sans-serif;
    font-size: 11px;
    font-weight: 800;
    color: #5b6e87;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.25;
  }

  table.responsive-stack td > form,
  table.responsive-stack td > .row {
    width: 100%;
  }

  table.responsive-stack td .btnLink,
  table.responsive-stack td .btn,
  table.responsive-stack td button,
  table.responsive-stack td select,
  table.responsive-stack td input {
    width: 100%;
    margin-top: 6px;
  }
}

@media (max-width: 520px) {
  .app-brand b { font-size: 17px; }
  .app-header-right { gap: 8px; }
  .app-logo { width: 30px; height: 30px; }
  .tb-user, .tb-right > * { width: 100%; }
  .tb-right .btn-new, .tb-right .btn-logout { text-align: center; }
}
