/* Koncept Leave Manager */
:root, [data-theme="koncept"] {
  --bg: #f2f4f8; --surface: #ffffff; --surface-2: #f7f8fb; --text: #18212f; --muted: #5d6b80; --line: #e1e6ee;
  --brand: #13294b; --brand-text: #ffffff; --accent: #2f7de1; --accent-text: #ffffff; --accent-soft: #e6f0fd;
  --ok: #1d8a52; --ok-soft: #e3f5eb; --warn: #b7700b; --warn-soft: #fdf2df; --bad: #c53030; --bad-soft: #fde8e8;
  --info: #5b5bd6; --info-soft: #ececfb; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f141b; --surface: #171e28; --surface-2: #1d2531; --text: #e6ebf2; --muted: #93a1b5; --line: #2a3442;
  --brand: #0b1220; --brand-text: #e6ebf2; --accent: #5aa0ff; --accent-text: #0b1220; --accent-soft: #1b2b44;
  --ok: #4cc38a; --ok-soft: #173326; --warn: #f0b14a; --warn-soft: #3a2c12; --bad: #ff7b7b; --bad-soft: #3d1a1a;
  --info: #a3a3ff; --info-soft: #25254a; --shadow: 0 1px 3px rgba(0,0,0,.4);
  color-scheme: dark;
}
[data-theme="ocean"] { --bg:#eef6f7; --brand:#0d4f5c; --accent:#0e8a9a; --accent-soft:#dff2f4; --line:#d6e6e9; }
[data-theme="forest"] { --bg:#f1f5f0; --brand:#1f4730; --accent:#2e8b57; --accent-soft:#e2f2e8; --line:#dce6dc; }
[data-theme="sunset"] { --bg:#fbf4ef; --brand:#6b2d1a; --accent:#d9622b; --accent-soft:#fbe9df; --line:#efe1d8; }
[data-theme="slate"] { --bg:#f2f2f6; --brand:#2e2a47; --accent:#6c5ce7; --accent-soft:#ecebfc; --line:#e2e1ec; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: var(--brand-text); display: flex; align-items: center; gap: 14px; padding: 0 18px; height: 58px; box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; color: var(--brand-text); }
.brand img { height: 32px; max-width: 120px; object-fit: contain; border-radius: 4px; }
.brand .mark { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-weight: 700; color: #fff; }
.brand small { display: block; font-weight: 400; opacity: .75; font-size: 11px; letter-spacing: .3px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--brand-text); opacity: .78; padding: 8px 12px; border-radius: 7px; white-space: nowrap; display: flex; align-items: center; gap: 6px; font-size: 14px; }
.nav a:hover { opacity: 1; background: rgba(255,255,255,.08); }
.nav a.active { opacity: 1; background: rgba(255,255,255,.15); }
.nav svg { width: 17px; height: 17px; flex: none; }
.badge { background: #ff5a5a; color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 700; line-height: 17px; min-width: 17px; text-align: center; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; background: transparent; border: 0; color: var(--brand-text); width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .badge { position: absolute; top: 3px; right: 1px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }

/* ---------- layout ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 22px 18px 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
main > * + * { margin-top: 16px; }
main > .page-head + * { margin-top: 0; }
.grid > .card + .card, .grid > .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side { grid-template-columns: 2fr 1fr; align-items: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---------- balance cards ---------- */
.balances { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.bal { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); border-top: 4px solid var(--c, var(--accent)); }
.bal .top { display: flex; justify-content: space-between; align-items: baseline; }
.bal .name { font-weight: 600; }
.bal .code { font-size: 12px; color: var(--muted); }
.bal .big { font-size: 36px; font-weight: 700; line-height: 1.1; margin: 10px 0 2px; color: var(--c, var(--accent)); }
.bal .big.neg { color: var(--bad); }
.bal .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.bal dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 14px 0 0; font-size: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.bal dt { color: var(--muted); }
.bal dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.meter { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 4px; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; min-height: 38px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--surface); border-color: var(--bad); color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.link { border: 0; background: transparent; color: var(--accent); padding: 4px 6px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
label.field { display: block; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
label.field > span em { color: var(--bad); font-style: normal; }
input[type=text], input[type=email], input[type=date], input[type=number], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 9px 11px; min-height: 40px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 8px 14px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-text); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

/* ---------- status chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.pending { background: var(--warn-soft); color: var(--warn); }
.chip.approved { background: var(--ok-soft); color: var(--ok); }
.chip.rejected { background: var(--bad-soft); color: var(--bad); }
.chip.withdrawn, .chip.cancelled, .chip.disabled { background: var(--surface-2); color: var(--muted); }
.chip.cancel_requested { background: var(--info-soft); color: var(--info); }
.chip.type { background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.chip.level { background: var(--accent-soft); color: var(--accent); }

/* ---------- lists & tables ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.req { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--surface); }
.req + .req { margin-top: 12px; }
.req .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.req .who { font-weight: 600; }
.req .dates { font-weight: 600; }
.req .reason { margin-top: 8px; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; font-size: 14px; white-space: pre-wrap; }
.req .meta { font-size: 13px; color: var(--muted); margin-top: 8px; }
.req .actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty svg { width: 40px; height: 40px; opacity: .4; display: block; margin: 0 auto 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .badge { background: var(--accent); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.notice { border-radius: 9px; padding: 10px 14px; font-size: 14px; background: var(--accent-soft); color: var(--text); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.hol { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hol:last-child { border-bottom: 0; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.swatch { border: 2px solid var(--line); border-radius: 10px; padding: 8px; cursor: pointer; background: var(--surface); text-align: center; font-size: 13px; }
.swatch.on { border-color: var(--accent); }
.swatch .bar { height: 26px; border-radius: 6px; display: flex; overflow: hidden; margin-bottom: 6px; }
.swatch .bar i { flex: 1; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand) 0%, var(--brand) 38%, var(--bg) 38.1%); }
.login { width: 100%; max-width: 400px; background: var(--surface); border-radius: 14px; padding: 30px 28px; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.login .logo { text-align: center; margin-bottom: 18px; }
.login .logo img { max-height: 70px; max-width: 220px; }
.login .logo .mark { width: 56px; height: 56px; font-size: 24px; margin: 0 auto; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.login h1 { text-align: center; font-size: 20px; }
.login p { text-align: center; }
.code-input { letter-spacing: 10px; font-size: 24px !important; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- modal & toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,15,25,.45); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { max-width: 760px; }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 16px; display: flex; align-items: center; }
.modal .body { padding: 18px 20px; }
.modal footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw; animation: up .18s; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.panel { position: fixed; top: 62px; right: 14px; width: 360px; max-width: calc(100vw - 28px); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.2); z-index: 40; }
.panel .item { padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.panel .item.unread { background: var(--accent-soft); }
.panel .item:hover { background: var(--surface-2); }
.menu .item { display: flex; gap: 8px; align-items: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  .grid.two, .grid.side, .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand .txt { display: none; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); z-index: 30; gap: 0; }
  .nav a { flex-direction: column; color: var(--muted); opacity: 1; font-size: 10.5px; gap: 2px; padding: 6px 6px; flex: 1; min-width: 56px; position: relative; }
  .nav a.active { color: var(--accent); background: transparent; }
  .nav a .badge { position: absolute; top: 2px; right: 8px; }
  .nav svg { width: 21px; height: 21px; }
  .nav a.wide-only { display: none; }
  .topbar .spacer-m { flex: 1; }
  main { padding: 16px 12px 100px; }
  .bal .big { font-size: 30px; }
  table.list.responsive thead { display: none; }
  table.list.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.list.responsive td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 4px 6px; text-align: right; }
  table.list.responsive td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; }
  table.list.responsive td.num { text-align: right; }
}
@media (min-width: 861px) { .topbar .spacer-m { display: none; } }
@media print { .topbar, .nav, .btn { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }
