:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #16202b;
  --muted: #6b7480;
  --line: #e4e2dc;
  --accent: #14273d;
  --accent-ink: #ffffff;
  --soft: #eef1f4;
  --warn: #b4531c;
  --warn-bg: #fbeee4;
  --ok: #2f6b4f;
  --ok-bg: #e5f1ea;
  --radius: 10px;
  --shadow: 0 10px 40px rgba(20, 30, 45, 0.14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #191d22;
    --ink: #e8e9ea;
    --muted: #8d949c;
    --line: #2a2f36;
    --accent: #c9d6e3;
    --accent-ink: #111418;
    --soft: #20262d;
    --warn: #f0a070;
    --warn-bg: #3a2519;
    --ok: #86c7a3;
    --ok-bg: #1b3026;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.muted { color: var(--muted); }
.pad { padding: 24px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.mono {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 12px; letter-spacing: 0.04em;
}
.brand-name { font-weight: 600; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button {
  position: relative;
  border: 0; background: none; padding: 7px 12px; border-radius: 8px;
  color: var(--muted); cursor: pointer;
}
.tabs button.active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.dot { position: absolute; top: 6px; right: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.sync { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.sync.bad { background: var(--warn); }

main { max-width: 1080px; margin: 0 auto; padding: 24px; }
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; }
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h1 { font-size: 22px; font-weight: 600; margin: 0; flex: 1; letter-spacing: -0.01em; }

/* Buttons & inputs */
.btn {
  border: 1px solid var(--line); background: var(--surface);
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line); background: var(--surface);
  padding: 8px 10px; border-radius: 8px;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 0; border-color: var(--accent); }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.field { margin-bottom: 12px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Today */
.today-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 8px;
}
.panel.wide { grid-column: 1 / -1; }
.item { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 500; cursor: pointer; }
.item .title:hover { text-decoration: underline; }
.item .sub { color: var(--muted); font-size: 13px; }
.date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.date.late { color: var(--warn); font-weight: 500; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0 12px; }

/* Firms */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 99px;
  padding: 4px 11px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .n { opacity: 0.7; margin-left: 4px; }
.search { max-width: 280px; }
.table { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tr { display: grid; grid-template-columns: 2.2fr 1.6fr 1.2fr 1.1fr 0.5fr 0.9fr; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); align-items: center; cursor: pointer; }
.tr:first-child { border-top: 0; }
.tr:hover:not(.th) { background: var(--soft); }
.tr.th { cursor: default; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; background: var(--soft); }
.tr .name { font-weight: 500; }
.tr .cell-muted { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score { font-variant-numeric: tabular-nums; font-weight: 600; }
.score.hi { color: var(--ok); }
.stage {
  display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px;
  background: var(--soft); color: var(--ink); white-space: nowrap;
}
.stage.won { background: var(--ok-bg); color: var(--ok); }
.stage.lost { color: var(--muted); }
.stage.hot { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }

/* Jobs */
.job { display: grid; grid-template-columns: 1.4fr 2fr 0.8fr 0.8fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.job:first-of-type { border-top: 0; }
.who { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--soft); white-space: nowrap; justify-self: start; }
.who.me { background: var(--warn-bg); color: var(--warn); }
.done { opacity: 0.55; }

/* Feed */
.feed-item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.feed-item:first-child { border-top: 0; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--soft); flex: none; }
.avatar.a-Erbil { background: var(--accent); color: var(--accent-ink); }
.feed-time { color: var(--muted); font-size: 12px; }

/* Drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(10, 15, 22, 0.35); z-index: 9; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 10;
  width: min(620px, 100%); overflow-y: auto;
  background: var(--bg); box-shadow: var(--shadow);
  padding: 22px 24px 60px;
}
.drawer-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.drawer-head h1 { font-size: 21px; margin: 0; flex: 1; letter-spacing: -0.01em; }
.drawer-head .site { font-size: 13px; color: var(--muted); display: block; margin-top: 3px; }
.section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.section-head { display: flex; align-items: center; margin-bottom: 10px; }
.section-head h2 { flex: 1; margin: 0; }
.note-card { border-top: 1px solid var(--line); padding: 10px 0; font-size: 14px; }
.note-card:first-of-type { border-top: 0; padding-top: 0; }
.note-card dl { display: grid; grid-template-columns: 120px 1fr; gap: 3px 10px; margin: 0; }
.note-card dt { color: var(--muted); font-size: 13px; }
.note-card dd { margin: 0; white-space: pre-wrap; }
.note-meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.note-meta .btn { margin-left: auto; }
.info-line { font-size: 13px; color: var(--muted); margin: 0 0 12px; white-space: pre-wrap; }
.form-box { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 12px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  font-size: 14px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* Mobile */
@media (max-width: 760px) {
  .top { padding: 10px 16px; gap: 10px; flex-wrap: wrap; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
  .me { margin-left: auto; }
  main { padding: 16px; }
  .today-grid { grid-template-columns: 1fr; }
  .grid2, .grid4 { grid-template-columns: 1fr 1fr; }
  .tr.th { display: none; }
  .tr { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .tr .hide-m { display: none; }
  .job { grid-template-columns: 1fr auto; }
  .job .hide-m { display: none; }
  .drawer { padding: 18px 16px 60px; }
  .note-card dl { grid-template-columns: 1fr; }
  .note-card dt { margin-top: 4px; }
  .search { max-width: none; }
}
