/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #f0f2f5;
  color: #1e2939;
  min-height: 100vh;
}

/* ── Boot Screen ── */
#boot {
  position: fixed; inset: 0;
  background: #fff;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; z-index: 9999;
}
.boot-logo { margin-bottom: 4px; }
.boot-title { font-size: 1.3rem; font-weight: 700; color: #1e2939; }
.boot-sub   { font-size: .9rem; color: #6b7280; }
.boot-spinner {
  width: 28px; height: 28px;
  border: 3px solid #e5e9ef;
  border-top-color: #1a56db;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-err { color: #b91c1c; font-size: .85rem; max-width: 360px; text-align: center; }
.boot-btn {
  padding: 10px 28px; background: #1a56db; color: #fff;
  border: none; border-radius: 8px; font-size: .95rem; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.boot-btn:hover { background: #1648c5; }

/* ── App Layout ── */
#app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 224px; min-width: 224px;
  background: #fff; border-right: 1px solid #e5e9ef;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; transition: transform .25s ease;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  font-weight: 700; font-size: 1.05rem; color: #1a56db;
  border-bottom: 1px solid #e5e9ef;
}
.sidebar-nav {
  flex: 1; padding: 10px 8px;
  display: flex; flex-direction: column; gap: 1px; overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 8px;
  text-decoration: none; color: #4b5563;
  font-size: .875rem; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item:hover { background: #f0f4ff; color: #1a56db; }
.nav-item.active { background: #eff3ff; color: #1a56db; font-weight: 600; }
.nav-sep { height: 1px; background: #e5e9ef; margin: 6px 8px; }
.nav-ext { color: #9ca3af; font-size: .82rem; }
.nav-ext:hover { color: #1a56db; }
.sidebar-user {
  padding: 12px 14px; border-top: 1px solid #e5e9ef;
  display: flex; align-items: center; gap: 9px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #1a56db; color: #fff;
  font-weight: 700; font-size: .78rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name { font-size: .83rem; font-weight: 600; }
.user-sub  { font-size: .72rem; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.logout-btn {
  margin-left: auto; background: none; border: none;
  cursor: pointer; color: #9ca3af; padding: 4px;
  border-radius: 4px; display: flex;
}
.logout-btn svg { width: 16px; height: 16px; }
.logout-btn:hover { color: #374151; background: #f3f4f6; }

/* ── Main ── */
.main { flex: 1; margin-left: 224px; display: flex; flex-direction: column; }

/* ── Topbar ── */
.topbar {
  background: #fff; border-bottom: 1px solid #e5e9ef;
  height: 54px; padding: 0 22px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-size: 1rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.menu-toggle {
  display: none; background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: 6px; color: #6b7280;
}
.menu-toggle svg { width: 20px; height: 20px; display: block; }
.menu-toggle:hover { background: #f3f4f6; }

/* ── Column warning banner ── */
.col-warning {
  background: #fffbeb; border-bottom: 1px solid #fde68a;
  padding: 10px 22px; font-size: .82rem; color: #92400e; line-height: 1.5;
}

/* ── Content ── */
.content { padding: 22px; flex: 1; overflow: hidden; }
.view { display: none; }
.view.active { display: block; }
.view-split.active { padding: 0; }
.hidden { display: none !important; }

/* ── Stats ── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 14px; margin-bottom: 18px;
}
.stat-card {
  background: #fff; border: 1px solid #e5e9ef; border-radius: 12px;
  padding: 16px 18px; display: flex; align-items: center; gap: 12px;
}
.stat-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue   { background: #eff3ff; color: #1a56db; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.purple { background: #faf5ff; color: #9333ea; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .75rem; color: #6b7280; margin-top: 2px; }

/* ── Dashboard layout ── */
.dash-cols {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}

/* ── Card ── */
.card { background: #fff; border: 1px solid #e5e9ef; border-radius: 12px; overflow: hidden; }
.card-header {
  padding: 14px 18px; border-bottom: 1px solid #f0f2f5;
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: .92rem; font-weight: 600; }

/* ── Compact rows (dashboard) ── */
.cr2 {
  padding: 12px 18px; border-bottom: 1px solid #f3f4f6;
  cursor: pointer; transition: background .12s;
}
.cr2:hover { background: #f9fafb; }
.cr2:last-child { border-bottom: none; }
.cr2-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.cr2-title { font-size: .9rem; font-weight: 600; flex: 1; line-height: 1.4; color: #1e2939; }
.cr2-right { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.cr2-price { font-size: .82rem; font-weight: 700; color: #374151; white-space: nowrap; }
.cr2-tags  { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.cr2-tag   { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: #f3f4f6; color: #4b5563; white-space: nowrap; }
.cr2-tag.cr2-wg { background: #eff3ff; color: #3730a3; }
.cr2-foot  { display: flex; align-items: center; gap: 8px; }
.cr2-meta  { font-size: .72rem; color: #b0b7c3; flex: 1; }

/* ── Genehmigungsprozess Stepper ── */
.pa-stepper { padding: 18px 18px 8px; }
.pa-step {
  display: flex; gap: 12px;
}
.pa-step-ind {
  display: flex; flex-direction: column; align-items: center;
  flex-shrink: 0; width: 28px;
}
.pa-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: #e5e9ef; color: #374151;
  font-size: .75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative; z-index: 1;
  border: 2px solid #fff; box-shadow: 0 0 0 1px #e5e9ef;
}
.pa-step-dot.auto { background: #fff8e1; color: #b45309; box-shadow: 0 0 0 1px #fde68a; }
.pa-step-dot.ok   { background: #dcfce7; color: #16a34a; box-shadow: 0 0 0 1px #86efac; }
.pa-step-line {
  width: 2px; flex: 1; min-height: 14px;
  background: linear-gradient(to bottom, #d1d5db, #e5e9ef);
  margin: 3px 0;
}
.pa-step-body { flex: 1; padding-bottom: 18px; }
.pa-step:last-child .pa-step-body { padding-bottom: 0; }
.pa-step-body strong { font-size: .84rem; font-weight: 600; color: #1e2939; display: block; margin-top: 4px; }
.pa-step-body small  { font-size: .73rem; color: #9ca3af; display: block; margin-top: 2px; line-height: 1.45; }

/* ── Schwellwerte Tabelle ── */
.pa-thresholds {
  margin: 0 18px 18px;
  border: 1px solid #e5e9ef; border-radius: 9px;
  overflow: hidden;
}
.pa-th-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #9ca3af;
  padding: 8px 12px; background: #f8fafc;
  border-bottom: 1px solid #e5e9ef;
}
.pa-th-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 12px; border-bottom: 1px solid #f3f4f6; gap: 8px;
  font-size: .78rem;
}
.pa-th-row:last-child { border-bottom: none; }
.pa-th-row.highlight { background: #fef9ec; }
.pa-th-range { font-weight: 700; color: #1e2939; white-space: nowrap; }
.pa-th-rule  { color: #6b7280; text-align: right; }

/* ── Approval highlight in dashboard rows ── */
.cr-appr {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 7px; padding: 7px 10px; border-radius: 7px;
  font-size: .8rem; line-height: 1.4;
}
.cr-appr-ok      { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.cr-appr-no      { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }
.cr-appr-pending { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; }
.cr-appr-icon    { font-size: .95rem; flex-shrink: 0; line-height: 1.3; }

/* ── Add Lieferant button ── */
.btn-add-lief {
  margin-top: 6px; padding: 4px 10px;
  background: none; border: 1px dashed #a5b4fc;
  border-radius: 6px; color: #4f46e5; font-size: .78rem;
  cursor: pointer; font-family: inherit;
}
.btn-add-lief:hover { background: #eff3ff; border-color: #6366f1; }

/* ── Split layout (mine / all views) ── */
.view-split { padding: 0 !important; }
.split-layout {
  display: flex; height: calc(100vh - 62px); overflow: hidden;
}
.split-list {
  flex: 1; min-width: 0; overflow-y: auto;
  padding: 18px 20px;
}
.split-panel {
  width: 0; flex-shrink: 0; overflow: hidden;
  border-left: 1px solid #e5e9ef;
  background: #fff;
  transition: width .22s ease;
}
.split-panel:not(.hidden) { width: 460px; overflow-y: auto; }
@media (max-width: 900px) {
  .split-panel:not(.hidden) { position: fixed; top:0; right:0; width:100%; max-width:460px; height:100vh; z-index:300; box-shadow:-4px 0 24px rgba(0,0,0,.15); }
}

/* ── Item Cards ── */
.item-cards { display: flex; flex-direction: column; gap: 6px; }
.item-card {
  background: #fff; border: 1px solid #e5e9ef; border-radius: 10px;
  padding: 12px 16px; cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.item-card:hover   { border-color: #a5b4fc; box-shadow: 0 2px 8px rgba(99,102,241,.08); }
.item-card.selected { border-color: #1a56db; background: #f5f7ff; box-shadow: 0 0 0 2px rgba(26,86,219,.12); }

.ic-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.ic-title { font-size: .9rem; font-weight: 600; flex: 1; min-width: 0; }
.ic-topright { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ic-price { font-size: .85rem; font-weight: 700; color: #1e2939; white-space: nowrap; }

.ic-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.ic-tag {
  font-size: .72rem; padding: 2px 7px; border-radius: 999px;
  background: #f3f4f6; color: #374151; white-space: nowrap;
}
.ic-tag.ic-wg   { background: #eff3ff; color: #3730a3; }
.ic-tag.ic-banf { background: #f1f5f9; color: #64748b; font-weight: 600; }

.ic-footer { display: flex; align-items: center; gap: 8px; font-size: .72rem; color: #9ca3af; }
.ic-by { flex: 1; }
.ica-ok      { color: #15803d; font-weight: 600; }
.ica-no      { color: #b91c1c; font-weight: 600; }
.ica-pending { color: #b45309; font-weight: 600; }

/* ── Panel ── */
.panel-hdr {
  padding: 16px 18px 12px;
  border-bottom: 1px solid #e5e9ef;
  background: #fff;
  position: sticky; top: 0; z-index: 10;
}
.panel-hdr-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.panel-meta    { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.panel-close {
  background: none; border: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: .95rem; flex-shrink: 0;
}
.panel-close:hover { background: #f3f4f6; color: #374151; }
.panel-title   { font-size: 1rem; font-weight: 700; color: #1e2939; margin-bottom: 2px; }
.panel-byline  { font-size: .75rem; color: #9ca3af; margin-bottom: 10px; }
.panel-actions { display: flex; gap: 7px; }

.panel-body { padding: 0 18px 24px; }

.pf-section { padding: 14px 0; border-bottom: 1px solid #f3f4f6; }
.pf-section:last-child { border-bottom: none; }
.pf-sec-title {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: #9ca3af; margin-bottom: 8px;
}
.pf-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 4px 0; font-size: .855rem;
}
.pf-label { color: #9ca3af; min-width: 130px; flex-shrink: 0; font-size: .78rem; }
.pf-val   { font-weight: 500; color: #1e2939; word-break: break-word; }

.pf-input {
  flex: 1; border: 1px solid #d1d5db; border-radius: 6px;
  padding: 5px 9px; font-size: .84rem; font-family: inherit;
  outline: none; background: #fafafa; width: 100%;
}
.pf-input:focus { border-color: #1a56db; background: #fff; box-shadow: 0 0 0 2px rgba(26,86,219,.08); }
textarea.pf-input { resize: vertical; min-height: 52px; }

/* ── Status Badge ── */
.status-badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: .73rem; font-weight: 600; white-space: nowrap;
}

/* ── View toolbar ── */
.view-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 7px;
  background: #fff; border: 1px solid #d1d5db;
  border-radius: 8px; padding: 7px 11px; flex: 1; max-width: 300px;
}
.search-box svg { width: 15px; height: 15px; color: #9ca3af; flex-shrink: 0; }
.search-box input { border: none; outline: none; font-size: .875rem; background: transparent; width: 100%; }
.view-toolbar select, .sort-select {
  border: 1px solid #d1d5db; border-radius: 8px;
  padding: 7px 10px; font-size: .82rem; background: #fff; cursor: pointer;
  color: #374151; outline: none;
}
.sort-select:focus { border-color: #1a56db; }

/* ── Wizard ── */
.wizard-wrap {
  max-width: 680px; margin: 0 auto;
  background: #fff; border: 1px solid #e5e9ef; border-radius: 14px; overflow: hidden;
}
.wizard-header { padding: 18px 26px 0; }
.wizard-steps { display: flex; border-bottom: 1px solid #e5e9ef; padding-bottom: 0; }
.wstep {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 13px 6px 11px; font-size: .75rem; color: #9ca3af; font-weight: 500;
  border-bottom: 2px solid transparent; transition: all .2s;
}
.wstep span {
  width: 24px; height: 24px; border-radius: 50%;
  background: #f3f4f6; color: #9ca3af; font-size: .77rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.wstep.active { color: #1a56db; border-bottom-color: #1a56db; }
.wstep.active span { background: #1a56db; color: #fff; }
.wstep.done { color: #16a34a; }
.wstep.done span { background: #16a34a; color: #fff; }

.wizard-body { padding: 26px; }
.wizard-body h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 3px; }
.step-hint { font-size: .83rem; color: #6b7280; margin-bottom: 20px; }
.wizard-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 26px; padding-top: 18px; border-top: 1px solid #f3f4f6;
}

/* ── Form ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1/-1; }
.form-group label { font-size: .8rem; font-weight: 600; color: #374151; display: flex; align-items: center; gap: 5px; }
.form-group input, .form-group select, .form-group textarea {
  border: 1px solid #d1d5db; border-radius: 7px;
  padding: 8px 11px; font-size: .875rem;
  font-family: inherit; background: #fff; color: #1e2939;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.form-group textarea { resize: vertical; }
.req { color: #ef4444; }
.tooltip-icon {
  display: inline-flex; width: 16px; height: 16px; border-radius: 50%;
  background: #e5e9ef; color: #6b7280; font-size: .68rem; font-weight: 700;
  align-items: center; justify-content: center; cursor: help;
}

/* ── Field hint (SP column availability) ── */
.field-hint { font-size: .74rem; }
.field-hint.warn { color: #b45309; }

/* ── Radio Cards ── */
.radio-cards { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.radio-card {
  border: 2px solid #e5e9ef; border-radius: 9px; padding: 12px;
  cursor: pointer; transition: border-color .12s, background .12s;
  display: flex; flex-direction: column; gap: 3px;
}
.radio-card input[type=radio] { display: none; }
.radio-card .rc-icon  { font-size: 1.3rem; margin-bottom: 3px; }
.radio-card .rc-title { font-size: .83rem; font-weight: 600; color: #1e2939; }
.radio-card .rc-desc  { font-size: .73rem; color: #6b7280; line-height: 1.4; }
.radio-card:has(input:checked) { border-color: #1a56db; background: #eff3ff; }

/* ── Info boxes ── */
.info-box {
  padding: 10px 14px; border-radius: 8px; font-size: .83rem; line-height: 1.5;
}
.info-box.info  { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.info-box.warn  { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.info-box.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ── Review ── */
.review-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.review-section h3 {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: #9ca3af; margin-bottom: 7px;
}
.review-row { display: flex; gap: 6px; padding: 5px 0; border-bottom: 1px solid #f3f4f6; font-size: .85rem; }
.review-row:last-child { border-bottom: none; }
.review-label { color: #9ca3af; min-width: 100px; font-size: .78rem; }
.review-value { font-weight: 500; }

/* ── Detail ── */
.back-btn { margin-bottom: 14px; }
.detail-header { margin-bottom: 16px; }
.detail-header h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.detail-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.item-id { font-size: .78rem; color: #9ca3af; background: #f3f4f6; padding: 2px 8px; border-radius: 999px; }
.detail-byline { font-size: .8rem; color: #9ca3af; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; align-items: start; }
.detail-left .detail-card { margin-bottom: 12px; }
.detail-card { background: #fff; border: 1px solid #e5e9ef; border-radius: 11px; overflow: hidden; }
.detail-card-header {
  padding: 12px 18px; border-bottom: 1px solid #f3f4f6;
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: #6b7280;
  display: flex; align-items: center; justify-content: space-between;
}
.detail-card-body { padding: 14px 18px; }
.detail-row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f9fafb; font-size: .875rem; }
.detail-row:last-child { border-bottom: none; }
.detail-label { color: #9ca3af; min-width: 150px; flex-shrink: 0; font-size: .8rem; }
.detail-value { font-weight: 500; }
.no-order { font-size: .82rem; color: #9ca3af; }

/* ── Version history timeline ── */
.vh-timeline { display: flex; flex-direction: column; }
.vh-item { display: grid; grid-template-columns: 20px 1fr; gap: 0 10px; position: relative; padding-bottom: 16px; }
.vh-item:last-child { padding-bottom: 0; }
.vh-dot-wrap { display: flex; flex-direction: column; align-items: center; }
.vh-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.vh-line { position: absolute; left: 9px; top: 13px; bottom: 0; width: 1.5px; background: #e5e9ef; }
.vh-item:last-child .vh-line { display: none; }
.vh-content { min-width: 0; }
.vh-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.vh-by { font-size: .78rem; font-weight: 600; color: #374151; }
.vh-time { font-size: .72rem; color: #9ca3af; }
.vh-changes { font-size: .78rem; color: #6b7280; line-height: 1.4; }
.vh-changes em { font-style: normal; font-weight: 600; color: #374151; }
.vh-loading, .vh-empty, .vh-error { font-size: .82rem; color: #9ca3af; padding: 8px 0; }
.vh-error { color: #b91c1c; }

/* ── Einkauf modal prefill button ── */
.btn-prefill {
  font-size: .72rem; color: #1a56db; background: #eff3ff; border: none;
  border-radius: 5px; padding: 2px 7px; cursor: pointer; font-weight: 600;
}
.btn-prefill:hover { background: #dbeafe; }

/* ── Approval card ── */
.ap-current-status { margin-bottom: 12px; }
.ap-empty { font-size: .8rem; color: #9ca3af; line-height: 1.5; }

.approval-stages { display: flex; flex-direction: column; gap: 0; }

.approval-stage {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.approval-stage:last-child { border-bottom: none; }

.ap-dot {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0; margin-top: 1px;
}
.ap-ok      { background: #dcfce7; color: #15803d; }
.ap-no      { background: #fee2e2; color: #b91c1c; }
.ap-pending { background: #fef9c3; color: #b45309; }
.ap-neutral { background: #f3f4f6; color: #9ca3af; border: 1px solid #e5e7eb; }

.ap-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.ap-stage-label { font-size: .78rem; font-weight: 600; color: #374151; }
.ap-badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: .75rem; font-weight: 600; width: fit-content;
}
.ap-meta { font-size: .75rem; color: #6b7280; }

.ap-comment-box {
  margin-top: 8px; padding: 8px 10px;
  background: #fef2f2; border-left: 3px solid #f87171;
  border-radius: 6px; font-size: .82rem; color: #7f1d1d; line-height: 1.5;
}

/* ── Empty state ── */
.empty-state {
  padding: 36px 20px; text-align: center; color: #9ca3af;
}
.empty-state svg { width: 36px; height: 36px; margin: 0 auto 8px; display: block; opacity: .25; }
.empty-state p { font-size: .85rem; }

/* ── Buttons ── */
.btn {
  padding: 8px 16px; border-radius: 7px; font-size: .85rem; font-weight: 600;
  border: none; cursor: pointer; transition: all .13s;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: inherit; white-space: nowrap;
}
.btn-primary { background: #1a56db; color: #fff; }
.btn-primary:hover { background: #1648c5; }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-ghost   { background: #f3f4f6; color: #374151; }
.btn-ghost:hover { background: #e5e7eb; }
.btn-outline { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-outline:hover { background: #f9fafb; }
.btn-sm { padding: 5px 11px; font-size: .78rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 13px;
  width: 100%; max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
  padding: 16px 20px; border-bottom: 1px solid #f3f4f6;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: .95rem; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 1.3rem;
  cursor: pointer; color: #9ca3af; padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { background: #f3f4f6; }
.modal-body   { padding: 18px 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #f3f4f6; display: flex; gap: 7px; justify-content: flex-end; }

/* ── Toast ── */
#toast-c { position: fixed; bottom: 22px; right: 22px; z-index: 300; display: flex; flex-direction: column; gap: 7px; }
.toast {
  background: #1e2939; color: #fff; padding: 11px 16px;
  border-radius: 9px; font-size: .85rem; font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,.22);
  display: flex; align-items: center; gap: 8px;
  animation: toastIn .22s ease; max-width: 300px;
  transition: opacity .26s, transform .26s;
}
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }
.toast.out     { opacity: 0; transform: translateY(10px); }
@keyframes toastIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }


/* ── Status Chips (Dashboard Filter Bar) ── */
.status-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px 10px;
  background: #fff;
  border-bottom: 1px solid #e5e9ef;
}
.sc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid #e5e9ef;
  background: #f9fafb;
  color: #374151;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
  white-space: nowrap;
}
.sc-chip:hover {
  border-color: #9ca3af;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.sc-chip.active {
  border-color: var(--sc-color, #1d4ed8);
  background: var(--sc-bg, #eff6ff);
  color: var(--sc-color, #1d4ed8);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--sc-color, #1d4ed8) 20%, transparent);
}
.sc-chip .sc-icon  { font-size: .78rem; line-height: 1; }
.sc-chip .sc-label { font-size: .82rem; }
.sc-chip .sc-count {
  font-size: .72rem; font-weight: 700;
  padding: 1px 7px; border-radius: 999px;
  background: #e5e9ef; color: #374151;
  min-width: 20px; text-align: center;
  transition: background .15s, color .15s;
}
.sc-volume {
  margin-left: auto;
  font-size: .82rem;
  font-weight: 700;
  color: #374151;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.2;
}
.sc-volume small { font-size: .68rem; font-weight: 400; color: #9ca3af; }

/* ── Kanban Board ── */
.kb-board {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 16px 16px;
  scrollbar-width: thin;
}
.kb-board::-webkit-scrollbar { height: 5px; }
.kb-board::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

.kb-col {
  flex: 1;
  min-width: 145px;
  max-width: 220px;
  background: var(--kb-bg, #f9fafb);
  border: 1.5px solid var(--kb-border, #e5e9ef);
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.kb-col-hdr {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px 7px;
  background: var(--kb-bg, #f9fafb);
  border-bottom: 1px solid var(--kb-border, #e5e9ef);
  position: sticky;
  top: 0;
}
.kb-col-icon  { font-size: .82rem; }
.kb-col-label { font-size: .75rem; font-weight: 700; flex: 1; color: #374151; }
.kb-col-count {
  font-size: .7rem; font-weight: 700;
  padding: 1px 7px; border-radius: 999px;
  border: 1.5px solid;
  line-height: 1.6;
}
.kb-col-body  { display: flex; flex-direction: column; gap: 0; padding: 6px 6px 8px; flex: 1; }

.kb-mini {
  background: #fff;
  border: 1px solid #e5e9ef;
  border-radius: 7px;
  padding: 7px 9px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.kb-mini:hover { box-shadow: 0 2px 8px rgba(0,0,0,.09); border-color: #c7d0e0; }
.kb-mini:last-child { margin-bottom: 0; }
.kb-mini-title { font-size: .76rem; font-weight: 600; color: #1e2939; line-height: 1.3; margin-bottom: 3px; }
.kb-mini-wg   { font-size: .68rem; color: #3730a3; background: #eff3ff; border-radius: 4px; padding: 1px 5px; display: inline-block; margin-bottom: 3px; }
.kb-mini-foot { font-size: .67rem; color: #9ca3af; }
.kb-empty     { font-size: .75rem; color: #c4c9d4; text-align: center; padding: 10px 0; }
.kb-more      { font-size: .72rem; color: #6b7280; text-align: center; padding: 4px 0; cursor: default; }

/* ── TID match hint ── */
.tid-match   { margin-top: 5px; font-size: .8rem; border-radius: 6px; padding: 5px 10px; background: #f0f9ff; }
.tid-ok      { color: #15803d; font-weight: 600; }
.tid-wg      { color: #6b7280; margin-left: 8px; }
.tid-miss    { color: #b45309; }

/* ── Responsive ── */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dash-cols  { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .content { padding: 14px; }
  .stats-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .radio-cards { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
}
