:root {
  --brand: #0f3d63;
  --brand-2: #1b5c8f;
  --accent: #f59e0b;
  --bg: #f3f6fa;
  --card: #ffffff;
  --ink: #0f2233;
  --ink-2: #4a5d70;
  --ink-3: #8a9aab;
  --line: #e3e9f0;
  --line-2: #eef2f6;
  --ok: #16a34a;
  --ok-bg: #e8f7ee;
  --warn: #b45309;
  --warn-bg: #fff4de;
  --bad: #dc2626;
  --bad-bg: #fdecec;
  --info: #2563eb;
  --info-bg: #e8f0fe;
  --muted-bg: #eef2f6;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 34, 51, .06), 0 4px 14px rgba(15, 34, 51, .05);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
small, .muted { color: var(--ink-3); }
.hidden { display: none !important; }
code, .mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 12px; }

/* ------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 80%, #000)); color: #dbe7f2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brandbox { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brandbox img { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.brandbox .logo-fallback { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.brandbox b { display: block; color: #fff; font-size: 14px; letter-spacing: .04em; }
.brandbox span { font-size: 11px; opacity: .7; }
.nav { padding: 10px; flex: 1; overflow-y: auto; }
.nav .grp { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; opacity: .5; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; color: #dbe7f2; padding: 9px 12px; border-radius: 9px; font-weight: 500; margin-bottom: 2px; text-decoration: none; }
.nav a:hover { background: rgba(255,255,255,.07); }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav a .ico { width: 18px; text-align: center; opacity: .85; }
.nav a .cnt { margin-left: auto; background: var(--accent); color: #111; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.sidebar .me { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.sidebar .me b { color: #fff; display: block; font-size: 13px; }
.sidebar .me .btn { margin-top: 10px; width: 100%; background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.18); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 16px 28px; background: var(--bg); position: sticky; top: 0; z-index: 5; border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); background: rgba(243,246,250,.92); backdrop-filter: blur(6px); }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title p { margin: 3px 0 0; color: var(--ink-2); font-size: 13px; }
.content { padding: 4px 28px 40px; }
.btn.menu-toggle { display: none; }

/* ------------------------------------------------------------- komponen */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h2 { flex: 1; }
.grid { display: grid; gap: 16px; }
.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)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.sp { flex: 1; }
.stack > * + * { margin-top: 10px; }
.mt { margin-top: 16px; }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.kpi .val { font-size: 26px; font-weight: 750; margin-top: 4px; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.kpi.bad .val { color: var(--bad); }
.kpi.warn .val { color: var(--warn); }
.kpi.ok .val { color: var(--ok); }
.kpi a.stretch { position: absolute; inset: 0; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 9px; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: #c7d3df; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #111; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f3c2c2; }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--muted-bg); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 650; background: var(--muted-bg); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.brand { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f8fafc; }
.tbl-wrap { overflow-x: auto; }

label.f { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 12px; }
label.f > span { display: block; margin-bottom: 5px; }
label.f small { font-weight: 400; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); border-color: var(--brand-2); }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { padding: 2px; height: 38px; }
.chk { display: flex; gap: 8px; align-items: center; font-weight: 500; color: var(--ink); margin-bottom: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips label { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); padding: 5px 10px; border-radius: 99px; cursor: pointer; font-weight: 500; font-size: 12px; }
.chips label:has(input:checked) { background: color-mix(in srgb, var(--brand) 10%, #fff); border-color: var(--brand-2); color: var(--brand); }

.empty { text-align: center; color: var(--ink-3); padding: 28px 10px; }
.list-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; line-height: 1.55; }

.alert { padding: 10px 14px; border-radius: 10px; border: 1px solid; margin-bottom: 14px; font-size: 13px; }
.alert.warn { background: var(--warn-bg); border-color: #f6d9a3; color: #7a4a06; }
.alert.info { background: var(--info-bg); border-color: #c8dafc; color: #1e40af; }
.alert.bad { background: var(--bad-bg); border-color: #f6c7c7; color: #991b1b; }
.alert.ok { background: var(--ok-bg); border-color: #bfe7cd; color: #14532d; }

.progress { height: 6px; background: var(--muted-bg); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand-2); border-radius: 99px; }

/* pipeline alur task */
.flow { display: flex; gap: 0; align-items: stretch; overflow-x: auto; padding-bottom: 4px; }
.flow .step { flex: 1; min-width: 170px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; position: relative; }
.flow .arrow { display: grid; place-items: center; width: 26px; color: var(--ink-3); flex: none; }
.flow .step.selesai { border-color: #bfe7cd; background: #f6fcf8; }
.flow .step.dikerjakan, .flow .step.review { border-color: #c8dafc; background: #f7faff; }
.flow .step.revisi { border-color: #f6c7c7; background: #fff8f8; }
.flow .step.menunggu { opacity: .7; border-style: dashed; }

/* board kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eaf0f6; border-radius: 12px; padding: 10px; min-height: 200px; }
.col-h { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 4px 4px 10px; color: var(--ink-2); }
.col-h .sum { margin-left: auto; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink-3); }
.col.drop { outline: 2px dashed var(--brand-2); }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kcard:hover { border-color: #c7d3df; }
.kcard .t { font-weight: 600; margin-bottom: 4px; }
.kcard .m { font-size: 12px; color: var(--ink-2); }

/* kalender */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--line); gap: 1px; }
.cal .hd { background: #f8fafc; padding: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink-3); text-align: center; }
.cal .day { background: #fff; min-height: 116px; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.cal .day.other { background: #fafbfc; }
.cal .day.other .num { color: #c3ccd6; }
.cal .day.today .num { background: var(--brand); color: #fff; border-radius: 99px; }
.cal .day.drop { background: #eef5ff; }
.cal .num { font-size: 12px; font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; color: var(--ink-2); }
.cal .ev { font-size: 11px; padding: 3px 6px; border-radius: 6px; background: var(--muted-bg); border-left: 3px solid var(--ink-3); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev[draggable=true] { cursor: grab; }
.cal .ev.task { background: #fff; border: 1px dashed var(--line); border-left: 3px dashed var(--warn); }
.cal .ev.buf { background: #f4f0ff; border-left-color: #7c3aed; }
.cal .camp { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 22%, #fff); color: #7a4a06; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }

/* inbox */
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; gap: 14px; height: calc(100vh - 150px); min-height: 520px; }
.inbox > .card { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.inbox .ilist { overflow-y: auto; flex: 1; }
.inbox .iitem { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; text-decoration: none; color: inherit; }
.inbox .iitem:hover { background: #f8fafc; text-decoration: none; }
.inbox .iitem.active { background: color-mix(in srgb, var(--brand) 7%, #fff); box-shadow: inset 3px 0 0 var(--brand); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 12px; }
.avatar.wa { background: #16a34a; }
.avatar.ig { background: linear-gradient(135deg, #f59e0b, #db2777, #7c3aed); }
.avatar.manual { background: var(--ink-3); }
.chat { flex: 1; overflow-y: auto; padding: 16px; background: #f6f9fc; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 72%; padding: 9px 12px; border-radius: 12px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.bubble.in { background: #fff; border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.out { background: var(--brand); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.out.gagal { background: var(--bad-bg); color: var(--bad); border: 1px solid #f6c7c7; }
.bubble .meta { font-size: 10px; opacity: .65; margin-top: 4px; }
.composer { border-top: 1px solid var(--line); padding: 12px; background: #fff; }
.suggest { border: 1px solid #c8dafc; background: #f5f9ff; border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.suggest .hd { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: #1e40af; margin-bottom: 6px; }
.suggest textarea { background: #fff; min-height: 70px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 25%, transparent), transparent), linear-gradient(160deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #000)); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-card h1 { font-size: 20px; margin-top: 14px; }
.login-card p { color: var(--ink-2); margin: 6px 0 20px; }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 34, 51, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 620px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.modal.wide { max-width: 880px; }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-h h2 { flex: 1; }
.modal-b { padding: 18px 20px; overflow-y: auto; }
.modal-f { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; font-size: 13px; animation: tin .2s ease; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

.notif-pop { position: absolute; right: 28px; top: 62px; width: 360px; max-height: 460px; overflow-y: auto; z-index: 30; padding: 6px 0; }
.notif-pop .n { padding: 10px 16px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.notif-pop .n.unread { background: #f5f9ff; }
.notif-pop .n:hover { background: #f1f5f9; }
.bell { position: relative; }
.bell .cnt { position: absolute; top: -5px; right: -5px; background: var(--bad); color: #fff; font-size: 10px; border-radius: 99px; padding: 1px 5px; font-weight: 700; }

.brief-box dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; margin-top: 12px; }
.brief-box dd { margin: 4px 0 0; white-space: pre-wrap; line-height: 1.55; }
.diff-add { background: #e8f7ee; }
.diff-del { background: #fdecec; text-decoration: line-through; }
.thumb { width: 100%; max-height: 260px; object-fit: contain; background: #f4f6f8; border-radius: 8px; border: 1px solid var(--line); }
.bar-row { display: grid; grid-template-columns: 130px 1fr 60px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side, .g3 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 280px minmax(0, 1fr); }
  .inbox > .card:last-child { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 240px; z-index: 40; transition: left .2s; }
  .sidebar.open { left: 0; }
  .btn.menu-toggle { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .g2, .g4 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .cal .day { min-height: 70px; }
  .notif-pop { right: 10px; left: 10px; width: auto; }
}

.cal .more { font-size: 11px; color: var(--ink-3); padding-left: 4px; }
.cal-camps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }


/* ---- Kanban (v1.2) ---- */
.kb-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kb-col { flex: 0 0 270px; background: #eef1f6; border-radius: 12px; padding: 10px; transition: background .15s; }
.kb-col.over { background: color-mix(in srgb, var(--brand) 12%, #eef1f6); outline: 2px dashed var(--brand-2, var(--brand)); }
.kb-col > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kb-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.kb-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; box-shadow: 0 1px 2px rgba(15,23,42,.06); display: flex; flex-direction: column; gap: 6px; }
.kb-card:hover { border-color: var(--brand-2, var(--brand)); }
.kb-card.late { border-left: 3px solid var(--bad); }
.kb-card.drag { opacity: .5; }
.kb-title { font-weight: 650; line-height: 1.3; }
.kb-meta, .kb-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.kb-foot .sp { flex: 1; }
.kb-labels { display: flex; gap: 4px; flex-wrap: wrap; }
.kb-labels i { font-style: normal; color: #fff; font-size: 10.5px; font-weight: 650; padding: 1px 8px; border-radius: 99px; }
.kb-empty { color: var(--ink-3); font-size: 12px; text-align: center; padding: 10px 0; }
.chk-item { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.chk-item.done span { text-decoration: line-through; color: var(--ink-3); }
.chk-item span { flex: 1; }
