/* ============================================================
   SHO-HAN comm-styles.css  v2 — Modular Editorial
   Drop-in replacement for legacy /comm-styles.css.
   Bridges the legacy class names (.app-bar, .btn, .input, .card,
   .modal, .toast, .chip, .switch, .spinner, .avatar) to the v2
   design tokens so 10+ pages (mitsumori / kaikei / knowledge /
   chat / call / customers / custom / dashboard / settings /
   admin) upgrade with one CSS swap and a single data-mod
   attribute on <body>.
   Light/Dark via [data-theme]; module accent via [data-mod].
   ============================================================ */

@import url("/assets/shohan-tokens.css");

/* =========================================================
   Module accent — fall back to navy when no data-mod set
   ========================================================= */
:root, body { --m: var(--sh-navy); --m-d: var(--sh-navy-2); --m-l: var(--sh-blue-tint); }
body[data-mod="E"] { --m: var(--sh-mod-e); --m-d: var(--sh-mod-e-d); --m-l: var(--sh-mod-e-l); }
body[data-mod="A"] { --m: var(--sh-mod-a); --m-d: var(--sh-mod-a-d); --m-l: var(--sh-mod-a-l); }
body[data-mod="B"] { --m: var(--sh-mod-b); --m-d: var(--sh-mod-b-d); --m-l: var(--sh-mod-b-l); }
body[data-mod="C"] { --m: var(--sh-mod-c); --m-d: var(--sh-mod-c-d); --m-l: var(--sh-mod-c-l); }
body[data-mod="D"] { --m: var(--sh-mod-d); --m-d: var(--sh-mod-d-d); --m-l: var(--sh-mod-d-l); }
body[data-mod="J"] { --m: var(--sh-mod-j); --m-d: var(--sh-mod-j-d); --m-l: var(--sh-mod-j-l); }
body[data-mod="H"] { --m: var(--sh-mod-h); --m-d: var(--sh-mod-h-d); --m-l: var(--sh-mod-h-l); }
body[data-mod="I"] { --m: var(--sh-mod-i); --m-d: var(--sh-mod-i-d); --m-l: var(--sh-mod-i-l); }
body[data-mod="F"] { --m: var(--sh-mod-f); --m-d: var(--sh-mod-f-d); --m-l: var(--sh-mod-f-l); }
body[data-mod="G"] { --m: var(--sh-mod-g); --m-d: var(--sh-mod-g-d); --m-l: var(--sh-mod-g-l); }

/* =========================================================
   Legacy aliases — page inline-styles still reference --navy /
   --navy-600 / --navy-50 / --on-surface etc. We map those to
   the module-accent (--m) so inline rules automatically pick up
   the page's accent color. Real navy stays available via
   --sh-navy / --sh-side-bg for chrome (sidebar, app-bar gradient
   in jobs-styles.css, etc).
   ========================================================= */
:root, body {
  --navy:             var(--m);
  --navy-700:         var(--m-d);
  --navy-600:         var(--m-d);
  --navy-50:          var(--m-l);
  --accent:           var(--sh-blue);
  --surface:          var(--sh-surface);
  --surface-2:        var(--sh-bg-2);
  --surface-3:        var(--sh-panel);
  --on-surface:       var(--sh-ink);
  --on-surface-muted: var(--sh-ink-3);
  --outline:          var(--sh-line);
  --danger:           var(--sh-coral);
  --danger-bg:        var(--sh-coral-tint);
  --warn:             var(--sh-amber);
  --ok:               var(--sh-mint);
  --radius:           var(--sh-r-xl);
  --radius-sm:        var(--sh-r-md);
  --shadow-1:         var(--sh-sh-1);
  --shadow-2:         var(--sh-sh-2);
  --shadow-3:         var(--sh-sh-3);
  --font:             var(--sh-font-jp);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sh-font-jp);
  color: var(--sh-ink);
  background: var(--sh-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt" 1, "ss01" 1;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: inherit; }
img { max-width: 100%; }

/* ─────────────────────────────────────────────────────────
   App bar (legacy — many pages still use it before app-nav
   takes over; we tone it down to a neutral surface bar)
   ───────────────────────────────────────────────────────── */
.app-bar {
  background: var(--sh-surface);
  color: var(--sh-ink);
  padding: 14px 20px;
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid var(--sh-line);
  position: sticky; top: 0; z-index: 50;
}
.app-bar h1 {
  font-size: 16px; font-weight: 700; margin: 0;
  letter-spacing: 0.01em; color: var(--sh-ink);
  display: inline-flex; align-items: center; gap: 10px;
}
.app-bar h1 > span:first-child::before {
  /* Module pill prefix — only shown when data-mod-label set */
  content: attr(data-mod-label);
  font-family: var(--sh-font-display);
  font-size: 10px; letter-spacing: 0.16em;
  background: var(--m); color: #fff;
  padding: 3px 7px; border-radius: 4px;
  margin-right: 8px; line-height: 1;
}
.app-bar .spacer { flex: 1; }
.app-bar a { text-decoration: none; }
.app-bar .nav-link {
  color: var(--sh-ink-2);
  font-size: 13px; font-weight: 600;
  padding: 7px 11px; border-radius: var(--sh-r-md);
  transition: background var(--sh-dur-1) var(--sh-ease), color var(--sh-dur-1) var(--sh-ease);
}
.app-bar .nav-link:hover { background: var(--sh-panel); color: var(--sh-ink); }

/* When app-nav.js sidebar is mounted, hide legacy app-bar */
body.has-sh-nav .app-bar { display: none; }

/* ─────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────── */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1;
  padding: 10px 18px; border-radius: var(--sh-r-md);
  background: var(--m); color: #fff;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--m) 28%, transparent);
  transition: background var(--sh-dur-1) var(--sh-ease),
              transform var(--sh-dur-1) var(--sh-ease),
              box-shadow var(--sh-dur-2) var(--sh-ease),
              filter var(--sh-dur-1) var(--sh-ease);
  display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: var(--m-d); box-shadow: 0 6px 16px color-mix(in srgb, var(--m) 36%, transparent); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent; color: var(--sh-ink);
  border-color: var(--sh-line-strong); box-shadow: none;
}
.btn-ghost:hover {
  background: var(--sh-panel); border-color: var(--sh-line-strong);
  color: var(--sh-ink); transform: translateY(-1px);
  box-shadow: var(--sh-sh-1);
}

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--sh-r-sm); }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn-danger { background: var(--sh-coral); }
.btn-danger:hover { background: color-mix(in srgb, var(--sh-coral) 80%, #000); }
.btn-icon {
  width: 38px; height: 38px; padding: 0;
  display: inline-grid; place-items: center;
  border-radius: var(--sh-r-md); font-size: 16px;
}
.btn-block { width: 100%; justify-content: center; }

/* ─────────────────────────────────────────────────────────
   Avatar
   ───────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%; display: inline-grid; place-items: center;
  font-weight: 700; color: #fff; flex: none; user-select: none;
  background: var(--m); letter-spacing: -0.02em;
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.md { width: 40px; height: 40px; font-size: 14px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.online-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--sh-ink-4); border: 2px solid var(--sh-surface); }
.online-dot.on { background: var(--sh-mint); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sh-mint) 30%, transparent); }

/* ─────────────────────────────────────────────────────────
   Inputs
   ───────────────────────────────────────────────────────── */
.input,
select.input,
textarea.input,
input[type="text"].input,
input[type="email"].input,
input[type="password"].input,
input[type="number"].input,
input[type="search"].input,
input[type="date"].input,
input[type="time"].input,
input[type="month"].input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--sh-line-strong);
  border-radius: var(--sh-r-md);
  font-family: inherit; font-size: 14px;
  color: var(--sh-ink);
  background: var(--sh-surface);
  transition: border-color var(--sh-dur-1) var(--sh-ease),
              box-shadow var(--sh-dur-1) var(--sh-ease);
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--m);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--m) 18%, transparent);
}
textarea.input { min-height: 90px; resize: vertical; line-height: 1.6; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label {
  font-size: 12px; font-weight: 600;
  color: var(--sh-ink-3);
  letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────
   Card
   ───────────────────────────────────────────────────────── */
.card {
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-r-xl);
  box-shadow: var(--sh-sh-1);
  padding: 20px;
}

/* ─────────────────────────────────────────────────────────
   Badge / Chip
   ───────────────────────────────────────────────────────── */
.badge {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  border-radius: 999px;
  background: var(--sh-coral); color: #fff;
  font-size: 10.5px; font-weight: 700;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--sh-r-xs);
  background: var(--sh-panel); color: var(--sh-ink-2);
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.02em;
}
.chip.admin {
  background: color-mix(in srgb, var(--sh-mod-c) 14%, transparent);
  color: var(--sh-mod-c-d, var(--sh-mod-c));
}

/* ─────────────────────────────────────────────────────────
   Toast
   ───────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%);
  background: var(--sh-ink);
  color: #fff;
  padding: 11px 22px; border-radius: 999px;
  box-shadow: var(--sh-sh-3);
  z-index: 9999;
  font-size: 13.5px; font-weight: 600;
  animation: sh-toast-in 320ms cubic-bezier(.16,1,.3,1) both;
}
.toast.err { background: var(--sh-coral); }
.toast.ok { background: var(--sh-mint); }
@keyframes sh-toast-in {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}

/* ─────────────────────────────────────────────────────────
   Modal
   ───────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: color-mix(in srgb, var(--sh-ink) 50%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid; place-items: center; z-index: 200;
  padding: 16px;
  animation: sh-fade var(--sh-dur-2) var(--sh-ease) both;
}
@keyframes sh-fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-r-xl);
  box-shadow: var(--sh-sh-4);
  width: 100%; max-width: 520px; max-height: 92vh; overflow: auto;
  animation: sh-rise-modal var(--sh-dur-3) var(--sh-ease-out) both;
}
@keyframes sh-rise-modal {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.modal h2 {
  margin: 0; padding: 18px 22px 14px;
  font-size: 17px; font-weight: 700;
  border-bottom: 1px solid var(--sh-line);
  position: relative;
}
/* Tiny module color stripe above modal title */
.modal h2::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--m);
  border-radius: var(--sh-r-xl) var(--sh-r-xl) 0 0;
}
.modal .body { padding: 18px 22px; }
.modal .foot {
  padding: 14px 22px;
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--sh-line);
  background: var(--sh-surface-2);
  border-radius: 0 0 var(--sh-r-xl) var(--sh-r-xl);
}

/* ─────────────────────────────────────────────────────────
   Switch
   ───────────────────────────────────────────────────────── */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0;
  background: var(--sh-line-strong);
  border-radius: 999px;
  transition: background var(--sh-dur-2) var(--sh-ease);
}
.switch .slider:before {
  content: ""; position: absolute;
  height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  box-shadow: var(--sh-sh-1);
  transition: transform var(--sh-dur-2) var(--sh-ease-emph);
}
.switch input:checked + .slider { background: var(--m); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* ─────────────────────────────────────────────────────────
   Spinner
   ───────────────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--sh-panel);
  border-top-color: var(--m);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--sh-ink-3); }

/* ─────────────────────────────────────────────────────────
   Generic helpers used across pages
   ───────────────────────────────────────────────────────── */
.empty {
  text-align: center; color: var(--sh-ink-3);
  padding: 56px 16px;
}
.empty .big { font-size: 44px; margin-bottom: 8px; opacity: 0.5; }

/* Reused tabbar (mitsumori/kaikei/knowledge/call/dashboard) */
.tabbar {
  display: flex; gap: 2px;
  margin: 4px 0 18px;
  border-bottom: 1px solid var(--sh-line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tabbar button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 11px 16px; font-size: 14px; font-weight: 600;
  color: var(--sh-ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  white-space: nowrap;
  transition: color var(--sh-dur-1) var(--sh-ease),
              border-color var(--sh-dur-1) var(--sh-ease);
  position: relative;
}
.tabbar button:hover { color: var(--sh-ink); }
.tabbar button.active {
  color: var(--m);
  border-bottom-color: var(--m);
}

/* Tables (mitsumori/kaikei/customers/custom) */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--sh-r-lg);
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  box-shadow: var(--sh-sh-1);
}
table.tbl {
  width: 100%; border-collapse: collapse;
  background: transparent; font-size: 14px;
}
table.tbl th, table.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--sh-line-soft);
  text-align: left;
  white-space: nowrap;
}
table.tbl th {
  background: var(--sh-surface-2);
  color: var(--sh-ink-3);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  border-bottom: 1px solid var(--sh-line);
}
table.tbl td.num, table.tbl th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--sh-font-num);
}
table.tbl tbody tr {
  transition: background var(--sh-dur-1) var(--sh-ease);
}
table.tbl tbody tr:hover td { background: var(--sh-panel); }
table.tbl tr.carry td { background: var(--m-l); font-weight: 700; color: var(--m-d); }
table.tbl tr.total td { background: var(--sh-surface-2); font-weight: 700; border-top: 2px solid var(--sh-line); }
.pos { color: var(--sh-mint); }
.neg { color: var(--sh-coral); }

/* Mobile table → card transformation kept (page CSS overrides) */
/* 監査第1波-7: ナビ切替(767px)とテーブルcard化の閾値を統一(760→767) */
@media (max-width: 767px) {
  table.tbl tbody tr {
    border-radius: var(--sh-r-lg);
    border: 1px solid var(--sh-line);
    margin-bottom: 10px;
    background: var(--sh-surface);
    box-shadow: var(--sh-sh-1);
  }
}

/* Tiny icon button used in tables */
.ico-btn {
  border: 0; background: transparent; cursor: pointer;
  font-size: 16px; padding: 4px 7px;
  border-radius: var(--sh-r-sm);
  color: var(--sh-ink-3);
  transition: background var(--sh-dur-1) var(--sh-ease), color var(--sh-dur-1) var(--sh-ease);
}
.ico-btn:hover { background: var(--sh-panel); color: var(--m); }

/* Segmented control (kaikei/settings) */
.seg {
  display: inline-flex;
  background: var(--sh-panel);
  border-radius: var(--sh-r-md);
  padding: 3px;
}
.seg button {
  appearance: none; border: 0; background: transparent;
  padding: 7px 14px; border-radius: var(--sh-r-sm);
  font-family: inherit; font-weight: 600; font-size: 12.5px;
  color: var(--sh-ink-3);
  cursor: pointer;
  transition: background var(--sh-dur-1) var(--sh-ease), color var(--sh-dur-1) var(--sh-ease);
}
.seg button:hover { color: var(--sh-ink); }
.seg button.active {
  background: var(--sh-surface);
  color: var(--sh-ink);
  box-shadow: var(--sh-sh-1);
}

/* Summary KPI cards (mitsumori/kaikei/customers/dashboard) */
.summ-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.summ {
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-r-lg);
  box-shadow: var(--sh-sh-1);
  padding: 16px 18px;
  transition: transform var(--sh-dur-1) var(--sh-ease),
              box-shadow var(--sh-dur-2) var(--sh-ease),
              border-color var(--sh-dur-1) var(--sh-ease);
}
.summ:hover { transform: translateY(-2px); box-shadow: var(--sh-sh-2); border-color: var(--sh-line-strong); }
.summ .lbl { font-size: 11.5px; color: var(--sh-ink-3); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.summ .val {
  font-size: 26px; font-weight: 800;
  color: var(--sh-ink);
  margin-top: 4px;
  font-family: var(--sh-font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.summ .sub { font-size: 11.5px; color: var(--sh-ink-3); margin-top: 4px; }

/* Search input (used in mitsumori/customers/chat) */
.search { position: relative; }
.search input {
  padding: 10px 14px 10px 36px;
  border: 1.5px solid var(--sh-line-strong);
  border-radius: var(--sh-r-pill);
  font-family: inherit; font-size: 14px;
  background: var(--sh-surface);
  color: var(--sh-ink);
  width: 240px; max-width: 60vw;
  transition: border-color var(--sh-dur-1) var(--sh-ease), box-shadow var(--sh-dur-1) var(--sh-ease);
}
.search input:focus {
  outline: none; border-color: var(--m);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--m) 18%, transparent);
}
.search::before {
  content: "🔍"; position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); font-size: 12px; opacity: 0.5;
}

/* Select shorthand */
.sel {
  padding: 10px 14px;
  border: 1.5px solid var(--sh-line-strong);
  border-radius: var(--sh-r-md);
  font-family: inherit; font-size: 13.5px;
  background: var(--sh-surface);
  color: var(--sh-ink);
  cursor: pointer;
}
.sel:focus {
  outline: none; border-color: var(--m);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--m) 18%, transparent);
}

/* ─────────────────────────────────────────────────────────
   Page heading (used by customers/custom/settings/admin)
   ───────────────────────────────────────────────────────── */
.page-head {
  display: flex; align-items: baseline; gap: 14px;
  flex-wrap: wrap; margin: 4px 0 22px;
}
.page-head h2 {
  margin: 0; font-size: 24px; font-weight: 800;
  color: var(--sh-ink); letter-spacing: -0.01em;
}
.page-head .sub { font-size: 13px; color: var(--sh-ink-3); }
.page-head .grow { flex: 1; }

/* Crumb (custom) */
.crumb {
  font-size: 12px; color: var(--sh-ink-3);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
  font-family: var(--sh-font-mono);
  letter-spacing: 0.02em;
}
.crumb a { color: var(--m); text-decoration: none; font-weight: 700; }
.crumb a:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────────────────
   Animations (subtle on-mount)
   ───────────────────────────────────────────────────────── */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Stagger cards on entry */
.summ      { animation: rise var(--sh-dur-3) var(--sh-ease-out) both; }
.summ:nth-child(2) { animation-delay: 40ms; }
.summ:nth-child(3) { animation-delay: 80ms; }
.summ:nth-child(4) { animation-delay: 120ms; }
.summ:nth-child(5) { animation-delay: 160ms; }
.summ:nth-child(6) { animation-delay: 200ms; }

.mod-card  { animation: rise var(--sh-dur-3) var(--sh-ease-out) both; }
.mod-card:nth-child(2) { animation-delay: 40ms; }
.mod-card:nth-child(3) { animation-delay: 80ms; }
.mod-card:nth-child(4) { animation-delay: 120ms; }
.mod-card:nth-child(5) { animation-delay: 160ms; }
.mod-card:nth-child(6) { animation-delay: 200ms; }
.mod-card:nth-child(7) { animation-delay: 240ms; }
.mod-card:nth-child(8) { animation-delay: 280ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─────────────────────────────────────────────────────────
   Status pills used by mitsumori (見積/受注/未払/入金)
   ───────────────────────────────────────────────────────── */
.st {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.st::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.st.mitsu   { background: color-mix(in srgb, var(--sh-mod-c) 14%, transparent); color: var(--sh-mod-c-d, var(--sh-mod-c)); }
.st.juchu   { background: color-mix(in srgb, var(--sh-mint) 16%, transparent);  color: var(--sh-mint); }
.st.mihar   { background: color-mix(in srgb, var(--sh-amber) 18%, transparent); color: var(--sh-amber); }
.st.nyukin  { background: color-mix(in srgb, var(--sh-mint) 18%, transparent);  color: var(--sh-mint); }
.st.mikomi  { background: color-mix(in srgb, var(--sh-amber) 18%, transparent); color: var(--sh-amber); }
.st.torihiki{ background: color-mix(in srgb, var(--sh-mint) 16%, transparent);  color: var(--sh-mint); }
.st.kyumin  { background: var(--sh-panel); color: var(--sh-ink-3); }
.st.shuryo  { background: color-mix(in srgb, var(--sh-coral) 16%, transparent); color: var(--sh-coral); }

/* Pills used by kaikei (income/expense/asset/liability) */
.pill {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--sh-panel); color: var(--sh-ink-3);
}
.pill.income    { background: color-mix(in srgb, var(--sh-mint) 18%, transparent); color: var(--sh-mint); }
.pill.expense   { background: color-mix(in srgb, var(--sh-coral) 18%, transparent); color: var(--sh-coral); }
.pill.asset     { background: color-mix(in srgb, var(--sh-blue) 18%, transparent); color: var(--sh-blue-2, var(--sh-blue)); }
.pill.liability { background: color-mix(in srgb, var(--sh-amber) 18%, transparent); color: var(--sh-amber); }

/* OCR badge (kaikei) */
.ocr-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
}
.ocr-badge.ok   { background: color-mix(in srgb, var(--sh-mint) 18%, transparent); color: var(--sh-mint); }
.ocr-badge.warn { background: color-mix(in srgb, var(--sh-amber) 18%, transparent); color: var(--sh-amber); }
.ocr-badge.err  { background: color-mix(in srgb, var(--sh-coral) 18%, transparent); color: var(--sh-coral); }

/* Drag-drop (kaikei OCR) */
.drop {
  border: 2px dashed var(--sh-line-strong);
  border-radius: var(--sh-r-lg);
  padding: 28px;
  text-align: center;
  color: var(--sh-ink-3);
  cursor: pointer;
  background: var(--sh-surface);
  transition: border-color var(--sh-dur-1) var(--sh-ease),
              background var(--sh-dur-1) var(--sh-ease),
              color var(--sh-dur-1) var(--sh-ease);
}
.drop:hover { border-color: var(--m); background: var(--m-l); color: var(--m); }
.drop.over  { border-color: var(--m); background: var(--m-l); color: var(--m); border-style: solid; }

/* ─────────────────────────────────────────────────────────
   Source tags (knowledge: call/chat/manual)
   ───────────────────────────────────────────────────────── */
.src-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.02em;
}
.src-call   { background: color-mix(in srgb, var(--sh-mod-i) 16%, transparent); color: var(--sh-mod-i-d, var(--sh-mod-i)); }
.src-chat   { background: color-mix(in srgb, var(--sh-mod-h) 16%, transparent); color: var(--sh-mod-h-d, var(--sh-mod-h)); }
.src-manual { background: color-mix(in srgb, var(--sh-mod-c) 16%, transparent); color: var(--sh-mod-c-d, var(--sh-mod-c)); }

/* Knowledge item card */
.k-item {
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-r-lg);
  box-shadow: var(--sh-sh-1);
  padding: 18px 20px; margin-bottom: 10px;
  cursor: pointer;
  transition: transform var(--sh-dur-1) var(--sh-ease),
              box-shadow var(--sh-dur-2) var(--sh-ease),
              border-color var(--sh-dur-1) var(--sh-ease);
  position: relative;
  animation: rise var(--sh-dur-3) var(--sh-ease-out) both;
}
.k-item::before {
  content: ''; position: absolute; top: 0; left: 0; bottom: 0;
  width: 3px; background: var(--m);
  border-radius: var(--sh-r-lg) 0 0 var(--sh-r-lg);
  opacity: 0; transition: opacity var(--sh-dur-1) var(--sh-ease);
}
.k-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-sh-2);
  border-color: var(--sh-line-strong);
}
.k-item:hover::before { opacity: 1; }
.k-item .k-title {
  font-weight: 700; color: var(--sh-ink);
  margin: 0 0 6px; font-size: 15.5px;
  letter-spacing: -0.01em;
}
.k-item .k-snip {
  font-size: 13px; color: var(--sh-ink-2);
  white-space: pre-wrap;
  max-height: 44px; overflow: hidden;
  line-height: 1.6;
}
.k-item .k-foot {
  display: flex; gap: 8px; align-items: center;
  margin-top: 10px; font-size: 11px; color: var(--sh-ink-3);
  flex-wrap: wrap;
}
.sec-title {
  font-size: 11px; font-weight: 700;
  color: var(--sh-ink-3); letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 18px 0 10px;
}

/* ─────────────────────────────────────────────────────────
   Dashboard module cards
   ───────────────────────────────────────────────────────── */
.mod-card {
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-r-xl);
  box-shadow: var(--sh-sh-1);
  padding: 22px 22px;
  cursor: pointer;
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform var(--sh-dur-2) var(--sh-ease-emph),
              box-shadow var(--sh-dur-2) var(--sh-ease),
              border-color var(--sh-dur-1) var(--sh-ease);
  position: relative; overflow: hidden;
}
.mod-card::before {
  content: ''; position: absolute; top: 0; right: 0;
  width: 100px; height: 100px;
  background: radial-gradient(circle at 100% 0%, var(--m-l), transparent 70%);
  opacity: 0; transition: opacity var(--sh-dur-2) var(--sh-ease);
  pointer-events: none;
}
.mod-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sh-sh-3);
  border-color: var(--sh-line-strong);
}
.mod-card:hover::before { opacity: 0.7; }
.mod-card .icon {
  width: 52px; height: 52px; border-radius: var(--sh-r-lg);
  background: var(--sh-panel);
  color: var(--sh-ink-2);
  display: inline-grid; place-items: center;
  font-size: 24px;
  transition: background var(--sh-dur-1) var(--sh-ease),
              color var(--sh-dur-1) var(--sh-ease),
              transform var(--sh-dur-2) var(--sh-ease-emph);
  position: relative; z-index: 1;
}
.mod-card:hover .icon {
  background: var(--m); color: #fff;
  transform: scale(1.06) rotate(-3deg);
}
.mod-card h3 {
  margin: 0; font-size: 16.5px;
  color: var(--sh-ink); font-weight: 700;
  letter-spacing: -0.01em;
  position: relative; z-index: 1;
}
.mod-card p {
  margin: 0; font-size: 13px;
  color: var(--sh-ink-3); line-height: 1.55;
  position: relative; z-index: 1;
}

/* KPIs on dashboard */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 6px 0 20px;
}
.kpi {
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-r-lg);
  box-shadow: var(--sh-sh-1);
  padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: transform var(--sh-dur-1) var(--sh-ease),
              box-shadow var(--sh-dur-2) var(--sh-ease);
  animation: rise var(--sh-dur-3) var(--sh-ease-out) both;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-sh-2); }
.kpi .k-ic {
  width: 44px; height: 44px; border-radius: var(--sh-r-lg);
  background: var(--sh-panel); color: var(--sh-ink-2);
  display: inline-grid; place-items: center;
  font-size: 20px; flex: none;
  transition: background var(--sh-dur-1) var(--sh-ease),
              color var(--sh-dur-1) var(--sh-ease);
}
.kpi:hover .k-ic { background: var(--m-l); color: var(--m); }
.kpi .k-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .k-val {
  font-size: 24px; font-weight: 800;
  color: var(--sh-ink); line-height: 1.1;
  font-family: var(--sh-font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.kpi .k-lab {
  font-size: 11.5px; color: var(--sh-ink-3);
  font-weight: 600; letter-spacing: 0.02em;
}

/* ─────────────────────────────────────────────────────────
   Settings page tile (set-card)
   ───────────────────────────────────────────────────────── */
.set-card {
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-r-xl);
  box-shadow: var(--sh-sh-1);
  padding: 22px; margin-bottom: 16px;
  transition: box-shadow var(--sh-dur-2) var(--sh-ease);
  animation: rise var(--sh-dur-3) var(--sh-ease-out) both;
}
.set-card:hover { box-shadow: var(--sh-sh-2); }
.set-card > h3 {
  margin: 0 0 4px; font-size: 16px; font-weight: 700;
  color: var(--sh-ink);
  display: inline-flex; align-items: center; gap: 8px;
  letter-spacing: -0.01em;
}
.set-card > .cap { margin: 0 0 16px; font-size: 12.5px; color: var(--sh-ink-3); }
.set-card .row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 13px 0;
  border-bottom: 1px solid var(--sh-line-soft);
}
.set-card .row:last-child { border-bottom: 0; }
.set-card .row .rl { display: flex; align-items: center; gap: 12px; min-width: 0; }
.set-card .row .rl .ic { font-size: 19px; opacity: 0.8; }
.set-card .row .rl .tx b {
  font-size: 13.5px; display: block; color: var(--sh-ink); font-weight: 600;
}
.set-card .row .rl .tx span { font-size: 11.5px; color: var(--sh-ink-3); }

/* Color dots in settings (kept) */
.color-dots { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dots > div {
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--sh-sh-1);
  transition: transform var(--sh-dur-1) var(--sh-ease-emph), box-shadow var(--sh-dur-1) var(--sh-ease);
  border: 2px solid transparent;
}
.color-dots > div:hover { transform: scale(1.12); box-shadow: var(--sh-sh-2); }

/* ─────────────────────────────────────────────────────────
   Admin user-card
   ───────────────────────────────────────────────────────── */
.user-card {
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-r-xl);
  box-shadow: var(--sh-sh-1);
  padding: 18px 20px; margin-bottom: 12px;
  transition: box-shadow var(--sh-dur-2) var(--sh-ease);
  animation: rise var(--sh-dur-3) var(--sh-ease-out) both;
}
.user-card:hover { box-shadow: var(--sh-sh-2); }
.user-card .uc-head { display: flex; align-items: center; gap: 12px; }
.user-card .uc-id { min-width: 0; flex: 1; }
.user-card .uc-id .nm {
  font-weight: 700; font-size: 15px;
  color: var(--sh-ink);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.user-card .uc-id .uid {
  font-size: 11.5px; color: var(--m);
  font-weight: 700;
  font-family: var(--sh-font-mono);
  margin-top: 1px;
}
.user-card .uc-id .em { font-size: 12.5px; color: var(--sh-ink-3); }
.user-card .uc-actions { display: flex; gap: 6px; flex: none; }
.user-card .perm-wrap {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px dashed var(--sh-line);
}
.user-card .plabel {
  font-size: 11px; font-weight: 700;
  color: var(--sh-ink-3); letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.perm-tog {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border-radius: var(--sh-r-md);
  background: var(--sh-panel);
  border: 1px solid transparent;
  transition: background var(--sh-dur-1) var(--sh-ease),
              border-color var(--sh-dur-1) var(--sh-ease);
}
.perm-tog.on {
  background: var(--m-l);
  border-color: color-mix(in srgb, var(--m) 25%, transparent);
}
.perm-tog .ic { font-size: 17px; flex: none; }
.perm-tog .nm { font-size: 12.5px; font-weight: 600; color: var(--sh-ink); flex: 1; min-width: 0; }

/* Stat (admin) */
.stat {
  background: var(--sh-surface);
  border: 1px solid var(--sh-line);
  border-radius: var(--sh-r-lg);
  box-shadow: var(--sh-sh-1);
  padding: 16px 18px;
}
.stat .v {
  font-size: 24px; font-weight: 800;
  color: var(--sh-ink);
  font-family: var(--sh-font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat .l {
  font-size: 11.5px; color: var(--sh-ink-3);
  font-weight: 600; margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────
   Ordering (settings drag list)
   ───────────────────────────────────────────────────────── */
.ord-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  background: var(--sh-panel);
  border-radius: var(--sh-r-md);
  margin-bottom: 8px;
  transition: background var(--sh-dur-1) var(--sh-ease);
}
.ord-item:hover { background: var(--sh-surface-2); }
.ord-item .ic { font-size: 17px; opacity: 0.8; }
.ord-item .nm { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--sh-ink); }
.ord-item .mv { display: flex; gap: 4px; }
.ord-item .mv button {
  width: 30px; height: 30px;
  border-radius: var(--sh-r-sm);
  border: 1px solid var(--sh-line-strong);
  background: var(--sh-surface);
  color: var(--sh-ink-2);
  cursor: pointer; font-size: 13px;
  transition: background var(--sh-dur-1) var(--sh-ease), color var(--sh-dur-1) var(--sh-ease);
}
.ord-item .mv button:hover { background: var(--m); color: #fff; border-color: var(--m); }
.ord-item .mv button:disabled { opacity: 0.35; cursor: default; }
.ord-item .mv button:disabled:hover { background: var(--sh-surface); color: var(--sh-ink-2); border-color: var(--sh-line-strong); }

/* [mobileui0813] スマホ: 入力欄16px=iOSフォーカス時の自動ズーム防止(全モジュール共通) */
@media (max-width: 767px) {
  .input, select.input, textarea.input,
  input[type="text"].input, input[type="email"].input, input[type="password"].input,
  input[type="number"].input, input[type="search"].input, input[type="date"].input,
  input[type="time"].input, input[type="month"].input { font-size: 16px; }
}
