/* Top Ridge ERP — "Banyan & Marigold" design system */
:root {
  --ink: #1B2A24;
  --ink-2: #3B4A44;
  --muted: #64746D;
  --line: #DCE4DF;
  --line-soft: #EBF0ED;
  --chalk: #F4F6F3;
  --paper: #FFFFFF;
  --sidebar: #FAFBFA;
  --banyan: #0E6B52;
  --banyan-deep: #0A4F3D;
  --banyan-soft: #E2F0EA;
  --banyan-tint: #F0F7F3;
  --marigold: #F2B01E;
  --marigold-deep: #C98D0A;
  --marigold-soft: #FDF2D2;
  --coral: #D24B3F;
  --coral-soft: #FBE5E2;
  --sky: #2F6FB5;
  --sky-soft: #E4EEF9;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(27,42,36,.06), 0 8px 24px -12px rgba(27,42,36,.18);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sidebar-w: 264px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--chalk); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }
a { color: var(--banyan); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid rgba(242,176,30,.55); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Login ─────────────────────────────────────────────── */
#app { min-height: 100vh; }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { background: var(--banyan-deep); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-hero svg.sun { position: absolute; right: -140px; bottom: -200px; width: 640px; height: 640px; opacity: .9; pointer-events: none; }
.login-hero .brand { display: flex; align-items: center; gap: 14px; font-weight: 800; font-size: 20px; }
.login-hero .brand img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 12px; padding: 4px; }
.login-hero h1 { font-size: clamp(34px, 4.2vw, 54px); font-weight: 800; line-height: 1.08; max-width: 13ch; position: relative; margin: 40px 0; }
.login-hero h1 span { display: block; color: var(--marigold); }
.login-hero .foot { font-size: 14px; opacity: .8; position: relative; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 24px; margin-bottom: 6px; }
.login-card .lead { color: var(--muted); margin-bottom: 28px; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 24px 48px; min-height: 260px; }
  .login-hero svg.sun { width: 420px; height: 420px; right: -160px; bottom: -220px; }
}

/* ── App shell ────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 18px; }
.sidebar .brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); padding: 3px; }
.sidebar .brand b { display: block; font-size: 15px; font-weight: 800; }
.sidebar .brand small { color: var(--muted); font-size: 12px; }
.nav-group { margin-top: 10px; }
.nav-group > span { display: block; padding: 4px 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 1px 0; border-radius: 10px; color: var(--ink-2); font-weight: 500; position: relative; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav a:hover { background: var(--banyan-tint); color: var(--banyan-deep); }
.nav a.active { background: var(--banyan-soft); color: var(--banyan-deep); font-weight: 700; }
.nav a.active::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 4px; border-radius: 4px; background: var(--marigold); }
.nav a.active svg { opacity: 1; }
.sidebar .me { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 10px; }
.sidebar .me .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--banyan); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.sidebar .me div { flex: 1; min-width: 0; }
.sidebar .me b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .me small { color: var(--muted); font-size: 12px; }
.sidebar .me button { border: 0; background: none; color: var(--muted); padding: 6px; border-radius: 8px; }
.sidebar .me button:hover { background: var(--coral-soft); color: var(--coral); }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 18px 32px 0; }
.topbar .burger { display: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 40px; height: 40px; }
.topbar h1 { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--banyan-soft); color: var(--banyan-deep); }
.chip.gold { background: var(--marigold-soft); color: var(--marigold-deep); }
.chip.red { background: var(--coral-soft); color: var(--coral); }
.chip.grey { background: var(--line-soft); color: var(--ink-2); }
.chip.blue { background: var(--sky-soft); color: var(--sky); }
.content { padding: 20px 32px 48px; }
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s; z-index: 40; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(27,42,36,.35); z-index: 30; }
  .topbar .burger { display: block; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}

/* ── Buttons & forms ─────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: 9px 16px; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink); transition: background .12s, border-color .12s; }
.btn:hover { background: var(--chalk); }
.btn.primary { background: var(--banyan); border-color: var(--banyan); color: #fff; }
.btn.primary:hover { background: var(--banyan-deep); }
.btn.gold { background: var(--marigold); border-color: var(--marigold); color: var(--ink); }
.btn.danger { color: var(--coral); border-color: var(--coral-soft); background: #fff; }
.btn.danger:hover { background: var(--coral-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--banyan); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn svg { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--muted); }
.input, .field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: border-color .12s, box-shadow .12s; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--banyan); box-shadow: 0 0 0 3px var(--banyan-soft); }
.field textarea { min-height: 88px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 16px; height: 16px; accent-color: var(--banyan); }
.form-error { background: var(--coral-soft); color: var(--coral); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; }

/* ── Panels, tables ──────────────────────────────────── */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { flex: 1; }
.panel-body { padding: 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar .input { max-width: 300px; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr:hover td { background: var(--banyan-tint); }
table.grid td.actions { text-align: right; white-space: nowrap; }
table.grid .ib { border: 0; background: none; padding: 6px; border-radius: 8px; color: var(--muted); }
table.grid .ib:hover { background: var(--banyan-soft); color: var(--banyan-deep); }
table.grid .ib.del:hover { background: var(--coral-soft); color: var(--coral); }
table.grid .ib svg { width: 16px; height: 16px; display: block; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--banyan-deep); border-color: var(--marigold); }

/* ── Dashboard ───────────────────────────────────────── */
.today { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.today .date { color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; margin-bottom: 18px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; grid-column: span 3; min-height: 128px; display: flex; flex-direction: column; }
.tile .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .big { font-size: 34px; font-weight: 800; line-height: 1.1; margin-top: 8px; letter-spacing: -.02em; }
.tile .sub { margin-top: auto; font-size: 13px; color: var(--muted); padding-top: 10px; }
.tile.hero { grid-column: span 6; background: var(--banyan-deep); color: #fff; border-color: var(--banyan-deep); flex-direction: row; align-items: center; gap: 22px; }
.tile.hero .label, .tile.hero .sub { color: rgba(255,255,255,.75); }
.tile.hero .ring { width: 92px; height: 92px; flex: none; }
.tile.hero .ring text { fill: #fff; font-weight: 800; font-size: 20px; }
.tile.gold { border-left: 5px solid var(--marigold); }
.tile:nth-child(n+4) { grid-column: span 4; }
@media (max-width: 1100px) { .tile, .tile:nth-child(n+4) { grid-column: span 6; } .tile.hero { grid-column: span 12; } }
@media (max-width: 560px) { .tile, .tile:nth-child(n+4) { grid-column: span 12; } .today { flex-direction: column; gap: 2px; } }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 960px) { .cols { grid-template-columns: 1fr; } }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: 90px 1fr 60px; align-items: center; gap: 12px; font-size: 14px; }
.bar .track { height: 10px; background: var(--line-soft); border-radius: 6px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--banyan); border-radius: 6px; }
.bar .n { text-align: right; color: var(--muted); }
.list { display: flex; flex-direction: column; }
.list > div { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.list > div:last-child { border-bottom: 0; }
.list .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--marigold); flex: none; }
.list b { font-weight: 600; }
.attention { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Modal, toast ────────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(27,42,36,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; padding: 18px 22px 10px; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 8px 22px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); max-width: 360px; }
.toast.error { background: var(--coral); }
.toast.success { background: var(--banyan); }

/* ── Placeholder module ──────────────────────────────── */
.soon { max-width: 640px; }
.soon .panel-body p { margin-bottom: 10px; }
.perm-grid th, .perm-grid td { text-align: center; }
.perm-grid td:first-child, .perm-grid th:first-child { text-align: left; }
