:root {
  /* Clintask logo palette */
  --brand: #526ffb;          /* logo blue */
  --brand-dark: #3a55e0;
  --brand-soft: #eef1ff;
  --green: #5cbf36;          /* logo green "t" */
  --green-soft: #eaf7e3;
  --teal: #5fa99c;           /* logo teal base */
  --teal-soft: #e5f2ef;
  --grad: linear-gradient(135deg, #526ffb 0%, #5fa99c 60%, #74e34e 100%);
  --ink: #1f2433;
  --ink-2: #5d6578;
  --line: #e4e8f0;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ok: #2f8f1f;
  --ok-soft: #e8f6e1;
  --warn: #9a6200;
  --warn-soft: #fdf3dc;
  --bad: #c0362c;
  --bad-soft: #fdeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 36, 51, .05), 0 1px 8px rgba(31, 36, 51, .04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.boot { padding: 48px; text-align: center; color: var(--ink-2); }

/* Layout */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 0 12px 16px; position: sticky; top: 0; height: 100vh;
        overflow-y: auto; display: flex; flex-direction: column; }
.side::before { content: ""; display: block; height: 4px; margin: 0 -12px; background: var(--grad); }
.brand-block { padding: 18px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.brand-block img { display: block; width: 176px; height: auto; }
.brand-block .product { margin-top: 8px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ink-2); }
.brand-block .product b { color: var(--brand); font-weight: 700; }
.nav-group { margin: 16px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8a92a6; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); position: relative; }
.nav a .ic { color: #7b849a; flex: none; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a:hover .ic { color: var(--brand); }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav a.active .ic { color: var(--brand); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 6px; bottom: 6px; width: 4px; border-radius: 0 4px 4px 0; background: var(--grad); }
.side-foot { margin-top: auto; padding: 16px 10px 0; font-size: 11px; color: #8a92a6; }
.side-foot .tag { font-style: italic; color: var(--ink-2); }

.content { min-width: 0; display: flex; flex-direction: column; }
.appbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 28px;
          background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.appbar .grow { flex: 1; }
.search-box { position: relative; width: min(380px, 100%); }
.search-box .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #8a92a6; }
.search-box input { padding-left: 34px; background: var(--bg); border-color: transparent; border-radius: 8px; }
.search-box input:focus { background: #fff; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line);
                  border-radius: 10px; box-shadow: 0 12px 30px rgba(31,36,51,.12); overflow: hidden; z-index: 40; }
.search-results a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; color: var(--ink); }
.search-results a:hover, .search-results a.sel { background: var(--brand-soft); text-decoration: none; }
.icon-btn { position: relative; width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 9px; color: var(--ink-2); }
.icon-btn:hover { color: var(--brand); }
.dot { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--green);
       color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center;
          font-weight: 700; font-size: 12px; flex: none; }
.user-chip { border: none; background: none; padding: 4px 6px 4px 4px; border-radius: 10px; }
.user-chip:hover { background: var(--bg); }
.user-chip .who { text-align: left; line-height: 1.15; }
.user-chip .who small { display: block; color: var(--ink-2); font-size: 11px; }
.menu-pop { position: absolute; z-index: 45; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
            box-shadow: 0 12px 30px rgba(31,36,51,.14); padding: 6px; }
.menu-pop button, .menu-pop a { display: flex; width: 100%; align-items: center; gap: 10px; border: none; background: none; padding: 8px 10px;
                                border-radius: 7px; color: var(--ink); text-align: left; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.menu-pop hr { border: none; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu-pop .ic { color: #7b849a; }
.main { padding: 22px 28px 48px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.menu-btn { display: none; }

/* Home hero */
.hero { background: var(--grad); color: #fff; border-radius: 14px; padding: 22px 24px; margin-bottom: 18px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero h1 { font-size: 22px; margin-bottom: 4px; }
.hero p { margin: 0 0 14px; opacity: .92; }
.hero .row button, .hero .row a.btn { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); color: #fff; }
.hero .row button:hover, .hero .row a.btn:hover { background: rgba(255,255,255,.28); }
.stat { display: flex; gap: 12px; align-items: center; }
.stat .badge-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.tone-blue .badge-ic { background: var(--brand-soft); color: var(--brand); }
.tone-green .badge-ic { background: var(--green-soft); color: var(--green); }
.tone-teal .badge-ic { background: var(--teal-soft); color: var(--teal); }
.tone-warn .badge-ic { background: var(--warn-soft); color: var(--warn); }

/* Cards & grid */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .l { color: var(--ink-2); font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; }
.kv .k { color: var(--ink-2); }

/* Buttons */
button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 12px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: #c5ccd8; text-decoration: none; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-dark); }
button.danger { color: var(--bad); border-color: #f2c6c2; }
button.ok { color: var(--ok); border-color: #bfe3b1; }
button.ok:hover { background: var(--green-soft); }
button.link { border: none; background: none; color: var(--brand); padding: 2px 4px; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.sm { padding: 3px 8px; font-size: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; background: #fff; }
table.t th, table.t td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; color: var(--ink-2); font-weight: 600; background: #fafbfc; white-space: nowrap; position: sticky; top: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr:hover td { background: #fafcff; }
table.t tfoot td { font-weight: 700; background: #fafbfc; }
.empty { padding: 24px; text-align: center; color: var(--ink-2); }

/* Forms */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
label.f.req > span::after { content: " *"; color: var(--bad); }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid #cfd6e0; border-radius: 6px; padding: 7px 9px; background: #fff; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.check { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink); }
.hint { font-size: 12px; color: var(--ink-2); }
.err { color: var(--bad); font-size: 12px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: #eef1f5; color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--brand-soft); color: var(--brand-dark); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 12px; color: var(--ink-2); }
.tabs button.on { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.tabs button:hover { color: var(--brand); }

/* Modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 10px; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal.wide { width: min(1100px, 100%); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal header h2 { margin: 0; }
.modal .body { padding: 16px 18px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; }
#toast-root { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 420px; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 15% 20%, #eef1ff 0, transparent 45%), radial-gradient(circle at 85% 80%, #eaf7e3 0, transparent 45%), var(--bg); }
.login .card::before { content: ""; display: block; height: 4px; margin: -28px -28px 22px; border-radius: 10px 10px 0 0; background: var(--grad); }
.login img { width: 220px; display: block; margin-bottom: 6px; }
.login .card { width: min(380px, 100%); padding: 28px; }

/* Kanban (recruitment) */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: #eef2f7; border-radius: 8px; padding: 8px; min-height: 120px; }
.lane h4 { margin: 2px 4px 8px; font-size: 12px; color: var(--ink-2); text-transform: uppercase; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin-bottom: 6px; cursor: pointer; }

/* Attendance grid */
.att td, .att th { padding: 3px 4px !important; text-align: center !important; font-size: 11px; }
.att td.WO, .att td.H { background: #f0f2f5; color: #98a1b0; }
.att td.CL { background: #e3edfb; } .att td.SL { background: #fde8e6; } .att td.EL { background: #e3f4ea; }
.att td.LOP { background: #fdf3dc; } .att td.OD { background: #e0f4f7; }

/* Printable documents (payslip) */
#print-root { display: none; }
.doc { max-width: 800px; margin: 0 auto; background: #fff; padding: 28px; font-size: 12.5px; color: #000; }
.doc h1 { text-align: center; font-size: 18px; }
.doc .company { text-align: center; color: #333; font-size: 11px; margin-bottom: 14px; }
.doc table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.doc td, .doc th { border: 1px solid #999; padding: 5px 7px; }
.doc th { background: #f1f1f1; text-align: left; }
.doc .r { text-align: right; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  .doc { padding: 0; }
  @page { size: A4; margin: 14mm; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: -270px; width: 250px; z-index: 50; transition: left .2s; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  .appbar { padding: 8px 12px; }
  .user-chip .who { display: none; }
  .side.open { left: 0; }
  .menu-btn { display: inline-flex; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}

/* icon sizing fixes */
.ic { flex: none; }
a.btn.icon-btn, button.icon-btn { padding: 0; width: 38px; height: 38px; justify-content: center; }
.search-results a .muted.small { white-space: nowrap; }
@media (max-width: 860px) { .search-results { min-width: 300px; } .search-box { width: auto; flex: 1; } }
