:root {
  --bg: #f4f5f7; --surface: #fff; --ink: #14181f; --muted: #667085; --line: #e3e6eb;
  --navy: #0f1e33; --navy-2: #182b47; --accent: #1f6feb; --accent-soft: #e8f0fe;
  --ok: #1a7f4b; --warn: #b54708; --bad: #b42318; --radius: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; width: 100%; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label { display: grid; gap: 4px; color: var(--muted); font-size: 12px; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 15px; margin: 18px 0 8px; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.danger { color: var(--bad); }
.link { background: none; border: 0; color: inherit; padding: 0; text-decoration: underline; opacity: .8; }

.brand { font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.brand span { font-weight: 400; opacity: .7; }

.login { min-height: 100vh; display: grid; place-items: center; background: var(--navy); }
.login-card { background: #fff; padding: 32px; border-radius: 14px; width: min(380px, 92vw); display: grid; gap: 14px; }
.error { color: var(--bad); min-height: 18px; margin: 0; }

.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #dfe6f0; padding: 20px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.side .tenant { font-size: 12px; opacity: .6; margin-bottom: 16px; }
.side nav { display: grid; gap: 2px; }
.side nav a { color: inherit; text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.side nav a.active, .side nav a:hover { background: var(--navy-2); color: #fff; }
.side nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; opacity: .5; margin: 14px 10px 4px; }
.side-foot { margin-top: auto; font-size: 12px; display: grid; gap: 4px; padding: 0 10px; }

main { padding: 20px 24px; min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 6px 12px; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }

.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { background: #eceef2; border-radius: var(--radius); width: 260px; flex: 0 0 260px; display: flex; flex-direction: column; max-height: calc(100vh - 120px); }
.col-head { padding: 10px 12px; display: flex; justify-content: space-between; gap: 6px; font-weight: 600; font-size: 13px; }
.col-head small { font-weight: 400; color: var(--muted); }
.col.won .col-head { color: var(--ok); }
.col.lost .col-head { color: var(--bad); }
.col-body { padding: 0 8px 8px; overflow-y: auto; display: grid; gap: 8px; min-height: 60px; }
.col.drop .col-body { outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: 8px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: grab; display: grid; gap: 4px; }
.card:hover { border-color: #c5cbd5; }
.card .t { font-weight: 600; }
.card .m { color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: #fef0c7; color: var(--warn); }
.badge.bad { background: #fee4e2; color: var(--bad); }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; color: var(--muted); font-weight: 500; background: #fafbfc; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #f7f9fc; }

.drawer { position: fixed; inset: 0; z-index: 20; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(15, 30, 51, .35); }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(640px, 100vw); background: var(--bg); overflow-y: auto; padding: 20px 24px; box-shadow: -8px 0 24px rgba(0,0,0,.12); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.sub { color: var(--muted); font-size: 12px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.check input { width: auto; }
.feed { display: grid; gap: 8px; }
.feed .item { font-size: 13px; border-left: 3px solid var(--line); padding-left: 10px; }
.feed .item.system { color: var(--muted); }
.feed .item .when { font-size: 11px; color: var(--muted); }
.tasklist { display: grid; gap: 6px; }
.task { display: flex; gap: 8px; align-items: center; }
.task .due { margin-left: auto; font-size: 12px; color: var(--muted); }
.task .due.over { color: var(--bad); font-weight: 600; }
.missing { background: #fef0c7; border: 1px solid #fedf89; color: var(--warn); padding: 10px 12px; border-radius: 8px; margin-top: 12px; }

.modal { position: fixed; inset: 0; background: rgba(15, 30, 51, .35); display: grid; place-items: center; z-index: 30; }
.modal-card { background: #fff; border-radius: 14px; padding: 22px; width: min(560px, 94vw); display: grid; gap: 12px; max-height: 92vh; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 40; max-width: 90vw; }
.toast.bad { background: var(--bad); }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side nav { display: flex; flex-wrap: wrap; }
  .side nav .group, .side .tenant { display: none; }
  .side-foot { margin: 0 0 0 auto; }
  main { padding: 14px; }
  .grid2 { grid-template-columns: 1fr; }
}
label.miss { color: var(--warn); font-weight: 600; }
label.miss input, label.miss select { border-color: #fdb022; background: #fffaeb; }
