/* ===== Design tokens ===== */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --surface-hover: #f7f8fb;
  --border: #e5e8ef;
  --border-strong: #d4d9e3;
  --text: #0f172a;
  --text-2: #4b5567;
  --text-3: #8a94a6;
  --primary: #2f54eb;
  --primary-hover: #2445d4;
  --primary-soft: #eef2ff;
  --primary-text: #2440c9;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --warning-soft: #fffbeb;
  --warning: #b45309;
  --side-bg: #0e1631;
  --side-bg-2: #17213f;
  --side-text: #c4cbe0;
  --side-text-strong: #ffffff;
  --side-muted: #6c7898;
  --side-active: rgba(255, 255, 255, .09);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, .18), 0 4px 12px rgba(15, 23, 42, .08);
  --radius: 12px;
  --radius-sm: 8px;
  --chip-l: 95%;
  --chip-tl: 32%;
  --chip-s: 80%;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #131a2c;
    --surface-2: #1a2236;
    --surface-hover: #182035;
    --border: #252f47;
    --border-strong: #33405e;
    --text: #e8ecf5;
    --text-2: #a9b3c8;
    --text-3: #6f7a93;
    --primary: #5b7cff;
    --primary-hover: #7290ff;
    --primary-soft: #1d2852;
    --primary-text: #a9bbff;
    --danger: #f87171;
    --danger-soft: #3a1717;
    --success: #4ade80;
    --success-soft: #12301f;
    --warning-soft: #33260d;
    --warning: #fbbf24;
    --side-bg: #080c19;
    --side-bg-2: #111832;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .35);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
    --chip-l: 20%;
    --chip-tl: 80%;
    --chip-s: 45%;
    color-scheme: dark;
  }
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt";
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
.icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(47, 84, 235, .3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn.danger-ghost:hover { background: var(--danger-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; height: 44px; font-size: 14.5px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.input.invalid { border-color: var(--danger); }
.hint { font-size: 12px; color: var(--text-3); }
.error-text { font-size: 12.5px; color: var(--danger); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-wrap .icon-btn { position: absolute; right: 3px; top: 3px; }

/* ===== Auth screens ===== */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(91, 124, 255, .55), transparent 60%),
    radial-gradient(900px 500px at 120% 110%, rgba(56, 189, 248, .35), transparent 60%),
    linear-gradient(160deg, #0e1631 0%, #13224f 60%, #0e1631 100%);
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0; opacity: .14; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 0%, transparent 70%);
}
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero h2 { font-size: 34px; line-height: 1.35; margin: 0 0 16px; letter-spacing: .01em; }
.auth-hero p { color: #c3cdee; margin: 0; font-size: 15px; max-width: 440px; }
.auth-features { display: grid; gap: 14px; margin-top: 36px; max-width: 420px; }
.auth-feature { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(6px); }
.auth-feature .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.12); flex-shrink: 0; }
.auth-feature b { display: block; font-size: 14px; }
.auth-feature span { font-size: 12.5px; color: #b6c1e6; }
.auth-foot { font-size: 12px; color: #8e9bc6; }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; }
.auth-card .sub { color: var(--text-2); margin: 0 0 28px; }
.auth-card form { display: grid; gap: 16px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; flex-wrap: wrap; }
.auth-links button { background: none; border: none; padding: 0; color: var(--primary-text); font-weight: 600; }
.auth-links button:hover { text-decoration: underline; }
.auth-divider { height: 1px; background: var(--border); margin: 8px 0; }
.auth-alt { text-align: center; font-size: 13px; color: var(--text-2); }
.auth-alt button { background: none; border: none; color: var(--primary-text); font-weight: 700; padding: 0; }
.auth-status { text-align: center; }
.auth-status .badge-ic { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 20px; background: var(--primary-soft); color: var(--primary-text); }
.auth-status .badge-ic.warn { background: var(--warning-soft); color: var(--warning); }
.auth-status .email-pill { display: inline-block; padding: 4px 12px; border-radius: 99px; background: var(--surface-2); font-weight: 600; margin: 4px 0 20px; word-break: break-all; }
.auth-status .stack { display: grid; gap: 10px; margin-top: 8px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.ok { background: var(--success-soft); color: var(--success); }
.alert.info { background: var(--primary-soft); color: var(--primary-text); }
.brand.mobile-brand { display: none; }

/* ===== Brand ===== */
.brand { display: flex; align-items: center; gap: 11px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #5b7cff, #2f54eb 55%, #1f3bb8);
  box-shadow: 0 4px 12px rgba(47, 84, 235, .45), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .02em; line-height: 1.2; }
.brand-sub { font-size: 11px; opacity: .6; font-weight: 500; letter-spacing: .08em; }

/* ===== App layout ===== */
.layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.sidebar .brand { padding: 22px 20px 18px; color: var(--side-text-strong); }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--side-muted); padding: 18px 10px 8px; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px;
  border: none; background: transparent; color: var(--side-text); text-align: left; font-size: 14px; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--side-text-strong); }
.nav-item.active { background: var(--side-active); color: var(--side-text-strong); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.nav-item .dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: hsl(var(--h) 70% 60% / .16); color: hsl(var(--h) 90% 76%); flex-shrink: 0; }
.nav-item .dot .icon { width: 15px; height: 15px; }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .count { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--side-muted); background: rgba(255,255,255,.06); padding: 1px 8px; border-radius: 99px; min-width: 26px; text-align: center; }
.nav-item.active .count { background: rgba(255,255,255,.14); color: #fff; }
.side-user { border-top: 1px solid rgba(255,255,255,.08); padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 700; font-size: 13px; color: #fff; background: hsl(var(--h, 225) 60% 52%);
}
.side-user .who { flex: 1; min-width: 0; }
.side-user .who b { display: block; color: #fff; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who span { font-size: 11.5px; color: var(--side-muted); }
.side-user .icon-btn { color: var(--side-muted); }
.side-user .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.demo-badge { margin: 0 12px 12px; padding: 10px 12px; border-radius: 10px; background: rgba(251, 191, 36, .12); color: #fcd34d; font-size: 12px; line-height: 1.5; border: 1px solid rgba(251, 191, 36, .25); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 14px 32px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.search {
  position: relative; flex: 1; max-width: 520px;
}
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input { padding-left: 38px; padding-right: 44px; background: var(--surface); box-shadow: var(--shadow-sm); }
.search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-family: inherit; font-size: 11px; color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 5px; padding: 0 6px; background: var(--surface-2);
}
.topbar .grow { flex: 1; }
.content { padding: 28px 32px 64px; max-width: 1400px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: .01em; display: flex; align-items: center; gap: 12px; }
.page-head h1 .dot { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: hsl(var(--h) var(--chip-s) var(--chip-l)); color: hsl(var(--h) 60% var(--chip-tl)); }
.page-head .meta { color: var(--text-2); margin-top: 4px; font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.segmented { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { border: none; background: transparent; height: 30px; padding: 0 10px; border-radius: 7px; color: var(--text-3); display: grid; place-items: center; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.select.compact { height: 38px; width: auto; padding-right: 30px; font-weight: 500; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow-sm); }
.stat .ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: hsl(var(--h) var(--chip-s) var(--chip-l)); color: hsl(var(--h) 60% var(--chip-tl)); }
.stat b { font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; display: block; }
.stat span { font-size: 12.5px; color: var(--text-2); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: hsl(var(--h) var(--chip-s) var(--chip-l)); color: hsl(var(--h) 60% var(--chip-tl));
}

/* Table */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel:has(> .table) { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .04em;
  padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.selected { background: var(--primary-soft); }
.co { display: flex; align-items: center; gap: 12px; min-width: 0; }
.co-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 15px; color: hsl(var(--h) 55% var(--chip-tl)); background: hsl(var(--h) var(--chip-s) var(--chip-l)); }
.co-name { font-weight: 700; font-size: 14px; line-height: 1.35; }
.co-sub { font-size: 12px; color: var(--text-3); }
.table td.td-co { min-width: 240px; }
.table .co-name { white-space: nowrap; }
.table .co-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.cell-person { white-space: nowrap; }
.cell-person b { font-weight: 600; display: block; }
.cell-person span { font-size: 12px; color: var(--text-3); }
.cell-contact { display: flex; gap: 4px; }
.cell-contact a, .cell-contact span.na {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); border: 1px solid var(--border);
}
.cell-contact a:hover { color: var(--primary-text); border-color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.cell-contact span.na { opacity: .3; }
.cell-area { color: var(--text-2); font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-pill { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.date-pill.recent { color: var(--success); font-weight: 600; }
.muted { color: var(--text-3); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.vcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 12px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
}
.vcard:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border-strong); }
.vcard .lines { display: grid; gap: 5px; font-size: 13px; color: var(--text-2); }
.vcard .lines div { display: flex; gap: 8px; align-items: center; min-width: 0; }
.vcard .lines div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vcard .lines .icon { color: var(--text-3); width: 15px; height: 15px; }
.vcard .foot { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-3); }

/* Empty / loading */
.empty { text-align: center; padding: 72px 24px; color: var(--text-2); }
.empty .ic { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 16px; background: var(--surface-2); color: var(--text-3); }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.empty p { margin: 0 0 18px; font-size: 13.5px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot .brand-logo { width: 52px; height: 52px; border-radius: 14px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .75; } }

/* ===== Drawer ===== */
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 25, .42); backdrop-filter: blur(2px); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 50;
  background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.drawer.show { transform: none; }
.drawer-head { padding: 18px 20px 0; display: flex; justify-content: flex-end; gap: 4px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 28px 28px; }
.drawer-title { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.drawer-title .co-logo { width: 56px; height: 56px; border-radius: 14px; font-size: 22px; }
.drawer-title h2 { margin: 0; font-size: 20px; line-height: 1.35; }
.drawer-title .co-sub { font-size: 12.5px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 0 24px; }
.quick a, .quick button {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 12.5px; font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
}
.quick a:hover, .quick button:hover { text-decoration: none; background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text); }
.quick .disabled { opacity: .4; pointer-events: none; }
.section-title { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; color: var(--text-3); margin: 22px 0 10px; }
.info-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.info-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); min-height: 48px; }
.info-row:last-child { border-bottom: none; }
.info-row > .icon { color: var(--text-3); }
.info-row .k { font-size: 11.5px; color: var(--text-3); line-height: 1.3; }
.info-row .v { font-weight: 500; word-break: break-all; }
.info-row .body { flex: 1; min-width: 0; }
.info-row .icon-btn { width: 30px; height: 30px; opacity: 0; transition: opacity .15s; }
.info-row:hover .icon-btn, .info-row .icon-btn:focus-visible { opacity: 1; }
.note-box { background: var(--warning-soft); border-radius: var(--radius); padding: 14px 16px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.75; border: 1px solid color-mix(in srgb, var(--warning) 18%, transparent); }
.request-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); }
.request-box b { font-size: 15px; font-variant-numeric: tabular-nums; }
.meta-foot { margin-top: 24px; font-size: 12px; color: var(--text-3); display: grid; gap: 2px; }
.drawer-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 8px; }

/* ===== Modal ===== */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(8, 12, 25, .48); backdrop-filter: blur(3px); animation: fade .18s ease; }
.modal {
  width: min(var(--w, 640px), 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px 14px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.modal-body { padding: 6px 24px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-foot .left { margin-right: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; color: var(--text-3); padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; }
.form-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.cat-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-toggle {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 99px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 13px;
  transition: all .15s;
}
.cat-toggle:hover { border-color: hsl(var(--h) 60% 55%); }
.cat-toggle[aria-pressed="true"] { background: hsl(var(--h) var(--chip-s) var(--chip-l)); border-color: hsl(var(--h) 60% 55%); color: hsl(var(--h) 60% var(--chip-tl)); }
.cat-toggle .check { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; opacity: .5; }
.cat-toggle[aria-pressed="true"] .check { background: hsl(var(--h) 60% 50%); border-color: hsl(var(--h) 60% 50%); color: #fff; opacity: 1; }
.cat-toggle .check .icon { width: 11px; height: 11px; stroke-width: 3.5; opacity: 0; }
.cat-toggle[aria-pressed="true"] .check .icon { opacity: 1; }

.list-rows { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .grow span { font-size: 12px; color: var(--text-3); }
.list-row .input, .list-row .select { height: 34px; }
.list-row .select { width: auto; }
.role-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-text); }
.checkbox { width: 17px; height: 17px; accent-color: var(--primary); flex-shrink: 0; }
.add-row { display: flex; gap: 8px; margin-bottom: 14px; }
.add-row .input { flex: 1; }
.add-row .select { width: 120px; }
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.io-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.io-card .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); }
.io-card b { font-size: 14px; }
.io-card p { margin: 0 0 6px; font-size: 12.5px; color: var(--text-2); flex: 1; }
.selectall { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--text-2); }
.selectall label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.mail-list { max-height: 220px; overflow-y: auto; }
.mail-list label { cursor: pointer; }

/* ===== Toast ===== */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 14px; border-radius: 11px; font-weight: 500; font-size: 13.5px;
  background: #111827; color: #fff; box-shadow: var(--shadow-lg); animation: toastIn .25s cubic-bezier(.2, .9, .3, 1.2);
}
.toast .icon { color: #4ade80; }
.toast.error .icon { color: #f87171; }
.toast.hide { opacity: 0; transform: translateY(8px); transition: all .2s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* ===== Responsive ===== */
@media (max-width: 1280px) {
  .hide-lg { display: none; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .brand.mobile-brand { display: flex; margin-bottom: 32px; }
  .mobile-brand .brand-name { color: var(--text); }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 55; transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar .grow { display: none; }
  .search { max-width: none; }
  .topbar .btn .label { display: none; }
  .topbar .btn.primary { padding: 0 11px; }
  .search kbd { display: none; }
  .content { padding: 20px 16px 48px; }
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .stat .ic { width: 32px; height: 32px; }
  .stat b { font-size: 20px; }
  .view-toggle { display: none !important; }
  .form-grid, .io-grid { grid-template-columns: 1fr; }
  .modal-wrap { padding: 0; align-items: end; }
  .modal { max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal-foot { border-radius: 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .drawer-body { padding: 4px 20px 24px; }
  .info-row .icon-btn { opacity: 1; }
}
@media (max-width: 520px) {
  .page-head h1 { font-size: 20px; }
  .stat span { font-size: 11px; }
  .cards { grid-template-columns: 1fr; }
}
/* ===== 査定額の答え方（金額／幅／以上）アプリ・回答フォーム共通 ===== */
.ptype { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.ptype button {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 700; font-size: 13px; transition: all .15s;
}
.ptype button small { font-size: 11px; font-weight: 500; color: var(--text-3); }
.ptype button:hover { border-color: var(--primary); }
.ptype button.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.ptype button.on small { color: var(--primary-text); }
.price-row { display: flex; align-items: center; gap: 8px; }
.price-row > .price-input, .price-row > .unit-input { flex: 1; min-width: 0; }
.price-row .tilde, .price-row .ijo { font-weight: 800; color: var(--text-2); flex-shrink: 0; }
[data-for][hidden] { display: none !important; }

/* ===== 物件資料（アプリ・回答フォーム共通） ===== */
.file-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.file-row.uploading { background: var(--surface-2); }
.file-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: hsl(0 80% var(--chip-l)); color: hsl(0 65% var(--chip-tl)); }
.file-ic.image { background: hsl(200 80% var(--chip-l)); color: hsl(200 65% var(--chip-tl)); }
.file-name { flex: 1; min-width: 0; text-align: left; background: none; border: none; padding: 0; color: var(--text); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.file-name:hover { color: var(--primary-text); text-decoration: underline; }
.file-name span { display: block; font-size: 11.5px; font-weight: 400; color: var(--text-3); }

@media print {
  .sidebar, .topbar, .page-actions, .stats, .drawer, .overlay, .toasts { display: none !important; }
  .layout { display: block; }
  .vcard { break-inside: avoid; box-shadow: none; }
}
