:root {
  --teal: #0c9083; --teal-d: #0a7a6f;
  --green: #159b46; --green-d: #11833b;
  --orange: #ee9008; --orange-d: #cf7d06;
  --red: #e93939; --red-d: #c92f2f;
  --blue: #6595fb; --mint: #63dbae; --slate: #5e6e8f;
  --ink: #2b3340; --muted: #7a8494; --line: #e6e9ef;
  --bg: #f4f6f9; --panel: #ffffff; --side: #ffffff; --side-active: #e8f6f5;
  --radius: 6px; --shadow: 0 1px 3px rgba(20, 30, 50, .08);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--teal); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h2.page-title { font-size: 20px; margin-bottom: 4px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal) 40%, var(--green) 100%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 10px; padding: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.2); display: grid; gap: 14px; }
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.login-brand h1 { font-size: 20px; } .login-brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.logo-dot { width: 44px; height: 44px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }

/* ---------- shell ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; height: 52px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; z-index: 30; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.home-link { color: var(--ink); font-weight: 600; width: 170px; padding-left: 40px; }
.app-title { font-size: 15px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--ink); padding: 6px; border-radius: 4px; font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--bg); }
.top-link { background: none; border: 0; cursor: pointer; font: inherit; color: var(--ink); padding: 6px 8px; border-radius: 4px; white-space: nowrap; }
.top-link:hover { background: var(--bg); }
.quick { position: relative; }
.dropdown { display: none; position: absolute; right: 0; top: 38px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 200px; padding: 6px 0; z-index: 40; }
.dropdown.open { display: block; }
.dropdown a { display: block; padding: 8px 14px; color: var(--ink); }
.dropdown a:hover { background: var(--side-active); }

.sidebar { position: fixed; top: 52px; bottom: 0; left: 0; width: 230px; background: var(--side); border-right: 6px solid #e9edf2; overflow-y: auto; z-index: 25; transition: transform .2s; }
.profile-card { margin: 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #9bc53d; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-weight: 600; font-size: 13px; }
.online { font-size: 11px; color: var(--muted); } .online i { display: inline-block; width: 7px; height: 7px; background: #2ecc71; border-radius: 50%; }
.nav-group > button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 16px; font-weight: 600; font-size: 13px; cursor: pointer; }
.nav-group > button:hover { background: #f7f9fb; }
.nav-group > button .chev { margin-left: auto; transition: transform .15s; font-size: 10px; color: var(--muted); }
.nav-group.open > button { background: var(--side-active); color: var(--teal); }
.nav-group.open > button .chev { transform: rotate(-90deg); }
.nav-items { display: none; padding: 4px 0 8px; }
.nav-group.open .nav-items { display: block; }
.nav-items a { display: flex; gap: 8px; align-items: center; padding: 6px 16px 6px 36px; font-size: 12.5px; color: #4c5564; }
.nav-items a:hover, .nav-items a.active { color: var(--teal); background: #f4fbfa; }
.nav-single { display: flex; gap: 10px; padding: 10px 16px; font-weight: 600; font-size: 13px; color: var(--ink); }
.nav-single.active, .nav-single:hover { background: var(--side-active); color: var(--teal); }
.content { margin: 52px 0 0 230px; padding: 20px; min-height: calc(100vh - 52px); transition: margin .2s; }
body.collapsed .sidebar { transform: translateX(-100%); }
body.collapsed .content { margin-left: 0; }
.scrim { display: none; }

/* ---------- dashboard tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.tile { position: relative; border-radius: var(--radius); color: #fff; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 118px; }
.tile .tile-body { padding: 14px 16px 10px; flex: 1; position: relative; }
.tile h3 { font-size: 26px; font-weight: 600; letter-spacing: -.3px; }
.tile .sub { font-size: 12.5px; opacity: .95; }
.tile .tile-icon { position: absolute; right: 12px; bottom: 6px; width: 58px; height: 58px; opacity: .28; }
.tile .tile-foot { display: block; padding: 7px 10px; text-align: center; font-weight: 600; font-size: 12.5px; color: #fff; }
.tile .tile-foot::after { content: " \2794"; font-size: 11px; }
.tile.teal { background: var(--teal); } .tile.teal .tile-foot { background: var(--teal-d); }
.tile.green { background: var(--green); } .tile.green .tile-foot { background: var(--green-d); }
.tile.orange { background: var(--orange); } .tile.orange .tile-foot { background: var(--orange-d); }
.tile.red { background: var(--red); } .tile.red .tile-foot { background: var(--red-d); }
.tile:hover { filter: brightness(1.04); }

.cards3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.card h4 { margin: 0 0 10px; font: 500 15px Georgia, "Times New Roman", serif; }
.chart-box { position: relative; height: 190px; }
.task-list { list-style: none; padding: 0; margin: 0; max-height: 210px; overflow: auto; }
.task-list li { display: flex; gap: 10px; padding: 7px 0; font-size: 13px; align-items: flex-start; border-bottom: 1px dashed var(--line); }
.task-list li:last-child { border: 0; }
.task-list .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--blue); flex: none; margin-top: 2px; }
.task-list .dot.danger { border-color: var(--red); } .task-list .dot.warn { border-color: var(--orange); }
.task-list a { margin-left: auto; white-space: nowrap; font-size: 12px; }

/* ---------- page / tables / forms ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.panel-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-head h3 { font-size: 15px; }
.panel-body { padding: 14px; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; background: #f7f9fb; color: #556070; font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr:hover td { background: #fafcfd; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.actions { white-space: nowrap; text-align: right; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 4px; cursor: pointer; font: inherit; font-size: 13px; white-space: nowrap; }
.btn:hover { border-color: #c9d0da; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; } .btn-primary:hover { background: var(--teal-d); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-danger { background: #fff; border-color: #f3c2c2; color: var(--red); }
.btn-sm { padding: 3px 8px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.link-btn { background: none; border: 0; color: var(--teal); cursor: pointer; font: inherit; padding: 2px 4px; }
.link-btn.danger { color: var(--red); }
input, select, textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid #d5dbe3; border-radius: 4px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(12, 144, 131, .25); border-color: var(--teal); }
input[type=checkbox] { width: auto; }
textarea { min-height: 70px; resize: vertical; }
label { display: grid; gap: 4px; font-size: 12.5px; color: #4c5564; font-weight: 500; }
.search { max-width: 240px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; padding-top: 18px; }
.form-error { color: var(--red); min-height: 1em; margin: 0; font-size: 13px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: #eef1f5; color: #556070; white-space: nowrap; }
.badge.green { background: #e3f5ea; color: var(--green-d); } .badge.red { background: #fde8e8; color: var(--red-d); }
.badge.orange { background: #fff1dc; color: #a86204; } .badge.teal { background: #e1f4f2; color: var(--teal-d); } .badge.blue { background: #e7eefe; color: #3d63c9; }

/* modal & toast */
.modal { position: fixed; inset: 0; background: rgba(20, 28, 40, .45); display: grid; place-items: start center; padding: 40px 16px; z-index: 60; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 8px; width: 100%; max-width: 680px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: #263040; color: #fff; padding: 10px 18px; border-radius: 6px; transition: transform .25s; z-index: 70; max-width: 90vw; opacity: 0; visibility: hidden; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; } .toast.err { background: var(--red-d); }

/* tabs, kanban, stats */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 14px; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--teal); border-color: var(--teal); font-weight: 600; }
.kanban { display: grid; grid-template-columns: repeat(6, minmax(170px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kan-col { background: #eef1f5; border-radius: 6px; padding: 8px; min-height: 160px; }
.kan-col h5 { margin: 2px 4px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: #556070; display: flex; justify-content: space-between; }
.kan-card { background: #fff; border-radius: 5px; padding: 9px; margin-bottom: 8px; box-shadow: var(--shadow); font-size: 12.5px; border-left: 3px solid var(--teal); }
.kan-card b { display: block; font-size: 13px; }
.kan-card .row { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: var(--radius); padding: 10px 14px; }
.stat .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat.orange { border-left-color: var(--orange); } .stat.red { border-left-color: var(--red); } .stat.green { border-left-color: var(--green); }
.emp-head { display: flex; gap: 16px; align-items: center; }
.emp-head .avatar { width: 64px; height: 64px; font-size: 22px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 20px; }
.kv div span { display: block; font-size: 11.5px; color: var(--muted); }
.progress { height: 6px; background: #e8ecf1; border-radius: 3px; overflow: hidden; min-width: 60px; }
.progress i { display: block; height: 100%; background: var(--teal); }
.clock-big { font-size: 34px; font-weight: 300; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ess-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* payslip print */
.payslip { max-width: 760px; margin: 0 auto; background: #fff; padding: 28px; border: 1px solid var(--line); }
.payslip header { display: flex; justify-content: space-between; border-bottom: 3px solid var(--teal); padding-bottom: 10px; margin-bottom: 16px; }
.payslip table { width: 100%; border-collapse: collapse; }
.payslip td { padding: 5px 0; border-bottom: 1px solid #eef0f3; }
.payslip td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.payslip .net { background: var(--teal); color: #fff; padding: 12px; display: flex; justify-content: space-between; font-size: 18px; margin-top: 16px; border-radius: 4px; }
@media print {
  .topbar, .sidebar, .no-print { display: none !important; }
  .content { margin: 0; padding: 0; } body { background: #fff; }
  .payslip { border: 0; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cards3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: 4px 0 20px rgba(0,0,0,.15); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 52px 0 0 0; background: rgba(0,0,0,.25); z-index: 20; }
  .content { margin-left: 0; padding: 14px; }
  .home-link { width: auto; padding-left: 0; }
  .app-title, #quickWrap, .top-link span { display: none; }
  .cards3, .grid2, .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) { .tiles { grid-template-columns: 1fr 1fr; gap: 10px; } .tile h3 { font-size: 20px; } .tile .tile-icon { width: 40px; height: 40px; } }

/* subscription banner */
.lic-banner { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13.5px; border: 1px solid; }
.lic-banner b { font-weight: 600; }
.lic-banner .grow { flex: 1; }
.lic-30 { background: #e7f6f4; border-color: #b6e3dd; color: #0a5f56; }
.lic-20 { background: #fff6e5; border-color: #f6d79a; color: #8a5300; }
.lic-10 { background: #fff0e0; border-color: #f3b779; color: #8a3f00; }
.lic-5  { background: #fde8e8; border-color: #f1a9a9; color: #9b1c1c; }
