/* ===================== Theme ===================== */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f0f3f7;
  --border: #d9e0e8;
  --text: #1f2a37;
  --text-muted: #6b7785;
  --accent: #2563eb;
  --accent-soft: #e6efff;

  --green: #22a06b;
  --green-soft: #d6f0e4;
  --yellow: #d99e00;
  --yellow-soft: #faf0cf;
  --red: #d64545;
  --red-soft: #f7dcdc;

  --task-bar: #5b6b7d;            /* calendar task overlay (assigned) */
  --task-bar-unassigned: #c97e2c; /* calendar task overlay (unassigned) */

  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --radius: 8px;
  --row-h: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

/* ===================== Header / Nav ===================== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted, #6b7280);
}
.user-bar .user-name { font-weight: 600; }
.link-btn {
  background: none;
  border: none;
  color: var(--accent, #2563eb);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}

.brand h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 650;
}
.brand .subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.main-nav { display: flex; gap: 4px; }
.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-btn:hover { background: var(--surface-alt); color: var(--text); }
.nav-btn.active { background: var(--accent); color: #fff; }

/* ===================== Layout ===================== */
#app-main { padding: 20px 24px 60px; max-width: 1600px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.view-toolbar h2 { font-size: 20px; margin: 0; font-weight: 650; }
.toolbar-controls { display: flex; align-items: center; gap: 12px; }

/* ===================== Error banner ===================== */
.error-banner {
  margin: 16px 24px 0;
  padding: 14px 18px;
  background: var(--red-soft);
  border: 1px solid var(--red);
  color: #842020;
  border-radius: var(--radius);
  font-weight: 550;
}

/* ===================== Buttons / toggles ===================== */
.granularity-switch, .status-filter {
  display: inline-flex;
  gap: 4px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: var(--radius);
}
.gran-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 550;
  color: var(--text-muted);
}
.gran-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.group-select-label { font-size: 13px; color: var(--text-muted); font-weight: 550; }
#task-group-select {
  margin-left: 6px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

/* ===================== Legend ===================== */
.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.swatch.status-green { background: var(--green); }
.swatch.status-yellow { background: var(--yellow); }
.swatch.status-red { background: var(--red); }
.swatch.task-swatch { background: var(--task-bar); }
.swatch.holiday-swatch {
  background-color: var(--red);
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.22) 0 2px, transparent 2px 5px);
}

/* ===================== Calendar ===================== */
.calendar-scroll {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.calendar-grid {
  display: grid;
  min-width: max-content;
}
.cal-corner, .cal-col-head, .cal-rowlabel, .cal-track {
  border-bottom: 1px solid var(--border);
}
.cal-corner {
  position: sticky; left: 0; z-index: 6;
  background: var(--surface-alt);
  border-right: 1px solid var(--border);
}
.cal-col-head {
  background: var(--surface-alt);
  padding: 8px 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 4;
}
.cal-col-head .sub { display: block; font-weight: 400; opacity: .75; }

/* Day-granularity headers */
.cal-month-head {
  background: var(--surface-alt);
  padding: 6px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 650;
  color: var(--text);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; left: auto;
}
.cal-corner.cal-month-head { position: sticky; left: 0; z-index: 6; }
.cal-day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 2px;
}
.cal-day-head .dow { font-size: 9px; opacity: .65; text-transform: uppercase; }
.cal-day-head .dom { font-size: 12px; font-weight: 600; color: var(--text); }
.cal-day-head.holiday { background: var(--red-soft); }
.cal-day-head.holiday .dom { color: var(--red); }
.cal-day-head.holiday .dow { color: var(--red); opacity: .8; }

/* Holiday block: red, with a diagonal hatch so it reads as "blocked", not booked. */
.holiday-bar {
  background-color: var(--red);
  background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.22) 0 2px, transparent 2px 5px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.2);
}
.cal-rowlabel {
  position: sticky; left: 0; z-index: 5;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 0 12px;
  display: flex;
  align-items: center;
  font-weight: 550;
  white-space: nowrap;
}
.cal-rowlabel.unassigned { color: var(--red); font-style: italic; }
.cal-track {
  position: relative;
  background-image: linear-gradient(to right, var(--border) 1px, transparent 1px);
}
.cal-track.unassigned-track { background-color: #fff7f0; }

/* avail-bar / task-bar: top + height are set inline per row by app.js so that
   each task occupies its own vertical lane below the availability band. */
.avail-bar {
  position: absolute;
  border-radius: 3px;
  opacity: .9;
}
.avail-bar.status-green { background: var(--green); }
.avail-bar.status-yellow { background: var(--yellow); }
.avail-bar.status-red { background: var(--red); }

.task-bar {
  position: absolute;
  border-radius: 3px;
  background: var(--task-bar);
  border: 1px solid rgba(0,0,0,.12);
  cursor: default;
  overflow: hidden;
  font-size: 10px;
  color: #fff;
  white-space: nowrap;
  padding: 0 5px;
  line-height: 16px;
  text-overflow: ellipsis;
  box-sizing: border-box;
}
.task-bar.unassigned-task { background: var(--task-bar-unassigned); }

.cal-empty { padding: 40px; text-align: center; color: var(--text-muted); }

/* ===================== Consultant cards ===================== */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 8px; }
.filter-group-grow { flex: 1; min-width: 280px; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.filter-label .muted { text-transform: none; font-weight: 400; letter-spacing: 0; }

.status-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 550;
  color: var(--text-muted);
  opacity: .55;
}
.status-toggle.active { opacity: 1; color: #fff; border-color: transparent; }
.status-toggle.status-green.active { background: var(--green); }
.status-toggle.status-yellow.active { background: var(--yellow); }
.status-toggle.status-red.active { background: var(--red); }

.period-filter { display: inline-flex; align-items: center; gap: 8px; }
.period-filter select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.search-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  min-width: 200px;
}

.status-legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.status-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.status-legend-item strong { color: var(--text); font-weight: 600; text-transform: capitalize; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend-dot.status-green { background: var(--green); }
.legend-dot.status-yellow { background: var(--yellow); }
.legend-dot.status-red { background: var(--red); }
.modal-legend { margin: 0 0 10px; }

.avail-summary { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.avail-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.avail-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.avail-dot.status-green { background: var(--green); }
.avail-dot.status-yellow { background: var(--yellow); }
.avail-dot.status-red { background: var(--red); }
.avail-range { color: var(--text); }

.skill-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  transition: all .12s;
}
.skill-chip:hover { border-color: var(--accent); color: var(--accent); }
.skill-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.clear-filters {
  align-self: center;
  margin-left: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 550;
}
.clear-filters:hover { border-color: var(--red); color: var(--red); }

.consultant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}
.consultant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head .name { font-size: 16px; font-weight: 650; margin: 0; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-badge.status-green { background: var(--green-soft); color: #157048; }
.status-badge.status-yellow { background: var(--yellow-soft); color: #946b00; }
.status-badge.status-red { background: var(--red-soft); color: #9c2a2a; }
.status-badge.status-none { background: var(--surface-alt); color: var(--text-muted); }

.card-section-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 6px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 550;
}
.tag.product-tag { background: var(--surface-alt); color: var(--text-muted); }

.card-tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.card-task {
  border-left: 3px solid var(--accent);
  background: var(--surface-alt);
  padding: 7px 10px;
  border-radius: 4px;
}
.card-task .task-name { font-weight: 600; font-size: 13px; }
.card-task .task-meta { font-size: 11px; color: var(--text-muted); }
.card-task.upcoming { border-left-color: var(--text-muted); opacity: .85; }
.no-tasks { font-size: 12px; color: var(--text-muted); font-style: italic; }

.empty-result { padding: 40px; text-align: center; color: var(--text-muted); grid-column: 1 / -1; }

/* ===================== Task view ===================== */
.task-group { margin-bottom: 22px; }
.task-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}
.task-group-head h3 { font-size: 15px; margin: 0; font-weight: 650; }
.task-group-head .count { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.task-group-head .pt-total { margin-left: auto; font-size: 12px; color: var(--text-muted); }

.task-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-card.unassigned { border-left-color: var(--yellow); background: #fffdf7; }
.task-card .task-card-title { font-weight: 650; font-size: 14px; }
.task-card-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-muted); }
.task-card-row strong { color: var(--text); font-weight: 600; }

.assignee-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
}
.assignee-badge.unassigned { background: var(--yellow-soft); color: #946b00; }

/* ===================== Reporting view ===================== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.kpi-card.risk { border-color: var(--red); background: var(--red-soft); }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1.1; }
.kpi-card.risk .kpi-value { color: #9c2a2a; }
.kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.report-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.report-section h3 { margin: 0 0 14px; font-size: 15px; font-weight: 650; }
.report-section h3 .muted { font-weight: 400; }

.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bar-list li {
  display: grid;
  grid-template-columns: 260px 1fr 170px;
  align-items: center;
  gap: 12px;
  padding: 3px 6px;
  border-radius: 6px;
}
.bar-list li.above { background: var(--green-soft); }
.bar-list li.below { background: var(--red-soft); }
.bar-label { font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track {
  position: relative;
  height: 18px;
  background: var(--surface-alt);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 4px; min-width: 2px; }
.bar-fill.above { background: var(--green); }
.bar-fill.below { background: var(--red); }
.avg-marker {
  position: absolute; top: -2px; bottom: -2px; width: 0;
  border-left: 2px dashed var(--text-muted);
  z-index: 2;
}
.bar-value { font-size: 12px; color: var(--text); text-align: right; white-space: nowrap; }

.report-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.report-badge.above { background: var(--green); color: #fff; }
.report-badge.below { background: var(--red); color: #fff; }

.risk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.risk-list li { font-size: 13px; }

/* ===================== Admin view ===================== */
.admin-hint { font-size: 12px; margin: 0 0 14px; line-height: 1.5; }
.admin-hint code {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
}
.admin-rename-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.admin-rename-row select,
.admin-rename-row input[type="text"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.admin-rename-row select { min-width: 220px; }
.admin-rename-row input[type="text"] { flex: 1; min-width: 240px; }

.admin-csv-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.admin-csv-row input[type="file"] { font-size: 13px; }

.csv-summary {
  margin: 14px 0 10px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
}
.csv-table { border-collapse: collapse; width: 100%; max-width: 480px; margin-bottom: 12px; font-size: 12px; }
.csv-table th, .csv-table td { text-align: left; padding: 5px 10px; border-bottom: 1px solid var(--border); }
.csv-table th { color: var(--text-muted); font-weight: 600; }

@media (max-width: 720px) {
  .app-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .view-toolbar { flex-direction: column; align-items: flex-start; }
  .bar-list li { grid-template-columns: 140px 1fr 110px; }
}

/* ===================== Buttons / editing affordances ===================== */
.primary-btn {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.primary-btn:hover { filter: brightness(1.05); }

.ghost-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }

.danger-btn {
  border: 1px solid var(--red);
  background: var(--surface);
  color: var(--red);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.danger-btn:hover { background: var(--red-soft); }

.edit-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.edit-btn:hover { border-color: var(--accent); color: var(--accent); }
.task-card .edit-btn { align-self: flex-start; }

/* ===================== Modal ===================== */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-root[hidden] { display: none; }
.modal {
  background: var(--surface);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.25);
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 650; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.modal-foot .spacer { flex: 1; }

/* ===================== Forms ===================== */
.form-field { margin-bottom: 16px; }
.form-field > label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 6px;
}
.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  box-sizing: border-box;
}
.form-field textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
.form-row { display: flex; gap: 12px; }
.form-row > .form-field { flex: 1; }

.row-grid {
  display: grid;
  grid-template-columns: 130px 1fr 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.row-grid select, .row-grid input { padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 13px; }
.row-remove {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  width: 30px; height: 30px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.row-remove:hover { border-color: var(--red); color: var(--red); }
.add-row-btn {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 4px;
}
.add-row-btn:hover { border-color: var(--accent); color: var(--accent); }

/* tag editor */
.tag-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  position: relative;
}
.tag-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 30;
  max-height: 220px;
  overflow-y: auto;
}
.tag-suggest li {
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
}
.tag-suggest li.active,
.tag-suggest li:hover { background: var(--accent-soft); color: var(--accent); }
.tag-editor .tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 4px 2px 8px;
  font-size: 12px;
  font-weight: 550;
}
.tag-editor .tag-chip button {
  border: none; background: transparent; color: inherit;
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px;
}
.tag-editor input {
  border: none; outline: none; flex: 1; min-width: 120px;
  font-size: 13px; font-family: inherit; padding: 4px;
}

/* transcript section */
.transcript-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 18px;
}
.transcript-box .hint { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; }
.transcript-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.transcript-status { font-size: 12px; color: var(--text-muted); }
.transcript-status.error { color: var(--red); }
.transcript-status.ok { color: #157048; }

.modal-section-title {
  font-size: 13px;
  font-weight: 650;
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--surface-alt);
}
.project-card .project-card-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.project-card .project-card-head span { font-size: 12px; font-weight: 600; color: var(--text-muted); }

.modal-error {
  background: var(--red-soft);
  border: 1px solid var(--red);
  color: #842020;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ===================== Toast ===================== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  box-shadow: var(--shadow);
  z-index: 200;
}
.toast.error { background: var(--red); }
