/* ─── Design Tokens (Apple-inspired Monochrome) ──────────── */
:root {
  --bg:           #ffffff;
  --bg-secondary: #fafafa;
  --surface:      #ffffff;
  --surface-2:    #f5f5f7;
  --surface-3:    #e8e8ed;

  --border:       #e5e5e5;
  --border-2:     #d2d2d7;

  --text:         #1d1d1f;
  --text-sub:     #6e6e73;
  --text-muted:   #86868b;

  --accent:       #1d1d1f;
  --accent-bright: #000000;
  --accent-dim:   rgba(0,0,0,.04);
  --accent-glow:  rgba(0,0,0,.08);

  --red:          #ff3b30;
  --red-dim:      rgba(255,59,48,.06);
  --orange:       #ff9500;
  --orange-dim:   rgba(255,149,0,.06);
  --amber:        #ff9f0a;
  --amber-dim:    rgba(255,159,10,.06);
  --yellow:       #ffcc00;
  --yellow-dim:   rgba(255,204,0,.06);
  --green:        #34c759;
  --green-dim:    rgba(52,199,89,.06);
  --blue:         #007aff;
  --blue-dim:     rgba(0,122,255,.06);
  --grey:         #8e8e93;
  --grey-dim:     rgba(142,142,147,.08);

  /* customer palette (muted monochrome-friendly) */
  --c0: #1d1d1f; --c0d: rgba(0,0,0,.04);
  --c1: #6e6e73; --c1d: rgba(0,0,0,.04);
  --c2: #86868b; --c2d: rgba(0,0,0,.04);
  --c3: #48484a; --c3d: rgba(0,0,0,.04);
  --c4: #3a3a3c; --c4d: rgba(0,0,0,.04);
  --c5: #636366; --c5d: rgba(0,0,0,.04);

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;

  --shadow:    0 1px 3px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.08);
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "SF Pro Text", "SF Pro Display", system-ui, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  letter-spacing: .01em;
}

a { color: inherit; text-decoration: none; }

/* ─── Layout ─────────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.brand-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
  color: var(--text);
}

.sidebar-nav {
  display: flex; flex-direction: column;
  padding: 12px 10px;
  flex: 1;
  gap: 1px;
}

.sidebar-nav-group {
  display: flex; flex-direction: column; gap: 1px;
}

.sidebar-nav-label {
  font-size: 10px; font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .08em; text-transform: uppercase;
  padding: 14px 10px 6px;
}

.sidebar-nav-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 2px;
}

.sidebar-nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  white-space: nowrap;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.sidebar-nav a.active {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 600;
}

.sidebar-nav a svg {
  flex-shrink: 0;
  opacity: .5;
}

.sidebar-nav a:hover svg,
.sidebar-nav a.active svg {
  opacity: 1;
}

.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red-dim); border: 1px solid rgba(255,59,48,.2);
  border-radius: 20px;
  font-size: 11px; font-weight: 700; color: var(--red);
  margin-left: auto;
  animation: badge-pulse 2.5s ease-in-out infinite;
}
@keyframes badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
  margin-left: 220px;
  min-height: 100vh;
}

/* ─── Page Header ────────────────────────────────────────── */
.page-header {
  display: flex; align-items: baseline; gap: 16px;
  padding: 28px 0 22px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 22px; font-weight: 700;
  color: var(--text); letter-spacing: -.02em;
}

.page-desc {
  font-size: 12px; color: var(--text-muted);
  margin-top: 4px; line-height: 1.5;
}

/* ─── Filter Bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; flex-wrap: wrap;
}

.filter-bar .count-label {
  font-size: 12px; color: var(--text-muted);
  margin-left: auto;
}

/* ─── Inputs & Controls ──────────────────────────────────── */
input, select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

input:focus, select:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}
input::placeholder { color: var(--text-muted); }

/* Compact controls for table cells */
.ctrl { padding: 5px 8px; font-size: 12px; border-radius: var(--radius-sm); }

button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
button:hover {
  background: var(--surface-2); border-color: var(--text-muted);
}
button:active { background: var(--surface-3); }

button.btn-sm { padding: 4px 10px; font-size: 12px; }
button.btn-ghost { background: transparent; border-color: var(--border-2); color: var(--text-sub); }
button.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
button.btn-danger { background: var(--red-dim); border-color: transparent; color: var(--red); }
button.btn-danger:hover { background: rgba(255,59,48,.12); border-color: var(--red); }

.toggle-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-sub);
  cursor: pointer; user-select: none;
  padding: 6px 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, color .15s;
}
.toggle-label:hover { color: var(--text); border-color: var(--text-muted); }
.toggle-label input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--text); }

/* Filter select */
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.filter-select:focus { border-color: var(--text); color: var(--text); }

/* ─── Status Chip (styled select) ────────────────────────── */
.status-select {
  appearance: none; -webkit-appearance: none;
  padding: 4px 12px;
  font-size: 12px; font-weight: 600;
  border-radius: 20px;
  border: 1px solid transparent;
  cursor: pointer;
  min-width: 80px;
  text-align: center;
  background-image: none;
  transition: opacity .15s;
}
.status-select:hover { opacity: .85; }

.status-select.s-not_started {
  background: var(--surface-2); color: var(--text-muted);
  border-color: var(--border-2);
}
.status-select.s-in_progress {
  background: var(--blue-dim); color: var(--blue);
  border-color: rgba(0,122,255,.2);
}
.status-select.s-requesting {
  background: var(--orange-dim); color: #c77800;
  border-color: rgba(255,149,0,.2);
}
.status-select.s-reviewing {
  background: var(--green-dim); color: #248a3d;
  border-color: rgba(52,199,89,.2);
}
.status-select.s-waiting {
  background: var(--orange-dim); color: #c77800;
  border-color: rgba(255,149,0,.2);
}
.status-select.s-done {
  background: var(--grey-dim); color: var(--grey);
  border-color: rgba(142,142,147,.2);
}

/* ─── Date Chip ──────────────────────────────────────────── */
.date-input { min-width: 118px; }

.date-overdue { color: var(--red) !important; }

/* ─── Task Table ─────────────────────────────────────────── */
.task-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.task-table thead tr {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.task-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px; font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .06em; text-transform: uppercase;
  white-space: nowrap;
}

.task-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  line-height: 1.6;
}

.task-table tbody tr:last-child td { border-bottom: none; }

.task-table tbody tr {
  transition: background .12s;
  position: relative;
}
.task-table tbody tr:hover td { background: var(--bg-secondary); }

.task-table tbody tr.row-hidden { display: none; }

/* Overdue row — left border only */
.task-table tbody tr.row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }

/* Status-based row backgrounds */
.task-table tbody tr.row-status-in_progress td { background: var(--blue-dim); }
.task-table tbody tr.row-status-requesting td  { background: var(--orange-dim); }
.task-table tbody tr.row-status-reviewing td   { background: var(--green-dim); }
.task-table tbody tr.row-status-waiting td     { background: var(--orange-dim); }
.task-table tbody tr.row-status-in_progress:hover td { background: rgba(0,122,255,.08); }
.task-table tbody tr.row-status-requesting:hover td  { background: rgba(255,149,0,.08); }
.task-table tbody tr.row-status-reviewing:hover td   { background: rgba(52,199,89,.08); }
.task-table tbody tr.row-status-waiting:hover td     { background: rgba(255,149,0,.08); }

/* Done row */
.task-table tbody tr.row-done { opacity: .38; }

/* Customer dot */
.customer-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.customer-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.c0 { background: var(--c0); } .c0-text { color: var(--c0); }
.c1 { background: var(--c1); } .c1-text { color: var(--c1); }
.c2 { background: var(--c2); } .c2-text { color: var(--c2); }
.c3 { background: var(--c3); } .c3-text { color: var(--c3); }
.c4 { background: var(--c4); } .c4-text { color: var(--c4); }
.c5 { background: var(--c5); } .c5-text { color: var(--c5); }

.customer-name { font-size: 12px; font-weight: 600; }
.project-badge {
  display: inline-block;
  padding: 2px 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 10px; color: var(--text-muted);
  white-space: nowrap; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis;
}

.task-title-cell { font-size: 13px; color: var(--text); max-width: 340px; }

/* ─── Inline project select ──────────────────────────────── */
.project-select {
  font-size: 11px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  max-width: 160px;
  background: var(--surface);
  color: var(--text-sub);
  border-color: transparent;
}
.project-select:hover { border-color: var(--border-2); }
.project-select:focus { border-color: var(--text); color: var(--text); }

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px;
  padding: 64px 24px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.empty-state svg { opacity: .35; }
.empty-state p { font-size: 13px; }

/* ─── Card ───────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: border-color .2s ease;
}
.card:hover {
  border-color: var(--border-2);
}
.card h2 {
  font-size: 13px; font-weight: 700;
  color: var(--text); margin-bottom: 14px;
  letter-spacing: -.01em;
}
.card + .card { margin-top: 14px; }

/* ─── Masters Grid ───────────────────────────────────────── */
.masters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}
@media (max-width: 900px) { .masters-grid { grid-template-columns: 1fr; } }

.masters-section { display: flex; flex-direction: column; gap: 12px; }
.masters-section h2 {
  font-size: 13px; font-weight: 700; color: var(--text);
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: .3px; text-transform: uppercase; }

.entity-list { list-style: none; display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }

.edit-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: var(--radius-sm);
  transition: background .1s;
}
.edit-row:hover { background: var(--surface-2); }

.edit-label { font-size: 12px; color: var(--text-sub); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-input { font-size: 12px; flex: 1; padding: 4px 8px; min-width: 0; }

/* Alias table */
.alias-table { width: 100%; border-collapse: collapse; }
.alias-table td { padding: 6px 4px; font-size: 12px; border-bottom: 1px solid var(--border); color: var(--text-sub); }
.alias-table tr:last-child td { border-bottom: none; }
.alias-table .tag { font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-muted); }

/* ─── Import Cards ───────────────────────────────────────── */
.import-cards {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 20px;
}
@media (max-width: 700px) { .import-cards { grid-template-columns: 1fr; } }

.import-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.import-card h3 { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.import-card p { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.6; }
.import-row { display: flex; gap: 8px; align-items: center; }
.import-row input { flex: 1; font-size: 11px; padding: 5px 8px; }

/* ─── Inbox reason badge ─────────────────────────────────── */
.reason-badge {
  display: inline-block;
  padding: 2px 7px; border-radius: 4px;
  font-size: 10px; font-weight: 600;
  background: var(--orange-dim); color: var(--orange);
  border: 1px solid rgba(255,149,0,.15);
}
.reason-badge.both { background: var(--red-dim); color: var(--red); border-color: rgba(255,59,48,.15); }

/* ─── Overdue Banner ─────────────────────────────────── */
.overdue-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--red-dim);
  border: 1px solid rgba(255,59,48,.15);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 13px; color: var(--red);
}
.overdue-banner__text { flex: 1; }
.overdue-banner__btn {
  background: rgba(255,59,48,.08); border-color: rgba(255,59,48,.2);
  color: var(--red);
}
.overdue-banner__btn:hover { background: rgba(255,59,48,.14); }

/* ─── Due Today Banner ──────────────────────────────── */
.due-today-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--orange-dim);
  border: 1px solid rgba(255,149,0,.15);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 12px;
  font-size: 13px; color: var(--orange);
}
.due-today-banner__text { flex: 1; }
.due-today-banner__btn {
  background: rgba(255,149,0,.08); border-color: rgba(255,149,0,.2);
  color: var(--orange);
}
.due-today-banner__btn:hover { background: rgba(255,149,0,.14); }

/* ─── Date Badges ───────────────────────────────────── */
.badge-overdue {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  color: var(--red);
  background: var(--red-dim);
  border: 1px solid rgba(255,59,48,.15);
  border-radius: 4px;
  padding: 1px 6px;
  margin-top: 2px;
}
.badge-due-today {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  color: var(--orange);
  background: var(--orange-dim);
  border: 1px solid rgba(255,149,0,.15);
  border-radius: 4px;
  padding: 1px 6px;
  margin-top: 2px;
}
.badge-slot { display: block; min-height: 0; }

/* ─── Row Due Today ── */
.task-table tbody tr.row-due-today td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
.date-due-today { color: var(--orange) !important; font-weight: 600; }

/* ─── Tab Bar ────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 3px;
  margin-left: auto;
}
.tab {
  background: transparent; border: none; color: var(--text-muted);
  padding: 5px 14px; font-size: 12px; font-weight: 500;
  border-radius: 6px; cursor: pointer;
  transition: color .15s, background .15s;
}
.tab:hover { color: var(--text-sub); background: var(--surface-3); }
.tab.active {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ─── View Toggle ────────────────────────────────────── */
.view-toggle {
  display: flex; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 2px;
}
.view-btn {
  background: transparent; border: none; color: var(--text-muted);
  padding: 4px 10px; font-size: 12px;
  border-radius: 6px; cursor: pointer;
  transition: color .15s, background .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.view-btn:hover { color: var(--text-sub); background: var(--surface-3); }
.view-btn.active {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* ─── Date Cell ──────────────────────────────────────── */
.date-range-display {
  font-size: 12px; color: var(--text-sub);
  cursor: pointer; padding: 4px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  display: inline-block; white-space: nowrap;
  transition: border-color .12s, background .12s;
}
.date-range-display:hover,
.date-range-display.editing {
  border-color: var(--border-2); background: var(--surface-2);
}
.date-range-display.date-empty { color: var(--text-muted); font-style: italic; font-size: 11px; }
.date-range-display.date-overdue { color: var(--red); }

.date-edit-area {
  display: flex; flex-direction: column; gap: 5px;
  margin-top: 6px; padding: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.date-edit-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .4px;
}

/* ─── Notes ──────────────────────────────────────────── */
.notes-row { margin-top: 5px; }
.notes-add-btn {
  background: transparent; border: 1px dashed var(--border-2);
  color: var(--text-muted); padding: 3px 8px; font-size: 11px;
  border-radius: 4px; cursor: pointer;
  transition: color .12s, background .12s;
}
.notes-add-btn:hover { color: var(--text-sub); background: var(--surface-2); }
.notes-input {
  width: 100%; min-height: 52px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 12px; font-family: inherit; line-height: 1.6;
  padding: 6px 8px; resize: vertical;
  transition: border-color .15s;
}
.notes-input:focus { border-color: var(--text); outline: none; }
.notes-input::placeholder { color: var(--text-muted); }

/* ─── Kanban Board ───────────────────────────────────── */
.kanban-board {
  display: flex; gap: 14px; align-items: flex-start;
  overflow-x: auto; padding-bottom: 24px;
}
.kanban-col {
  flex: 0 0 240px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.kanban-col-count {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 7px; height: 18px;
  display: inline-flex; align-items: center;
}
.kanban-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 11px 13px;
  transition: border-color .12s, background .12s;
}
.kanban-card:hover { border-color: var(--border-2); background: var(--surface-3); }
.kanban-card.card-overdue { border-color: rgba(255,59,48,.2); }
.kanban-card-customer { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.kanban-card-title { font-size: 12px; color: var(--text); line-height: 1.5; margin-bottom: 7px; }
.kanban-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kanban-card-date { font-size: 10px; color: var(--text-muted); }
.kanban-card-date.date-overdue { color: var(--red); }

/* Status chip (kanban header labels) */
.status-chip {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; border: 1px solid transparent;
}
.status-chip.s-not_started { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.status-chip.s-requesting  { background: var(--orange-dim); color: #c77800; border-color: rgba(255,149,0,.2); }
.status-chip.s-in_progress { background: var(--blue-dim); color: var(--blue); border-color: rgba(0,122,255,.2); }
.status-chip.s-reviewing   { background: var(--green-dim); color: #248a3d; border-color: rgba(52,199,89,.2); }
.status-chip.s-waiting     { background: var(--orange-dim); color: #c77800; border-color: rgba(255,149,0,.2); }
.status-chip.s-done        { background: var(--grey-dim); color: var(--grey); border-color: rgba(142,142,147,.2); }

/* ─── Task ID badge ──────────────────────────────────────── */
.task-id-badge {
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 5px;
  user-select: all;
}

/* ─── Kanban D&D ─────────────────────────────────────────── */
.kanban-card { cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.card-dragging { opacity: 0.4; }
.kanban-cards.col-drag-over {
  background: var(--accent-dim);
  border-radius: var(--radius);
  outline: 2px dashed var(--text-muted);
  outline-offset: -2px;
}

/* ─── Alias panel ────────────────────────────────────────── */
.alias-expand-cell { padding: 0 !important; }
.alias-panel {
  padding: 10px 16px 12px 40px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.alias-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 24px; align-items: center; }
.alias-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 2px 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; font-size: 11px; color: var(--text-sub);
}
.alias-tag-del {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 0; font-size: 13px; line-height: 1;
  display: flex; align-items: center;
}
.alias-tag-del:hover { color: var(--red); }
.alias-empty { font-size: 11px; color: var(--text-muted); }
.alias-add-form { display: flex; gap: 6px; align-items: center; }
.alias-input { width: 220px; }
.alias-count-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; color: var(--text-sub); cursor: pointer;
  padding: 2px 6px; border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.alias-count-badge:hover { background: var(--surface-3); }

/* ─── Status badges ──────────────────────────────────────── */
.status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-active   { background: var(--green-dim); color: var(--green); }
.badge-inactive { background: var(--red-dim);   color: var(--red); }

/* ─── Work type badges ───────────────────────────────────── */
.work-type-badge {
  display: inline-block; padding: 2px 7px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.wt-稼働 { background: var(--blue-dim);   color: var(--blue); }
.wt-営業 { background: var(--green-dim);  color: var(--green); }
.wt-保守 { background: var(--orange-dim); color: var(--orange); }
.wt-社内 { background: var(--surface-2); color: var(--text-sub); }

/* ─── Date separator row ─────────────────────────────────── */
.date-separator-row { background: transparent; }
.date-separator {
  padding: 10px 12px 4px !important;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.05em; border-bottom: 1px solid var(--border) !important;
}

/* ─── form-row-3 ─────────────────────────────────────────── */
.form-row-3 { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }

/* ─── form-inline ────────────────────────────────────────── */
.form-inline { display: flex; gap: 8px; align-items: center; }

/* ─── Dashboard cards ────────────────────────────────────── */
.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 720px) {
  .dashboard-cards { grid-template-columns: repeat(2, 1fr); }
}
.dashboard-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color .2s ease;
}
.dashboard-card:hover {
  border-color: var(--border-2);
}
.dashboard-card-hero {
  grid-column: span 2;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 22px 24px;
}
.dashboard-card-link { text-decoration: none; cursor: pointer; }
.dashboard-card-link:hover { border-color: var(--text-muted); }
.dashboard-card-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.dashboard-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.dashboard-card-hero .dashboard-card-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.dashboard-card-value.positive { color: var(--green); }
.dashboard-card-value.negative { color: var(--red); }

/* ─── Proj-status badges ─────────────────────────────────── */
.proj-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.ps-見積中 { background: var(--surface-2); color: var(--text-sub); }
.ps-受注   { background: var(--blue-dim);   color: var(--blue); }
.ps-進行中 { background: var(--accent-dim); color: var(--text); }
.ps-納品   { background: var(--orange-dim); color: var(--orange); }
.ps-完了   { background: var(--green-dim);  color: var(--green); }
.ps-失注   { background: var(--red-dim);    color: var(--red); }

/* ─── Profit color helpers ───────────────────────────────── */
.profit-positive { color: var(--green); font-weight: 600; }
.profit-negative { color: var(--red);   font-weight: 600; }

/* ─── Finance panel ──────────────────────────────────────── */
.finance-panel {
  padding: 12px 16px 14px 40px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.finance-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 10px;
}
.finance-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.finance-profit-preview {
  font-size: 12px;
  color: var(--text-sub);
  padding: 6px 0 0;
}
.finance-actual {
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 4px;
}

/* ─── Customer name display ──────────────────────────────── */
.cust-main-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.cust-sub-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.cust-furigana {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.cust-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ─── Contact panel ──────────────────────────────────────── */
.contact-panel {
  padding: 12px 16px;
}
.contact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-wrap: wrap;
}
.contact-row:last-child { border-bottom: none; }
.contact-name {
  font-weight: 600;
  color: var(--text);
  min-width: 80px;
}
.contact-role {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-sub);
}
.contact-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.contact-add-form input,
.assigned-add-form input,
.assigned-add-form select {
  font-size: 12px;
}

/* ─── Timeline card ──────────────────────────────────────── */
.tl-card {
  overflow-x: auto;
  padding: 0;
}
.tl-card .tl-grid {
  min-width: 600px;
}

/* ─── Toast notifications ────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 28px; right: 28px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 11px 20px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in .22s cubic-bezier(.34,1.56,.64,1);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: auto;
}
.toast-success { background: var(--text); color: #fff; }
.toast-error   { background: var(--red);   color: #fff; }
.toast-info    { background: var(--text-sub); color: #fff; }
.toast-hide    { opacity: 0; transform: translateX(20px) scale(.96); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px) scale(.94); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ─── Tab count badge ────────────────────────────────────── */
.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 5px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  margin-left: 4px;
}
.tab.active .tab-count {
  background: var(--surface-2); border-color: var(--border-2);
  color: var(--text);
}

/* ─── Project description ────────────────────────────────── */
.proj-description {
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px; line-height: 1.4;
}

/* ─── Import section (details/summary) ───────────────────── */
.import-section {
  margin-bottom: 16px;
}
.import-section > summary {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; user-select: none;
  padding: 6px 0;
  list-style: none;
  display: flex; align-items: center; gap: 6px;
}
.import-section > summary::before {
  content: '\25B6'; font-size: 9px; transition: transform .15s;
}
.import-section[open] > summary::before { transform: rotate(90deg); }
.import-section > summary:hover { color: var(--text-sub); }

/* ─── Customer type & agency badges ──────────────────────── */
.customer-type-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  padding: 1px 6px; border-radius: 10px;
  line-height: 1.6;
}
.ct-代理店 {
  background: var(--surface-2);
  color: var(--text-sub);
  border: 1px solid var(--border);
}
.ct-直接 {
  background: var(--surface-2);
  color: var(--text-sub);
  border: 1px solid var(--border);
}
.agency-ref-badge {
  display: inline-block;
  font-size: 10px; font-weight: 500;
  padding: 1px 6px; border-radius: 10px;
  line-height: 1.6;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ─── Customer primary/secondary name display ────────────── */
.cust-main-name {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.cust-sub-name {
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
}
.cust-furigana {
  font-size: 10px; color: var(--text-muted); letter-spacing: .05em;
}
.cust-meta {
  font-size: 11px; color: var(--text-muted);
}

/* ─── Clickable customer name ────────────────────────────── */
.cust-clickable {
  cursor: pointer;
  transition: color .15s;
}
.cust-clickable:hover { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }

/* ─── Self-assigned inline chips ─────────────────────────── */
.assigned-cell { vertical-align: middle; }
.assigned-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 4px; }
.assigned-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 2px 8px; font-size: 11px; color: var(--text-sub);
}
.chip-del {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 0; font-size: 11px; line-height: 1;
  transition: color .15s;
}
.chip-del:hover { color: var(--red); }
.chip-add {
  background: none; border: 1px dashed var(--border-2);
  border-radius: 12px; padding: 2px 8px; font-size: 11px;
  cursor: pointer; color: var(--text-muted); transition: color .15s, border-color .15s;
}
.chip-add:hover { color: var(--text); border-color: var(--text-muted); }
.assigned-add-inline { display: flex; gap: 4px; align-items: center; margin-top: 2px; }

/* ─── Agency checkbox label ──────────────────────────────── */
.agency-check-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-sub); cursor: pointer;
  padding: 6px 4px;
}
.agency-check-label input[type="checkbox"] { accent-color: var(--text); width: 14px; height: 14px; cursor: pointer; }

/* ─── Customer drawer ────────────────────────────────────── */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.2);
  z-index: 300; display: none;
}
.drawer-overlay.open { display: block; }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: clamp(480px, 50vw, 860px);
  background: var(--surface); border-left: 1px solid var(--border);
  padding: 24px; overflow-y: auto;
  animation: drawerSlideIn .2s ease;
  display: flex; flex-direction: column;
}
@keyframes drawerSlideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  font-size: 15px; font-weight: 700; color: var(--text);
}
.drawer-section {
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.drawer-section:last-child { border-bottom: none; }
.drawer-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.drawer-hint {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  color: var(--text-muted); font-size: 10px;
}

/* ─── KPI summary bar ────────────────────────────────────── */
.kpi-bar {
  display: flex; align-items: center; gap: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 20px;
  margin-bottom: 18px; flex-wrap: wrap;
}
.kpi-item { display: flex; flex-direction: column; gap: 3px; padding: 0 18px; }
.kpi-item:first-child { padding-left: 0; }
.kpi-label { font-size: 10px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 18px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.kpi-value.positive { color: var(--green); }
.kpi-value.warn { color: var(--orange); }
.kpi-sep { width: 1px; background: var(--border); height: 32px; margin: 0 4px; }

/* ─── SFA status badge + picker ──────────────────────────── */
.sfa-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; cursor: pointer; border: none;
  white-space: nowrap; transition: opacity .15s; line-height: 1.6;
}
.sfa-badge:hover { opacity: .8; }
.sfa-営業   { background: var(--blue-dim);    color: var(--blue); }
.sfa-受注   { background: var(--orange-dim);  color: var(--orange); }
.sfa-進行中 { background: var(--accent-dim);  color: var(--text); }
.sfa-納品済 { background: var(--green-dim);   color: var(--green); }
.sfa-失注   { background: var(--surface-2);   color: var(--text-muted); }
.sfa-未設定 { background: var(--surface-2); color: var(--text-muted); border: 1px dashed var(--border-2); }

.status-picker {
  position: fixed;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; min-width: 130px; z-index: 200; display: none;
}
.status-picker.open { display: block; }
.spicker-group {
  font-size: 10px; color: var(--text-muted); padding: 4px 8px 2px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.spicker-item {
  display: block; width: 100%; text-align: left; padding: 5px 8px;
  font-size: 12px; border: none; background: none; color: var(--text-sub);
  border-radius: var(--radius-sm); cursor: pointer;
}
.spicker-item:hover { background: var(--surface-2); color: var(--text); }
.spicker-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.spicker-clear { color: var(--text-muted); font-size: 11px; }

/* ─── Filter tabs ────────────────────────────────────────── */
.filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-tab {
  padding: 5px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); font-size: 12px;
  cursor: pointer; transition: all .15s;
}
.filter-tab:hover { border-color: var(--border-2); color: var(--text-sub); }
.filter-tab.active { border-color: var(--text); color: var(--text); background: var(--surface-2); }

/* ─── Archive / danger button ────────────────────────────── */
.btn-danger {
  background: var(--red-dim); color: var(--red);
  border: 1px solid transparent; transition: border-color .15s;
}
.btn-danger:hover { border-color: var(--red); }

/* ─── Unbilled badge ─────────────────────────────────────── */
.unbilled-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 8px;
  background: var(--orange-dim); color: var(--orange);
  margin-left: 4px; vertical-align: middle;
}
.overdue-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  padding: 1px 5px; border-radius: 8px;
  background: var(--red-dim); color: var(--red);
  margin-left: 4px; vertical-align: middle;
}

/* ─── drag handle ────────────────────────────────────────── */
.drag-handle {
  cursor: grab; color: var(--text-muted);
  font-size: 13px; text-align: center; padding: 0 4px;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }
.item-row:hover .drag-handle { color: var(--text); }

/* ─── invoice link ───────────────────────────────────────── */
.invoice-link {
  font-size: 13px; text-decoration: none; cursor: pointer;
  opacity: 0.8;
}
.invoice-link:hover { opacity: 1; }
.invoice-url-btn {
  font-size: 11px; color: var(--text-muted);
}
.invoice-url-btn:hover { color: var(--blue); }

/* ─── Projects: list cells ───────────────────────────────── */
.proj-customer {
  font-size: 10px; color: var(--text-muted); margin-bottom: 2px;
}
.proj-name {
  font-size: 13px; font-weight: 600; color: var(--text);
}
.proj-detail-link {
  color: inherit; text-decoration: none;
  transition: color .15s;
}
.proj-detail-link:hover {
  color: var(--text-muted);
  text-decoration: underline;
}
.proj-desc {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}

/* ─── SFA status select (inline) ─────────────────────────── */
.sfa-select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-sub);
  padding: 3px 6px; font-size: 11px; cursor: pointer;
  transition: border-color .15s;
}
.sfa-select:focus { outline: none; border-color: var(--text); }

/* SFA group colors */
.sfa-group-営業 { color: var(--blue); }
.sfa-group-受注 { color: var(--orange); }
.sfa-group-納品 { color: var(--green); }
.sfa-group-失注 { color: var(--text-muted); }

/* ─── User chip ──────────────────────────────────────────── */
.user-chip {
  display: inline-flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 2px 8px;
  font-size: 11px; color: var(--text-sub); white-space: nowrap;
}
.user-chip-empty {
  background: none; border: 1px dashed var(--border);
  color: var(--text-muted);
}

/* ─── Billing type badge ─────────────────────────────────── */
.billing-badge {
  display: inline-block; font-size: 10px; padding: 2px 6px;
  border-radius: 8px; font-weight: 600; letter-spacing: .04em;
}
.bt-年間  { background: var(--surface-2); color: var(--text-sub); }
.bt-定期  { background: var(--surface-2); color: var(--text-sub); }
.bt-都度  { background: var(--surface-2); color: var(--text-sub); }
.bt-分割  { background: var(--surface-2); color: var(--text-sub); }

/* ─── Project items table (明細) ─────────────────────────── */
.items-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.items-table th {
  color: var(--text-muted); font-weight: 600; font-size: 10px;
  padding: 4px 6px; text-align: right; border-bottom: 1px solid var(--border);
}
.items-table th:first-child { text-align: left; }
.items-table td {
  padding: 4px 6px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.items-table tr.item-row:hover td { background: var(--surface-2); }
.items-table tfoot td {
  padding-top: 6px; font-weight: 700; color: var(--text);
  border-bottom: none;
}
.ctrl-inline {
  background: transparent; border: none; color: var(--text);
  font-size: 12px; width: 100%; padding: 1px 2px;
  transition: background .1s;
}
.ctrl-inline:focus {
  outline: none; background: var(--surface-2);
  border-radius: 4px;
}
.num-input { text-align: right; }
.billed-check {
  accent-color: var(--text); width: 14px; height: 14px; cursor: pointer;
}

/* ─── Drawer controls ────────────────────────────────────── */
.ctrl-sm {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 4px 8px; font-size: 12px; transition: border-color .15s;
}
.ctrl-sm:focus { outline: none; border-color: var(--text); }
.drawer-label {
  display: block; font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 4px; margin-top: 10px;
}
.drawer-label:first-child { margin-top: 0; }

/* ─── Projects list: assign cell ─────────────────────────── */
.assign-cell { display: flex; align-items: center; gap: 4px; }
.assign-role {
  font-size: 9px; font-weight: 700; color: var(--text-muted);
  background: var(--surface-2); border-radius: 3px;
  padding: 1px 3px; flex-shrink: 0;
}

/* ─── Projects list: number cells ────────────────────────── */
.num-cell {
  text-align: right; font-size: 12px; font-weight: 600;
  white-space: nowrap; color: var(--text-sub);
}
.num-empty { color: var(--text-muted); font-weight: 400; }

/* ─── input[type=month] style ────────────────────────────── */
input[type="month"] {
  color-scheme: light;
}

/* ─── Projects list: menu tags ───────────────────────────── */
.proj-menu-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.proj-menu-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-muted);
  white-space: nowrap; border: 1px solid var(--border);
}

/* ─── Projects list: inline expand button ────────────────── */
.items-expand-btn {
  background: none; border: none; cursor: pointer;
  font-size: 9px; color: var(--text-muted); padding: 2px 3px;
  flex-shrink: 0; margin-top: 2px; border-radius: 3px;
  transition: color .15s;
}
.items-expand-btn:hover { color: var(--text); }

/* ─── Projects list: inline items mini table ─────────────── */
.items-expand-row td { background: var(--surface-2); }
.items-mini-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 6px; }
.items-mini-table th {
  color: var(--text-muted); padding: 3px 8px;
  font-weight: 600; text-align: center; border-bottom: 1px solid var(--border);
}
.items-mini-table td { padding: 4px 8px; border-top: 1px solid var(--border); text-align: center; }

/* ─── Customer quick-add modal ───────────────────────────── */
.acm-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.2); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.acm-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px 24px;
  width: 360px; max-width: 90vw;
  box-shadow: var(--shadow-lg);
}

/* ─── Quick Task Input Bar ───────────────────────────────── */
.quick-input-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 12px 18px;
  margin-bottom: 18px;
  transition: border-color .18s, box-shadow .18s;
}
.quick-input-bar:focus-within {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--text);
}
.quick-input {
  flex: 1; background: transparent; border: none; outline: none;
  font-size: 14px; color: var(--text);
}
.quick-input::placeholder { color: var(--text-muted); }

/* ─── Work Log Modal ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.2); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); width: 420px; max-width: 92vw;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  font-size: 14px; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-muted); line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}
.wl-row { display: flex; align-items: center; gap: 8px; }
.wl-label { font-size: 12px; color: var(--text-muted); width: 36px; flex-shrink: 0; }
.wl-hours { width: 60px; text-align: center; }
.btn-ghost {
  padding: 7px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: transparent; border: 1px solid var(--border-2);
  color: var(--text-muted); transition: color .15s, border-color .15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn {
  padding: 7px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--text); border: none; color: #fff;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }

/* ─── Misc ───────────────────────────────────────────────── */
.mono { font-family: ui-monospace, "SF Mono", monospace; font-size: 11px; }
.inline { display: flex; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ─── Global polish ──────────────────────────────────────── */
::selection { background: rgba(0,0,0,.10); color: var(--text); }

/* scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* focus-visible for keyboard nav */
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* ─── Daily Summary Card ─────────────────────────────────── */
.daily-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 14px;
  position: relative;
}
.daily-summary__header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.daily-summary__title {
  font-size: 12px; font-weight: 700;
  color: var(--text);
  letter-spacing: .03em;
}
.daily-summary__refresh {
  margin-left: auto;
  background: transparent; border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 11px;
  padding: 2px 8px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.daily-summary__refresh:hover { color: var(--text); border-color: var(--text); }
.daily-summary__body {
  font-size: 13px; line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}
.daily-summary__loading {
  font-size: 12px; color: var(--text-muted);
  font-style: italic;
}

/* ─── Assignee input ─────────────────────────────────────── */
.assignee-input {
  width: 100%; max-width: 100px;
  font-size: 12px; padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent; color: var(--text);
  transition: border-color .15s, background .15s;
}
.assignee-input:hover { border-color: var(--border-2); background: var(--surface-2); }
.assignee-input:focus { border-color: var(--text); background: var(--surface); outline: none; }
.assignee-input::placeholder { color: var(--text-muted); font-size: 11px; }

/* ─── Customer cell clickable ────────────────────────────── */
.customer-cell { cursor: pointer; position: relative; }
.customer-cell .project-select-inline {
  display: none;
  position: absolute; top: 100%; left: 0;
  z-index: 50; min-width: 200px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  font-size: 12px;
}
.customer-cell .project-select-inline.open { display: block; }

/* ─── Done-today separator ───────────────────────────────── */
.done-today-separator td {
  padding: 8px 14px !important;
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border) !important;
  background: var(--surface-2);
}
.task-table tbody tr.row-done-today { opacity: .5; }
.task-table tbody tr.row-done-today .task-title { text-decoration: line-through; }

/* ─── Shared detail page ─────────────────────────────────── */
.back-link {
  font-size: 13px; color: var(--text-muted); text-decoration: none;
  transition: color .15s;
}
.back-link:hover { color: var(--text); }

.pd-header { margin-bottom: 20px; }
.pd-title-row {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 6px;
}
.pd-customer { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.pd-sep { font-size: 14px; color: var(--text-muted); }
.pd-name { font-size: 18px; font-weight: 700; color: var(--text); }
.pd-status-badge {
  font-size: 11px; font-weight: 600;
  padding: 2px 10px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-sub);
}
.pd-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted);
}
.pd-memo {
  max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pd-tabs {
  display: flex; gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.pd-tab {
  background: none; border: none;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  padding: 8px 16px; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all .15s;
  display: flex; align-items: center; gap: 6px;
  border-radius: 6px 6px 0 0;
}
.pd-tab:hover { color: var(--text); background: var(--surface-2); }
.pd-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.pd-tab-count {
  font-size: 11px;
  background: var(--surface-2);
  padding: 1px 6px; border-radius: 8px;
  color: var(--text-muted);
}
.pd-tab.active .pd-tab-count {
  background: var(--accent-dim); color: var(--text);
}
.pd-tab-content { /* wrapper for each tab */ }
.pd-task-count { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.text-overdue { color: var(--red); font-weight: 600; }

/* ─── Customer detail: grid layout ───────────────────────── */
.cd-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .cd-grid { grid-template-columns: 1fr; }
}

/* ─── Customer detail: info table ────────────────────────── */
.info-table {
  width: 100%;
  font-size: 13px;
  border-collapse: collapse;
}
.info-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 12px 6px 0;
  width: 100px;
  vertical-align: top;
}
.info-table td {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.info-table tr:last-child td { border-bottom: none; }

/* ─── Customer detail: mini KPI chips ────────────────────── */
.mini-kpi {
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ─── Customer detail: note type filter ──────────────────── */
.note-type-filter {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.note-type-btn {
  font-size: 11px; padding: 3px 10px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; transition: all .15s; color: var(--text-sub);
}
.note-type-btn:hover { border-color: var(--border-2); color: var(--text); }
.note-type-btn.active {
  background: var(--surface-2); border-color: var(--text); color: var(--text);
}

/* ─── Customer detail: note item ─────────────────────────── */
.note-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.note-item:hover { background: var(--surface-2); }
.note-item:last-child { border-bottom: none; }

/* ─── Customer detail: note type badge ───────────────────── */
.nt-badge {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-sub);
  white-space: nowrap;
}

/* ─── Customer detail: note type chip (stats) ────────────── */
.note-type-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.note-type-chip-label { font-weight: 600; color: var(--text); }
.note-type-chip-count { color: var(--text); font-weight: 600; }
.note-type-chip-chars { color: var(--text-muted); font-size: 10px; }

/* ─── Customer detail: form group ────────────────────────── */
.form-group {
  display: flex; flex-direction: column; gap: 4px;
}
.form-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
}

/* ─── Customer attributes ────────────────────────────────── */
.industry-badge {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-sub);
  white-space: nowrap;
}
.attr-empty {
  color: var(--text-muted); opacity: 0.5;
  font-size: 12px;
}

/* ─── Sidebar Footer (user info + logout) ──────────────── */
.sidebar-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
}
.sidebar-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-sub);
  flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10px; color: var(--text-muted);
}
.sidebar-logout {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  color: var(--text-muted); flex-shrink: 0;
  transition: background .15s, color .15s;
}
.sidebar-logout:hover {
  background: var(--surface-2); color: var(--red);
}
