:root {
  --demo-h: 34px;
  --bg-app: #F4F1EC;
  --bg-column: #EFEBE3;
  --bg-card: #FFFFFF;
  --border-soft: #ECE7DE;
  --border-soft2: #E2DBCD;
  --shadow-card: 0 1px 3px rgba(120,100,70,0.06);
  --text-strong: #3D3528;
  --text-body: #7A6F5C;
  --text-muted: #B0A593;
  --st-todo: #C2410C;
  --st-doing: #B08415;
  --st-done: #3B7A52;
  --ch-rakuten-bg: #FDF0E3;  --ch-rakuten-fg: #9A5511;
  --ch-amazon-bg:  #FBF1DF;  --ch-amazon-fg:  #8A6A14;
  --ch-yahoo-bg:   #FCE9E6;  --ch-yahoo-fg:   #A8392B;
  --ch-shop-bg: #E6F1EA;  --ch-shop-fg: #2F6B4F;
  --ch-line-bg:    #E8F3E4;  --ch-line-fg:    #3B7A2E;
  --ch-instagram-bg: #F7E9F0; --ch-instagram-fg: #9B3B6E;
  --ch-phone-bg:   #EAF0EE;  --ch-phone-fg:   #2F5D57;
  --ai-auto-bg: #E8F3EE;  --ai-auto-fg: #1F7A5A;
  --ai-human-bg:#FBEAF0;  --ai-human-fg:#99355C;
  --sent-pos: #1F7A5A;
  --sent-neu: #C9BCA6;
  --sent-neg: #C2410C;
  --r-card: 14px;
  --r-col: 16px;
  --r-badge: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding-top: var(--demo-h);
  background: var(--bg-app);
  color: var(--text-body);
  font-family: "Inter", "Noto Sans JP", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.demo-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 16px; font-size: 12px; line-height: 1.5;
  background: #3D3528; color: #F4F1EC;
}
.demo-bar .demo-tag { flex: none; font-weight: 700; font-size: 11px; background: #F4D9A8; color: #3D3528; border-radius: 999px; padding: 1px 9px; }
.demo-bar .demo-msg { flex: 1 1 260px; min-width: 0; }
.demo-bar a { flex: none; color: #F4D9A8; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.app-header {
  position: sticky; top: var(--demo-h); z-index: 30;
  background: rgba(244,241,236,0.94);
  backdrop-filter: saturate(120%) blur(6px);
  border-bottom: 1px solid var(--border-soft2);
  padding: 12px 18px 10px;
}
.ops-hours { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11px; color: var(--text-muted);
  padding: 2px 2px 7px; margin-bottom: 8px; border-bottom: 1px dashed var(--border-soft2); }
.ops-hours b { color: var(--text-strong); font-weight: 600; }
.ops-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #7fa06a; box-shadow: 0 0 0 3px rgba(127,160,106,.16); }
.ops-status { font-weight: 600; color: var(--text-strong); }
.ops-sep { color: var(--border-soft2); }

.brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-mark { width: 14px; height: 14px; border-radius: 5px; background: linear-gradient(150deg, #C9A98A, #9A5511); }
.brand h1 { font-size: 17px; font-weight: 700; color: var(--text-strong); margin: 0; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--text-muted); padding: 2px 8px; border: 1px solid var(--border-soft2); border-radius: 999px; }

.toolbar { display: flex; align-items: flex-end; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field.grow { flex: 1; min-width: 160px; }
.field label { font-size: 10px; color: var(--text-muted); padding-left: 2px; }
.select, .input {
  font: inherit; color: var(--text-strong); background: var(--bg-card);
  border: 1px solid var(--border-soft2); border-radius: 10px;
  padding: 7px 10px; min-height: 36px; outline: none; max-width: 100%;
}
.select.sm, .input.sm { min-height: 32px; padding: 5px 8px; border-radius: 8px; font-size: 13px; }
.select:focus, .input:focus { border-color: #CDBBA0; box-shadow: 0 0 0 3px rgba(154,85,17,0.08); }

.btn {
  font: inherit; cursor: pointer; border-radius: 10px; padding: 8px 12px; min-height: 36px;
  border: 1px solid var(--border-soft2); background: var(--bg-card); color: var(--text-strong);
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, border-color .15s;
  text-decoration: none;
}
.btn:hover { background: #FAF7F1; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 32px; padding: 6px 10px; font-size: 13px; }
.btn.icon { padding: 6px; width: 36px; justify-content: center; }
.btn.primary { background: var(--st-done); border-color: var(--st-done); color: #fff; }
.btn.primary:hover { background: #336B47; }
.btn.subtle { background: #F3EEE5; }
.btn:disabled { opacity: .5; cursor: default; }
.ic-close::before { content: "✕"; font-size: 14px; }

.safety-tag {
  margin-left: auto; align-self: center; font-size: 11px; font-weight: 600;
  color: #8A6A14; background: #FBF1DF; border: 1px solid #EAD8AE;
  border-radius: 999px; padding: 4px 10px;
}

.col-tabs { display: none; gap: 6px; padding: 10px 14px 0; }
.col-tab {
  flex: 1; font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border-soft2); background: var(--bg-card); color: var(--text-body);
  border-radius: 10px; padding: 8px; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.col-tab.is-active { background: #fff; color: var(--text-strong); border-color: #CDBBA0; font-weight: 600; }
.col-tab b { font-size: 12px; color: var(--text-muted); }

.board {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  padding: 14px 18px 28px; align-items: start; max-width: 1500px; margin: 0 auto;
}
.column {
  background: var(--bg-column); border: 1px solid var(--border-soft);
  border-radius: var(--r-col); padding: 10px; min-height: 62vh;
  display: flex; flex-direction: column; min-width: 0;
}
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; color: var(--text-strong); font-weight: 600; font-size: 13px; }
.col-head .count { margin-left: auto; font-size: 12px; color: var(--text-muted); font-weight: 600;
  background: #fff; border: 1px solid var(--border-soft2); border-radius: 999px; padding: 1px 9px; }
.col-body { display: flex; flex-direction: column; gap: 9px; flex: 1 1 auto; min-height: 140px; }
.col-body.drop-target { outline: 2px dashed #CDBBA0; outline-offset: 3px; border-radius: 12px; background: #F7F2E9; }

.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.st-todo { background: var(--st-todo); }
.st-doing { background: var(--st-doing); }
.st-done { background: var(--st-done); }

.card {
  background: var(--bg-card); border: 1px solid var(--border-soft);
  border-radius: var(--r-card); padding: 13px; box-shadow: var(--shadow-card);
  cursor: pointer; transition: border-color .15s, transform .08s, box-shadow .3s; position: relative; min-width: 0;
}
.card:hover { border-color: var(--border-soft2); }
.card:active { transform: scale(0.997); }
.card.dragging { opacity: .55; }
.card.flash { box-shadow: 0 0 0 3px rgba(59,122,82,.35); border-color: var(--st-done); }
.card.is-new::after {
  content: ""; position: absolute; top: 11px; right: 11px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--st-todo);
  box-shadow: 0 0 0 3px rgba(194,65,12,0.12);
}
.card-row1 { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; flex-wrap: wrap; padding-right: 12px; }
.ch-badge {
  font-size: 11px; font-weight: 600; border-radius: var(--r-badge); padding: 2px 8px;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  background: var(--ch-rakuten-bg); color: var(--ch-rakuten-fg);
}
.ch-badge::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: currentColor; opacity: .8; }
.ch-rakuten { background: var(--ch-rakuten-bg); color: var(--ch-rakuten-fg); }
.ch-amazon  { background: var(--ch-amazon-bg);  color: var(--ch-amazon-fg); }
.ch-yahoo   { background: var(--ch-yahoo-bg);   color: var(--ch-yahoo-fg); }
.ch-shop { background: var(--ch-shop-bg); color: var(--ch-shop-fg); }
.ch-line    { background: var(--ch-line-bg);    color: var(--ch-line-fg); }
.ch-instagram { background: var(--ch-instagram-bg); color: var(--ch-instagram-fg); }
.ch-phone   { background: var(--ch-phone-bg);   color: var(--ch-phone-fg); }

.cat-chip { font-size: 11px; color: var(--text-body); background: #F3EEE5; border: 1px solid var(--border-soft2); border-radius: var(--r-badge); padding: 2px 8px; white-space: nowrap; }
.sent-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--sent-neu); flex: none; }
.sent-pos { background: var(--sent-pos); }
.sent-neu { background: var(--sent-neu); }
.sent-neg { background: var(--sent-neg); }

.ai-badge { font-size: 10.5px; font-weight: 600; border-radius: var(--r-badge); padding: 2px 7px; margin-left: auto; white-space: nowrap; }
.ai-auto  { background: var(--ai-auto-bg);  color: var(--ai-auto-fg); }
.ai-human { background: var(--ai-human-bg); color: var(--ai-human-fg); }
.ai-assist { background: #FBF1DD; color: #9A6B16; }
.ai-sent { background: #EEF4EF; color: #2C4A37; }
.assist-warn { font-size: 11.5px; line-height: 1.5; color: #9A6B16; background: #FBF1DD; border: 1px solid #E8D6A8; border-radius: 8px; padding: 7px 10px; margin-bottom: 8px; }

.card-customer { color: var(--text-strong); font-weight: 600; font-size: 13.5px; }
.card-order { color: var(--text-muted); font-size: 11px; margin-left: 6px; font-weight: 400; }
.wait-chip { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.wait-ok    { background: #EEF2F6; color: #55606B; }
.wait-warn  { background: #FDF1DC; color: #8A5A11; }
.wait-alert { background: #FBE3E3; color: #A32A2A; }
.card-preview {
  color: var(--text-body); font-size: 12.5px; margin: 5px 0 9px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word;
}
.card-foot { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: #EFE7D8; color: #8A7A5E; border: 1px solid var(--border-soft2);
}
.avatar.none { color: var(--text-muted); }
.card-elapsed { font-size: 11px; color: var(--text-muted); }
.card-rms { margin-left: auto; font-size: 11px; color: #9A5511; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; font-family: inherit; cursor: pointer; }
.card-rms:hover { text-decoration: underline; }

.panel-scrim { position: fixed; inset: 0; background: rgba(61,53,40,0.22); z-index: 40; }
.detail-panel {
  position: fixed; top: calc(50% + var(--demo-h) / 2); left: 50%; transform: translate(-50%, -50%);
  width: 94vw; min-width: 440px; max-width: 1680px; height: calc(94vh - var(--demo-h)); max-height: calc(94vh - var(--demo-h));
  background: #FBF9F5; border: 1px solid var(--border-soft2); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(90,72,45,0.24);
  z-index: 50; display: flex; flex-direction: column; overflow: hidden; animation: modalIn .16s ease;
}
@keyframes modalIn { from { opacity: .4; } to { opacity: 1; } }

.dp-cols { flex: 1 1 auto; display: flex; min-height: 0; }
.dp-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dp-col.left { flex: 1 1 auto; }
.dp-col.right { flex: 0 0 auto; width: 40%; min-width: 380px; background: #F7F3EC; }
.dp-colhead {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 8px 16px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--text-muted);
  background: #F2ECE2; border-bottom: 1px solid var(--border-soft); border-top: 1px solid var(--border-soft);
}
.dp-split {
  flex: 0 0 auto; width: 14px; cursor: col-resize; display: flex; align-items: center; justify-content: center;
  background: #F2ECE2; border-left: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft);
}
.dp-split:hover { background: #EBE3D5; }
.dp-split .grip { width: 0; height: 30px; border-left: 2px solid #BFB29A; box-shadow: 4px 0 0 #BFB29A, -4px 0 0 #BFB29A; }

@media (min-width: 901px) {
  .dp-ai { display: flex; }
  .dp-ai > .ai-card { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; max-width: none; }
  .dp-ai > .ai-card > textarea, .dp-ai > .ai-card > .ta-wrap > textarea { flex: 1 1 auto; min-height: 160px; }
  .dp-ai > .ai-card > textarea { overflow-y: auto; }
  .dp-ai > .ai-card > .memo { flex: 0 1 auto; overflow-y: auto; }
}
@media (max-width: 900px) {
  .dp-cols { flex-direction: column; }
  .dp-col.left { flex: 1 1 auto; min-height: 140px; }
  .dp-col.right { width: auto !important; min-width: 0; height: 52vh; flex: 0 0 auto; }
  .dp-split { width: auto; height: 16px; cursor: row-resize;
    border-left: none; border-right: none; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
  .dp-split .grip { width: 30px; height: 0; border-left: none; border-top: 2px solid #BFB29A; box-shadow: 0 4px 0 #BFB29A, 0 -4px 0 #BFB29A; }
}

.dp-head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--border-soft); }
.dp-titlewrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.dp-titlewrap strong { color: var(--text-strong); font-size: 15px; margin-left: 2px; }
.dp-head .btn.icon { margin-left: auto; flex: 0 0 auto; }
.muted { color: var(--text-muted); font-size: 12px; margin-left: 6px; }
.dp-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.rms-link { font: inherit; cursor: pointer; font-size: 12px; color: #9A5511; text-decoration: none; display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid #EAD8AE; background: #FDF0E3; border-radius: 8px; padding: 5px 9px; white-space: nowrap; }
.rms-link:hover { background: #FBE7D2; }

.dp-controls { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-bottom: 1px solid var(--border-soft); flex-wrap: wrap; }
.dp-controls .ctl { align-items: flex-start; }
.dp-controls .dp-review { margin: 0; }
.dp-controls #dpExtraBtn[aria-expanded="true"] { background: #F3EEE5; border-color: #CDBBA0; color: var(--text-strong); }
.ctl { display: flex; flex-direction: column; gap: 3px; font-size: 10px; color: var(--text-muted); }

.dp-body { flex: 1 1 auto; min-height: 80px; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: min(86%, 900px); padding: 9px 12px; border-radius: 12px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.msg .mt { font-size: 10px; color: var(--text-muted); margin-top: 5px; }
.msg.customer { align-self: flex-start; background: #fff; border: 1px solid var(--border-soft2); color: var(--text-strong); border-top-left-radius: 4px; }
.msg.store { align-self: flex-end; background: #EEF4EF; border: 1px solid #D6E6DA; color: #2C4A37; border-top-right-radius: 4px; }
.msg .pseudo-tag { display: inline-block; font-size: 9.5px; font-weight: 600; color: #8A6A14; background: #FBF1DF; border-radius: 6px; padding: 1px 6px; margin-bottom: 4px; }
.msg .attach { display: inline-block; margin-top: 6px; font-size: 11px; color: var(--text-muted); border: 1px dashed var(--border-soft2); border-radius: 6px; padding: 2px 8px; }

.dp-ai { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 16px 16px; background: #F7F3EC; }
.ai-card { background: #fff; border: 1px solid var(--border-soft2); border-radius: 12px; padding: 12px; max-width: 1180px; margin: 0 auto; min-width: 0; }
.ai-card .ai-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--text-strong); }
.ai-card .ai-head .btn.expand { margin-left: auto; flex: 0 0 auto; font-size: 11px; padding: 3px 9px; min-height: 28px; }
.ai-card .ai-head .ai-badge { flex: 0 0 auto; margin-left: 0; }
.ai-card .ai-head .muted { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-card textarea {
  width: 100%; font: inherit; font-size: 13px; color: var(--text-strong); line-height: 1.6;
  border: 1px solid var(--border-soft2); border-radius: 10px; padding: 10px; min-height: 240px; resize: vertical; background: #FCFBF8;
}
.ai-card textarea:focus { outline: none; border-color: #CDBBA0; box-shadow: 0 0 0 3px rgba(154,85,17,0.07); }
.ai-card textarea.composing { background: #F6F1E6; color: var(--text-muted); }
.detail-panel.editor-max .dp-col.left,
.detail-panel.editor-max .dp-extra,
.detail-panel.editor-max .dp-split { display: none; }
.detail-panel.editor-max .dp-col.right { flex: 1 1 auto; width: auto !important; height: auto; }
.memo { white-space: pre-wrap; font-size: 13px; color: var(--text-body); background: #fff; border: 1px solid var(--border-soft2); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.ai-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.note-line { font-size: 11px; color: var(--text-muted); margin-top: 8px; }
.compose-help { margin-left: 8px; white-space: nowrap; font-size: 11px; font-weight: 600; color: var(--st-done); border: 1px solid #CFE0D5; background: #EDF3EE; border-radius: 999px; padding: 1px 8px; text-decoration: none; cursor: pointer; font-family: inherit; }

.skeleton { background: linear-gradient(90deg, #F1ECE2 25%, #F7F3EB 37%, #F1ECE2 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sk-card { height: 96px; border-radius: var(--r-card); margin-bottom: 9px; }
.empty { color: var(--text-muted); font-size: 12px; text-align: center; padding: 22px 8px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  max-width: calc(100vw - 32px); width: max-content;
  background: var(--text-strong); color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 10px;
  z-index: 300; box-shadow: 0 6px 20px rgba(61,53,40,0.22); animation: toastIn .2s ease; }
.toast.err { background: #8A2D1A; }
@keyframes toastIn { from { opacity: 0; } to { opacity: 1; } }

.dp-review { display: flex; align-items: center; gap: 7px; padding: 5px 11px; white-space: nowrap;
  background: #FBF1DF; border: 1px solid #EAD8AE; border-radius: 999px; cursor: pointer; font-size: 12.5px; color: var(--text-strong); }
.dp-review input { width: 17px; height: 17px; accent-color: var(--st-done); cursor: pointer; }

.dp-extra { border-bottom: 1px solid var(--border-soft); padding: 6px 16px 12px; }
.dp-extra:not([open]) { display: none; }
.dp-extra > summary { display: none; }
.extra-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.extra-grid .ctl.wide { grid-column: 1 / -1; }
.extra-note { font-size: 10.5px; color: var(--text-muted); margin-top: 8px; }
.reason-field { margin-top: 10px; }
.reason-field label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.reason-field input { width: 100%; min-width: 0; font: inherit; font-size: 12.5px; color: var(--text-strong); border: 1px solid var(--border-soft2); border-radius: 8px; padding: 7px 9px; background: #FCFBF8; }
.reason-field input:focus { outline: none; border-color: #CDBBA0; }
.reason-row { display: flex; gap: 6px; }
.reason-row input { flex: 1; }
.quick-compose { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.quick-compose .muted { font-size: 11px; margin-left: 0; }
.quick-compose .btn { font-size: 12px; padding: 4px 10px; min-height: 30px; }

.sched-field { margin-top: 10px; }
.sched-field > label { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.sched-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sched-row .select.sm { min-width: 78px; }
.sched-note { margin-top: 4px; font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.sched-banner { margin: 0 0 10px; padding: 9px 11px; border-radius: 10px; background: #FDF0E3; border: 1px solid #E7C89E; color: #8A4E0D; font-size: 12.5px; }
.sched-banner .sched-when { font-weight: 700; display: block; }
.sched-banner .sched-body { margin: 4px 0 6px; font-size: 12px; color: #6E4715; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.af-wrap { margin: 8px 16px; }
.af-ship { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; background: #FAF7F1; border: 1px solid var(--border-soft2); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; color: var(--text-body); }
.af-badge { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #EFEBE3; color: var(--text-strong); border: 1px solid var(--border-soft2); }
.af-badge.ok   { background: #E8F3EE; color: #1F7A5A; border-color: #C7E4D8; }
.af-badge.wip  { background: #FBF3E0; color: #8A6A14; border-color: #EBDCB6; }
.af-kv b { font-weight: 700; color: var(--text-strong); margin-right: 5px; font-size: 11.5px; }
.af-muted { color: var(--text-muted); font-size: 11.5px; }
.af-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.af-btn { font: inherit; font-size: 12px; font-weight: 600; color: var(--text-strong); background: #fff; border: 1px solid var(--border-soft2); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.af-btn:hover { background: #F6F1E8; }
.af-btn.primary { background: #3D3528; color: #fff; border-color: #3D3528; }
.ship-chip { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #EFEBE3; color: var(--text-body); border: 1px solid var(--border-soft2); white-space: nowrap; }
.ship-chip.ok   { background: #E8F3EE; color: #1F7A5A; border-color: #C7E4D8; }
.ship-chip.wip  { background: #FBF3E0; color: #8A6A14; border-color: #EBDCB6; }

.modal-scrim { position: fixed; inset: 0; background: rgba(61,53,40,0.34); z-index: 60; }
.modal { position: fixed; z-index: 61; top: calc(50% + var(--demo-h) / 2); left: 50%; transform: translate(-50%,-50%);
  width: min(560px, 94vw); max-height: calc(88vh - var(--demo-h)); background: var(--bg-card); border: 1px solid var(--border-soft2);
  border-radius: 16px; box-shadow: 0 14px 44px rgba(61,53,40,0.26); display: flex; flex-direction: column; overflow: hidden; animation: modalIn .16s ease; }
.modal.lg { width: min(820px, 96vw); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.modal-head h2 { font-size: 17px; margin: 0; color: var(--text-strong); font-weight: 700; }
.modal-head .btn.icon { margin-left: auto; }
.modal-body { padding: 16px 20px; overflow-y: auto; color: var(--text-body); font-size: 14px; line-height: 1.7; }
.modal-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.modal-body .ctl.wide { margin-top: 8px; }
.modal-body textarea.input { width: 100%; font-family: inherit; resize: vertical; line-height: 1.6; }

.man-sec { margin: 0 0 20px; }
.man-sec h3 { font-size: 15px; color: var(--text-strong); font-weight: 700; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--border-soft2); }
.man-sec p { margin: 6px 0; }
.man-sec b { color: var(--text-strong); }
.man-lead { margin: 0 0 14px; }
.man-note { font-size: 13px; background: #FBF6EC; border-left: 3px solid var(--st-doing); padding: 8px 12px; border-radius: 6px; margin: 8px 0; }
.man-ul { margin: 6px 0; padding-left: 18px; } .man-ul li { margin: 5px 0; }
.flow { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; margin: 10px 0; }
.flow-step { flex: 1; min-width: 92px; background: var(--bg-card); border: 1px solid var(--border-soft2); border-radius: 10px; padding: 8px; text-align: center; font-size: 12px; }
.flow-step b { display: block; font-size: 15px; color: var(--text-strong); }
.flow-step.send { background: var(--ai-auto-bg); border-color: var(--ai-auto-fg); }
.flow-step.done { background: #E9F2EC; border-color: var(--st-done); }
.flow-a { align-self: center; color: var(--text-muted); font-weight: 700; }
.imp-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.imp-item { background: var(--bg-column); border-radius: 8px; padding: 8px 10px; font-size: 13px; white-space: pre-wrap; }
.imp-item .imp-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.imp-history { margin-top: 16px; border-top: 1px solid var(--border-soft); padding-top: 10px; }
.imp-history summary { cursor: pointer; font-weight: 600; }
.phone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.phone-resolved { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 6px; font-weight: 600; font-size: 12px; color: var(--text-strong); }

.adm-wrap { max-width: 1400px; margin: 0 auto; padding: 14px 18px 28px; }
.adm-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--r-card); padding: 14px; box-shadow: var(--shadow-card); text-align: center; min-width: 0; }
.kpi-v { font-size: 24px; font-weight: 700; color: var(--text-strong); }
.kpi-v .u { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-left: 2px; }
.kpi-k { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.kpi.over .kpi-v { color: var(--st-todo); }
.kpi.check .kpi-v { color: var(--st-doing); }
.kpi.auto .kpi-v { color: var(--st-done); }
.adm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.panel-box { background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--r-col); padding: 14px; box-shadow: var(--shadow-card); min-width: 0; overflow: hidden; }
.panel-box.wide { grid-column: 1 / -1; }
.panel-box.top { margin-bottom: 14px; }
.adm-h { font-size: 14px; font-weight: 600; color: var(--text-strong); margin: 0 0 12px; }
.adm-h small { color: var(--text-muted); font-weight: 400; font-size: 11px; }
.adm-subh { font-size: 12px; font-weight: 600; color: var(--text-body); margin: 14px 0 8px; }
.back-link { font-size: 12px; color: #9A5511; text-decoration: none; align-self: center; }
.back-link:hover { text-decoration: underline; }

.tbl-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.mtable th { text-align: right; font-weight: 600; color: var(--text-muted); font-size: 11px; padding: 4px 8px; border-bottom: 1px solid var(--border-soft2); white-space: nowrap; }
.mtable th:first-child { text-align: left; }
.mtable td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--border-soft); color: var(--text-body); white-space: nowrap; }
.mtable td.c0 { text-align: left; color: var(--text-strong); font-weight: 500; }

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }
.bar-label { width: 36%; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 14px; background: #EFE9DD; border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #C9A98A, #9A5511); border-radius: 7px; transition: width .3s; }
.bar-val { width: 44px; text-align: right; color: var(--text-body); }

.big-rate { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.big-num { font-size: 30px; font-weight: 700; color: var(--st-done); }
.big-sub { font-size: 11px; color: var(--text-muted); }
.kv-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); font-size: 13px; }
.kv-k { color: var(--text-body); } .kv-v { color: var(--text-strong); font-weight: 600; text-align: right; }

.adm-h.has-toggle { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.adm-h.has-toggle .tr-toggle { margin-left: auto; }
.tr-toggle { display: inline-flex; position: relative; z-index: 4; border: 1px solid var(--border-soft2); border-radius: 7px; overflow: hidden; }
.tr-tab { border: 0; background: transparent; padding: 3px 11px; font: inherit; font-size: 11px; color: var(--text-body); cursor: pointer; }
.tr-tab.on { background: var(--text-strong); color: #fff; font-weight: 600; }
.tr-chart { margin-top: 4px; }
.tr-plot { position: relative; padding: 16px 0 0 34px; }
.tr-yaxis { position: absolute; left: 0; top: 16px; width: 30px; height: 170px; }
.tr-y-l { position: absolute; right: 0; transform: translateY(50%); font-size: 10px; color: var(--text-muted); }
.tr-scroll { overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.tr-inner { min-width: 100%; display: inline-block; }
.tr-bars-area { position: relative; height: 170px; }
.tr-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--border-soft2); }
.tr-target { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--st-done); z-index: 3; }
.tr-target-l { position: absolute; right: 0; top: -15px; font-size: 10px; font-weight: 600; color: var(--st-done); background: var(--bg-card); padding: 0 4px; border-radius: 3px; }
.tr-cols, .tr-xaxis { display: flex; align-items: flex-end; gap: 6px; }
.tr-cols { position: absolute; inset: 0; z-index: 2; }
.tr-col, .tr-x { flex: 1 0 52px; min-width: 52px; }
.tr-col { height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.tr-bar { width: 15px; border-radius: 3px 3px 0 0; position: relative; transition: height .2s; }
.tr-bar.edit { background: linear-gradient(180deg, #C2410C, #9A5511); }
.tr-bar.edit.ok { background: linear-gradient(180deg, #4E9068, #3B7A52); }
.tr-bar.unmod { background: #CFC4AE; }
.tr-bar-v { position: absolute; top: -15px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.tr-x { padding-top: 7px; text-align: center; line-height: 1.35; }
.tr-x-l { display: block; font-size: 10.5px; color: var(--text-body); }
.tr-x-n { display: block; font-size: 9.5px; color: var(--text-muted); }
.tr-legend { display: flex; gap: 16px; justify-content: center; margin-top: 6px; font-size: 11px; color: var(--text-body); flex-wrap: wrap; }
.tr-lg-item { display: inline-flex; align-items: center; gap: 5px; }
.tr-sw { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.tr-sw.edit { background: #9A5511; } .tr-sw.unmod { background: #CFC4AE; }
.tr-delta { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--text-body); }
.tr-diff { font-weight: 700; margin-left: 2px; }
.tr-diff.good { color: var(--st-done); } .tr-diff.bad { color: var(--st-todo); }

.ln-wrap { position: relative; }
.ln-svg { display: block; width: 100%; height: auto; overflow: visible; }
.ln-svg text { font-size: 10px; fill: var(--text-muted); font-family: inherit; }
.ln-grid { stroke: var(--border-soft2); stroke-dasharray: 3 3; }
.ln-line { fill: none; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.ln-line.total { stroke-width: 2.4; }
.ln-hover { stroke: #CDBBA0; stroke-width: 1; }
.ln-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 11px; color: var(--text-body); }
.ln-legend button { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; color: inherit; }
.ln-legend button.off { opacity: .35; }
.ln-legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.ln-tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--border-soft2); border-radius: 8px; padding: 7px 9px; font-size: 11.5px; color: var(--text-strong); box-shadow: 0 6px 18px rgba(61,53,40,.14); white-space: nowrap; z-index: 5; }
.ln-tip b { display: block; margin-bottom: 2px; }
.ln-tip span { display: flex; align-items: center; gap: 5px; }
.ln-tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.ln-note { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

.asg-add { display: flex; gap: 8px; margin-bottom: 12px; }
.asg-add .input { flex: 1; min-width: 0; }
.asg-list { display: flex; flex-direction: column; gap: 6px; }
.asg-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: 10px; flex-wrap: wrap; }
.asg-row.off { opacity: .55; }
.asg-name { color: var(--text-strong); font-weight: 600; }
.asg-badge { font-size: 10px; color: #99355C; background: #FBEAF0; border-radius: 6px; padding: 1px 7px; }

@media (max-width: 820px) {
  .col-tabs { display: flex; }
  .board { grid-template-columns: 1fr; padding: 10px 12px 24px; }
  .column { display: none; }
  .column.is-active { display: flex; }
  .detail-panel { width: 100%; max-width: 100%; min-width: 0; height: calc(100% - var(--demo-h)); max-height: none;
    top: var(--demo-h); left: 0; transform: none; border-radius: 0; }
  .extra-grid { grid-template-columns: 1fr; }
  .adm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-grid { grid-template-columns: 1fr; }
  .app-header { padding: 10px 12px 8px; position: static; }
  .adm-wrap { padding: 12px 12px 24px; }
  .safety-tag { margin-left: 0; }
}
@media (max-width: 720px) {
  .modal, .modal.lg { width: 100vw; height: calc(100% - var(--demo-h)); max-height: none; top: var(--demo-h); left: 0; transform: none; border-radius: 0; }
  .flow { flex-direction: column; }
  .flow-a { transform: rotate(90deg); }
  .tr-col, .tr-x { flex: 0 0 46px; min-width: 46px; }
  .phone-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .toolbar { gap: 8px; }
  .toolbar .field:not(.grow) { flex: 1 1 40%; }
  .toolbar .field .select { width: 100%; }
  .toolbar .field.grow { flex: 1 1 100%; min-width: 0; }
  .toolbar .btn { padding: 6px 10px; min-height: 32px; font-size: 12.5px; }
  .brand-sub { display: none; }
  .ops-hours .ops-long { display: none; }
  .dp-head { padding: 8px 10px; }
  .dp-controls { padding: 7px 10px; gap: 6px; }
  .dp-body, .dp-ai { padding: 10px; }
  .af-wrap { margin: 8px 10px; }
  .bar-label { width: 42%; }
  .demo-bar { padding: 5px 12px; font-size: 11px; gap: 8px; flex-wrap: nowrap; align-items: flex-start; }
  .demo-bar .demo-tag { display: none; }
  .demo-bar .demo-msg { flex: 1 1 0; }
  .af-actions { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .af-btn { flex: none; }
  .tr-target-l { right: auto; left: 0; }
  .kpi-v { font-size: 21px; }
}
