:root {
  --ink: #1d2528;
  --ink-soft: #516065;
  --muted: #869296;
  --paper: #f5f2eb;
  --surface: #fffdfa;
  --line: #e4e0d7;
  --line-dark: #c8c5bc;
  --orange: #e6693d;
  --orange-deep: #bd4f2e;
  --orange-wash: #fff0e9;
  --mint: #d8e6dc;
  --yellow: #f2d279;
  --navy: #263941;
  --shadow: 0 18px 45px rgba(36, 43, 44, 0.08);
  --shadow-soft: 0 8px 24px rgba(36, 43, 44, 0.07);
  --radius: 16px;
}
.auth-gate { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 15%, rgba(255,255,255,.84), rgba(216,213,204,.96) 72%); }
.auth-gate.hidden { display: none; }
.auth-card { width: min(410px, 100%); padding: 34px; border: 1px solid rgba(29,37,40,.12); border-radius: 22px; background: rgba(255,252,247,.88); box-shadow: 0 30px 90px rgba(29,37,40,.18); backdrop-filter: blur(16px); }
.auth-card h2 { margin: 8px 0 7px; font-family: "Noto Serif SC", serif; font-size: 27px; font-weight: 600; letter-spacing: -.05em; }
.auth-copy { margin: 0 0 24px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.auth-field { display: grid; gap: 7px; margin-top: 13px; color: var(--muted); font-family: "DM Mono", monospace; font-size: 10px; }
.auth-field input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; outline: 0; color: var(--ink); background: rgba(255,255,255,.72); font: 14px "DM Sans", sans-serif; }
.auth-field input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(230,105,61,.1); }
.auth-submit { width: 100%; margin-top: 20px; }
.auth-submit:disabled { cursor: wait; opacity: .65; }
.auth-error { min-height: 18px; margin: 10px 0 0; color: #a44f3b; font-size: 11px; }
body.auth-required .app-shell { filter: blur(4px); pointer-events: none; user-select: none; }

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", "Noto Sans SC", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px 20px; color: #f4f1e9; background: var(--ink); }
.brand-lockup { display: flex; gap: 11px; align-items: center; padding: 4px 9px 34px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(245, 242, 235, .35); border-radius: 10px 10px 10px 3px; color: var(--yellow); font-family: "DM Mono", monospace; font-size: 11px; letter-spacing: -.05em; transform: rotate(-5deg); }
.brand-lockup h1 { margin: 3px 0 0; font-family: "Noto Serif SC", serif; font-size: 20px; font-weight: 600; letter-spacing: -.04em; }
.eyebrow { margin: 0; color: var(--muted); font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .15em; line-height: 1.5; }
.sidebar .eyebrow { color: #8e9a9d; }
.eyebrow.accent { color: var(--orange); font-weight: 500; }
.main-nav { display: grid; gap: 4px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; border-radius: 10px; color: #afb9ba; background: transparent; text-align: left; font-size: 13px; transition: .2s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.is-active { color: #fffaf2; background: #33454b; box-shadow: inset 3px 0 0 var(--orange); }
.nav-icon { width: 17px; color: #8fa0a1; font-size: 16px; text-align: center; }
.nav-count { min-width: 20px; margin-left: auto; padding: 2px 6px; border-radius: 10px; color: #d1d9d7; background: rgba(255,255,255,.1); font-family: "DM Mono", monospace; font-size: 10px; text-align: center; }
.nav-count.warm { color: #ffd2c3; background: rgba(230,105,61,.2); }
.sidebar-rule { height: 1px; margin: 30px 10px 24px; background: rgba(255,255,255,.1); }
.sidebar-section { padding: 0 10px; }
.section-label-row { display: flex; align-items: center; justify-content: space-between; }
.sidebar-section-actions { display: flex; align-items: center; gap: 5px; }
.sidebar-toggle { padding: 3px 5px; border: 0; color: #93a19f; background: transparent; font-family: "DM Mono", monospace; font-size: 9px; }
.sidebar-toggle:hover { color: #fff2e5; }
.sidebar-section.is-collapsed .sidebar-tags { display: none; }
.icon-button { display: inline-grid; width: 28px; height: 28px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-soft); background: transparent; font-size: 17px; line-height: 1; transition: .2s ease; }
.icon-button:hover { color: var(--orange); border-color: rgba(230,105,61,.5); background: var(--orange-wash); }
.sidebar .icon-button { width: 22px; height: 22px; border-color: rgba(255,255,255,.18); color: #bdc8c6; font-size: 15px; }
.sidebar-tags { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 15px; }
.side-tag { padding: 5px 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 6px; color: #a8b6b3; background: rgba(255,255,255,.035); font-size: 10px; transition: .2s ease; }
.side-tag:hover, .side-tag.is-active { color: #fff2e5; border-color: rgba(230,105,61,.55); background: rgba(230,105,61,.15); }
.sidebar-footer { display: flex; gap: 8px; align-items: center; margin-top: auto; padding: 14px 10px 0; color: #829092; font-family: "DM Mono", monospace; font-size: 9px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #86b58e; box-shadow: 0 0 0 4px rgba(134,181,142,.12); }

.main-content { width: 100%; max-width: 1480px; min-width: 0; margin: 0 auto; padding: 0 48px 70px; }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; gap: 9px; align-items: center; color: var(--muted); font-family: "DM Mono", monospace; font-size: 10px; }
.breadcrumb strong { color: var(--ink-soft); font-weight: 500; }
.breadcrumb-slash { color: #b8b5ac; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.workspace-role { color: var(--muted); font-family: "DM Mono", monospace; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.readonly-note, .review-readonly { color: var(--muted); font-size: 12px; }
.ghost-button, .primary-button, .filter-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 37px; padding: 0 14px; border-radius: 9px; font-size: 12px; transition: .2s ease; }
.ghost-button { border: 1px solid var(--line-dark); color: var(--ink-soft); background: transparent; }
.ghost-button:hover { border-color: var(--ink-soft); color: var(--ink); background: rgba(255,255,255,.45); }
.primary-button { border: 1px solid var(--orange); color: #fffaf6; background: var(--orange); box-shadow: 0 5px 14px rgba(230,105,61,.18); }
.primary-button:hover { border-color: var(--orange-deep); background: var(--orange-deep); transform: translateY(-1px); }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding: 42px 0 28px; }
.hero-row h2 { margin: 7px 0 9px; font-family: "Noto Serif SC", serif; font-size: clamp(32px, 4vw, 50px); font-weight: 600; letter-spacing: -.065em; line-height: 1.05; }
.title-period { color: var(--orange); }
.hero-copy { max-width: 510px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.hero-note { display: flex; gap: 12px; align-items: flex-start; max-width: 190px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink-soft); background: rgba(255,253,250,.5); font-family: "Noto Serif SC", serif; font-size: 12px; line-height: 1.7; }
.hero-note strong { color: var(--orange); font-family: "DM Mono", monospace; font-size: 20px; font-weight: 500; }
.note-pin { color: var(--orange); font-size: 19px; line-height: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 34px; }
.stat-card { min-height: 110px; display: flex; flex-direction: column; padding: 17px 18px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,253,250,.63); }
.stat-card.highlight { border-color: #e9c7b7; background: var(--orange-wash); }
.stat-label { color: var(--ink-soft); font-family: "DM Mono", monospace; font-size: 10px; }
.stat-card strong { margin-top: auto; color: var(--ink); font-family: "DM Mono", monospace; font-size: 28px; font-weight: 500; letter-spacing: -.08em; }
.stat-foot { margin-top: 3px; color: var(--muted); font-size: 10px; }
.toolbar { display: flex; align-items: center; gap: 13px; min-height: 48px; margin-bottom: 22px; }
.search-box { min-width: 240px; flex: 1; display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 11px 0 14px; border: 1px solid var(--line-dark); border-radius: 10px; background: rgba(255,253,250,.8); transition: .2s ease; }
.search-box:focus-within { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(230,105,61,.1); }
.search-icon { color: var(--orange); font-size: 21px; line-height: 1; transform: translateY(-1px); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-box input::placeholder { color: #a6aaa5; }
.shortcut { padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; color: #a4a8a2; font-family: "DM Mono", monospace; font-size: 9px; white-space: nowrap; }
.filter-row { display: flex; gap: 7px; align-items: center; overflow: auto; }
.filter-chip { min-height: 31px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); background: transparent; font-size: 11px; white-space: nowrap; transition: .2s ease; }
.filter-chip:hover { border-color: var(--orange); color: var(--orange-deep); }
.filter-chip.is-active { border-color: var(--ink); color: #fffaf3; background: var(--ink); }
.filter-button { min-width: 106px; border: 1px solid var(--line); color: var(--ink-soft); background: transparent; font-size: 11px; white-space: nowrap; }
.filter-button:hover { background: rgba(255,255,255,.5); }
.content-section { min-height: 350px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.section-heading h3 { margin: 0; font-family: "Noto Serif SC", serif; font-size: 19px; font-weight: 600; letter-spacing: -.04em; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.section-heading .result-count { color: var(--muted); font-family: "DM Mono", monospace; font-size: 10px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 15px; }
.contact-card { position: relative; min-height: 247px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); transition: .22s ease; }
.contact-card:hover { border-color: #c7bfb3; box-shadow: var(--shadow); transform: translateY(-3px); }
.contact-card.is-selected { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(230,105,61,.12), var(--shadow); }
.card-visual { position: relative; min-height: 143px; display: flex; flex-direction: column; justify-content: space-between; padding: 17px 17px 15px; overflow: hidden; color: #f9f7ee; background: var(--navy); }
.card-visual.mint { background: #3f6255; }
.card-visual.orange { background: #9d4e36; }
.card-visual::after { content: ""; position: absolute; width: 150px; height: 150px; right: -58px; bottom: -72px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; box-shadow: 0 0 0 22px rgba(255,255,255,.04), 0 0 0 44px rgba(255,255,255,.03); }
.card-visual.has-image { padding: 0; background: #d8d5cc; }
.card-photo { width: 100%; height: 100%; min-height: 143px; display: block; object-fit: contain; background: #d8d5cc; }
.visual-top, .visual-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 8px; }
.visual-top { align-items: flex-start; }
.visual-label { color: rgba(255,255,255,.65); font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .08em; }
.visual-brand { max-width: 105px; color: #fff5df; font-family: "Noto Serif SC", serif; font-size: 13px; font-weight: 600; line-height: 1.25; }
.visual-monogram { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; color: var(--yellow); font-family: "DM Mono", monospace; font-size: 12px; }
.visual-name { font-family: "Noto Serif SC", serif; font-size: 19px; font-weight: 600; letter-spacing: -.04em; }
.visual-title { margin-top: 3px; color: rgba(255,255,255,.7); font-family: "DM Mono", monospace; font-size: 9px; }
.card-body { display: flex; flex-direction: column; flex: 1; padding: 13px 16px 14px; }
.card-name-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-name { margin: 0; font-family: "Noto Serif SC", serif; font-size: 16px; font-weight: 600; letter-spacing: -.04em; }
.card-title { margin: 4px 0 0; color: var(--ink-soft); font-size: 11px; }
.card-company { margin: auto 0 0; padding-top: 13px; color: var(--ink-soft); font-size: 11px; }
.card-company strong { color: var(--ink); font-weight: 600; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.tag-pill { display: inline-flex; align-items: center; min-height: 20px; padding: 0 7px; border-radius: 5px; color: #66716e; background: #edf0ea; font-size: 10px; }
.tag-pill.orange { color: var(--orange-deep); background: var(--orange-wash); }
.tag-pill.mint { color: #476a58; background: var(--mint); }
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 5px; color: #92652a; background: #fff3d8; font-family: "DM Mono", monospace; font-size: 8px; white-space: nowrap; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #d59a31; }
.duplicate-badge { display: inline-flex; align-items: center; padding: 4px 6px; border-radius: 5px; color: #8f4e34; background: #ffe8df; font-family: "DM Mono", monospace; font-size: 8px; }
.card-source { margin-top: 10px; color: #a0a5a0; font-family: "DM Mono", monospace; font-size: 9px; }
.review-reason { margin: 9px 0 0; color: #986f3b; font-size: 10px; line-height: 1.45; }
.card-quick-action { align-self: flex-start; margin-top: 8px; padding: 5px 8px; border: 1px solid #e9c99e; border-radius: 6px; color: #8c642c; background: #fff8e9; font-size: 10px; cursor: pointer; }
.card-quick-action:hover { color: #fff; background: #bd7548; border-color: #bd7548; }
.empty-state { display: grid; place-items: center; min-height: 250px; padding: 30px; border: 1px dashed var(--line-dark); border-radius: var(--radius); color: var(--ink-soft); text-align: center; }
.empty-state strong { display: block; margin-bottom: 6px; font-family: "Noto Serif SC", serif; font-size: 18px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; }

.company-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 13px; }
.company-card { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-soft); }
.company-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.company-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px 12px 12px 3px; color: var(--yellow); background: var(--navy); font-family: "DM Mono", monospace; font-size: 13px; }
.company-card h4 { margin: 0; font-family: "Noto Serif SC", serif; font-size: 16px; font-weight: 600; }
.company-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.company-type { display: inline-block; margin-top: 7px; color: var(--orange-deep); font-family: "DM Mono", monospace; font-size: 9px; }
.company-card-count { color: var(--orange); font-family: "DM Mono", monospace; font-size: 12px; }
.org-chart { margin-top: 17px; padding-top: 13px; border-top: 1px dashed var(--line-dark); }
.org-chart-note { margin-bottom: 10px; color: var(--muted); font-family: "DM Mono", monospace; font-size: 9px; }
.org-level { display: flex; align-items: flex-start; gap: 9px; }
.org-level-label { flex: 0 0 72px; padding-top: 6px; color: var(--muted); font-family: "DM Mono", monospace; font-size: 9px; line-height: 1.35; }
.org-nodes { display: flex; flex: 1; flex-wrap: wrap; gap: 7px; }
.org-node { min-width: 112px; max-width: 170px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); text-align: left; background: #fffcf7; transition: .18s ease; }
.org-node:hover { border-color: var(--orange); background: var(--orange-wash); transform: translateY(-1px); }
.org-node strong, .org-node span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-node strong { color: var(--ink); font-size: 10px; }
.org-node span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.org-connector { width: 1px; height: 10px; margin: 4px 0 4px 35px; background: var(--line-dark); }
.company-people { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 18px; padding-top: 13px; border-top: 1px solid var(--line); }
.person-chip { padding: 5px 8px; border-radius: 6px; color: var(--ink-soft); background: var(--paper); font-size: 10px; }

.detail-panel { position: fixed; z-index: 20; top: 0; right: 0; width: min(510px, 100%); height: 100vh; overflow: auto; padding: 28px; border-left: 1px solid var(--line); background: var(--surface); box-shadow: -18px 0 50px rgba(29,37,40,.14); animation: slideIn .24s ease both; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.detail-head h3 { margin: 7px 0 3px; font-family: "Noto Serif SC", serif; font-size: 25px; font-weight: 600; letter-spacing: -.05em; }
.detail-head p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.detail-preview { margin: 22px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.card-3d-scene { min-height: 330px; display: grid; place-items: center; padding: 26px 18px 22px; overflow: hidden; background: radial-gradient(circle at 50% 45%, rgba(255,255,255,.82), rgba(216,213,204,.74) 55%, #cbc8bf); perspective: 1200px; cursor: grab; touch-action: none; user-select: none; }
.card-3d-scene:active { cursor: grabbing; }
.card-3d-shell { position: relative; width: min(100%, 390px); aspect-ratio: 1.67; transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)); transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2,.8,.2,1); filter: drop-shadow(0 24px 18px rgba(31,39,38,.22)); }
.card-3d-shell.is-dragging { transition: none; }
.card-3d-shell.is-flipped { --flip: 180deg; }
.card-3d-face { position: absolute; inset: 0; overflow: hidden; padding: 19px 21px; border: 1px solid rgba(255,255,255,.35); border-radius: 16px; color: #f7f6ee; background: linear-gradient(132deg, #152e3e 0%, #224f5d 58%, #2f756e 100%); backface-visibility: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.23), inset 0 -18px 35px rgba(0,0,0,.12); }
.card-3d-face::before { content: ""; position: absolute; width: 180px; height: 180px; right: -74px; top: -80px; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; box-shadow: 0 0 0 19px rgba(255,255,255,.06), 0 0 0 38px rgba(255,255,255,.04); }
.card-3d-face::after { content: ""; position: absolute; width: 170px; height: 80px; left: -45px; bottom: -46px; border: 1px solid rgba(242,199,88,.48); border-radius: 50%; transform: rotate(-24deg); }
.card-3d-front { display: flex; flex-direction: column; justify-content: space-between; }
.card-3d-kicker, .card-3d-source { position: relative; z-index: 2; color: rgba(255,255,255,.62); font-family: "DM Mono", monospace; font-size: 8px; letter-spacing: .11em; }
.card-3d-brand { position: relative; z-index: 2; max-width: 72%; color: #f3d772; font-family: "Noto Serif SC", serif; font-size: 13px; font-weight: 600; line-height: 1.2; }
.card-3d-identity { position: relative; z-index: 2; }
.card-3d-identity h4 { max-width: 80%; margin: 0; color: #fffdf5; font-family: "Noto Serif SC", serif; font-size: 23px; font-weight: 600; letter-spacing: -.06em; }
.card-3d-identity p { max-width: 80%; margin: 4px 0 0; color: rgba(255,255,255,.72); font-size: 10px; }
.card-3d-details { position: relative; z-index: 2; display: grid; gap: 4px; max-width: 76%; margin-top: auto; margin-bottom: 10px; }
.card-3d-details div { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 5px; align-items: baseline; }
.card-3d-details span { color: rgba(255,255,255,.52); font-family: "DM Mono", monospace; font-size: 7px; }
.card-3d-details strong { overflow: hidden; color: rgba(255,255,255,.86); font-size: 8px; font-weight: 400; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.card-3d-mark { position: absolute; z-index: 2; right: 20px; bottom: 18px; display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid rgba(242,199,88,.72); border-radius: 50%; color: #f3d772; font-family: "DM Mono", monospace; font-size: 10px; }
.card-3d-orbit { position: absolute; z-index: 1; width: 120px; height: 120px; right: -7px; bottom: -36px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; transform: rotate(22deg); box-shadow: 0 0 0 13px rgba(255,255,255,.035), 0 0 0 26px rgba(255,255,255,.03); }
.card-3d-glow { position: absolute; width: 110px; height: 110px; right: 31px; top: 25px; border-radius: 50%; background: rgba(242,199,88,.18); filter: blur(25px); }
.card-3d-glass { position: absolute; z-index: 1; inset: -35%; pointer-events: none; background: radial-gradient(35% 58% at var(--shine-x, 50%) var(--shine-y, 50%), rgba(255,255,255,.54), rgba(255,255,255,.12) 34%, transparent 68%), linear-gradient(116deg, transparent 37%, rgba(255,255,255,.22) 47%, rgba(255,255,255,.04) 52%, transparent 61%); mix-blend-mode: screen; opacity: .8; transform: rotate(-7deg); transition: background .12s linear, opacity .25s ease; }
.card-3d-back-brand { position: relative; z-index: 2; margin-top: 12px; color: #f3d772; font-family: "Noto Serif SC", serif; font-size: 13px; font-weight: 600; }
.card-3d-back-grid { position: relative; z-index: 2; display: grid; gap: 8px; margin-top: 16px; }
.card-3d-back-grid div { display: grid; gap: 2px; }
.card-3d-back-grid span { color: rgba(255,255,255,.55); font-family: "DM Mono", monospace; font-size: 8px; }
.card-3d-back-grid strong { max-height: 28px; overflow: hidden; color: rgba(255,255,255,.88); font-size: 9px; font-weight: 400; line-height: 1.35; }
.card-3d-tags { position: absolute; z-index: 2; right: 18px; bottom: 19px; display: flex; max-width: 58%; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.card-3d-tags .tag-pill { min-height: 17px; padding: 0 5px; color: #eaf6e8; background: rgba(255,255,255,.12); font-size: 8px; }
.card-3d-tags .tag-pill.orange { color: #ffe6a2; background: rgba(242,199,88,.17); }
.card-3d-source { position: absolute; left: 21px; bottom: 19px; }
.card-3d-controls { flex-wrap: wrap; gap: 8px; }
.card-3d-controls > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.raw-card-preview.hidden { display: none; }
.raw-preview-kicker { padding: 10px 11px 0; color: var(--muted); font-family: "DM Mono", monospace; font-size: 9px; }
.virtual-card-stage { min-height: 220px; background: #d8d5cc; }
.virtual-card-side { position: relative; min-height: 220px; }
.side-label { position: absolute; z-index: 2; top: 10px; right: 10px; padding: 4px 7px; border-radius: 5px; color: #fff; background: rgba(29,37,40,.58); font-family: "DM Mono", monospace; font-size: 9px; }
.detail-preview .card-visual { min-height: 220px; }
.detail-preview .card-photo, .virtual-card-side .card-photo { width: 100%; min-height: 220px; display: block; object-fit: contain; background: #d8d5cc; }
.virtual-card-controls { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px; border-top: 1px solid var(--line); color: var(--muted); font-family: "DM Mono", monospace; font-size: 9px; background: var(--surface); }
.flip-button { padding: 5px 8px; border: 1px solid var(--line-dark); border-radius: 6px; color: var(--ink-soft); background: transparent; font-size: 10px; }
.flip-button:hover:not(:disabled) { color: var(--orange-deep); border-color: var(--orange); background: var(--orange-wash); }
.flip-button:disabled { cursor: not-allowed; opacity: .55; }
.detail-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.detail-section-title h4 { margin: 0; font-family: "Noto Serif SC", serif; font-size: 15px; font-weight: 600; }
.detail-section-title span { color: var(--muted); font-family: "DM Mono", monospace; font-size: 9px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-family: "DM Mono", monospace; font-size: 9px; }
.field input, .field textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; outline: 0; color: var(--ink); background: #fffcf7; font-size: 12px; transition: .2s ease; }
.field textarea { min-height: 70px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(230,105,61,.09); }
.tag-editor { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.editable-tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; color: #55675e; background: var(--mint); font-size: 10px; }
.editable-tag.orange { color: var(--orange-deep); background: var(--orange-wash); }
.remove-tag { padding: 0; border: 0; color: inherit; background: transparent; font-size: 13px; line-height: 1; opacity: .65; }
.tag-input { min-width: 105px; padding: 6px 7px; border: 1px dashed var(--line-dark); border-radius: 6px; outline: 0; background: transparent; font-size: 10px; }
.tag-input:focus { border-color: var(--orange); }
.source-box { display: flex; gap: 9px; align-items: flex-start; padding: 11px; border-radius: 9px; color: var(--ink-soft); background: var(--paper); font-size: 11px; line-height: 1.55; }
.source-box b { color: var(--ink); font-weight: 600; }
.source-icon { color: var(--orange); font-size: 16px; }
.ocr-box { max-height: 120px; overflow: auto; padding: 11px; border-radius: 9px; color: #617074; background: var(--navy); font-family: "DM Mono", monospace; font-size: 10px; line-height: 1.65; white-space: pre-wrap; }
.detail-actions { display: flex; gap: 8px; margin-top: 18px; }
.detail-actions .primary-button { flex: 1; }
.ocr-actions { display: flex; gap: 8px; align-items: center; }
.ocr-language { padding: 0 7px; height: 31px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); background: transparent; font-size: 10px; }
.duplicate-callout { margin-top: 16px; padding: 12px; border: 1px solid #f1c5b6; border-radius: 9px; color: #864c37; background: #fff4ef; font-size: 11px; line-height: 1.55; }
.duplicate-callout button { margin-top: 8px; padding: 0; border: 0; color: var(--orange-deep); background: transparent; font-size: 11px; text-decoration: underline; }
.review-resolution { margin: 14px 0 16px; padding: 12px 14px; border: 1px solid #e9c99e; border-radius: 9px; color: #76572f; background: #fff8e9; font-size: 11px; line-height: 1.55; }
.review-resolution strong { display: block; margin-bottom: 4px; color: #68491f; }
.review-resolution p { margin: 0 0 4px; }
.review-resolution span { color: #9b815d; font-size: 10px; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(29,37,40,.48); backdrop-filter: blur(4px); }
.modal-backdrop.hidden { display: none; }
.merge-modal { width: min(700px, 100%); padding: 26px; border-radius: 18px; background: var(--surface); box-shadow: 0 30px 90px rgba(20,28,31,.22); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.modal-header h3 { margin: 6px 0 0; font-family: "Noto Serif SC", serif; font-size: 23px; font-weight: 600; letter-spacing: -.05em; }
.modal-copy { max-width: 580px; margin: 12px 0 20px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.merge-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.merge-side { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fffcf7; }
.merge-side h4 { margin: 0 0 10px; font-family: "Noto Serif SC", serif; font-size: 14px; }
.merge-side p { margin: 6px 0; color: var(--ink-soft); font-size: 11px; }
.merge-side p strong { color: var(--ink); font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.toast { position: fixed; z-index: 80; right: 24px; bottom: 24px; max-width: 340px; padding: 12px 15px; border: 1px solid #b7d0bd; border-radius: 9px; color: #34553d; background: #f0f8f1; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .25s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .main-content { padding-right: 30px; padding-left: 30px; }
  .sidebar { width: 210px; }
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
  .filter-row { flex: 1; }
}
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; padding: 16px 16px 12px; }
  .brand-lockup { padding: 0 2px 15px; }
  .main-nav { display: flex; gap: 5px; overflow: auto; }
  .nav-item { width: auto; flex: 0 0 auto; padding: 8px 10px; font-size: 11px; }
  .sidebar-rule, .sidebar-section, .sidebar-footer { display: none; }
  .main-content { padding: 0 17px 45px; }
  .topbar { min-height: 63px; }
  .breadcrumb { font-size: 9px; }
  .topbar .ghost-button { display: none; }
  .topbar-actions { margin-left: auto; }
  .hero-row { align-items: flex-start; flex-direction: column; gap: 18px; padding: 30px 0 23px; }
  .hero-note { max-width: none; width: 100%; }
  .stats-grid { grid-template-columns: 1fr 1fr; margin-bottom: 25px; }
  .stat-card { min-height: 96px; padding: 13px; }
  .stat-card strong { font-size: 23px; }
  .filter-button { display: none; }
  .card-grid, .company-list { grid-template-columns: 1fr; }
  .detail-panel { padding: 20px 17px; }
  .merge-comparison { grid-template-columns: 1fr; }
}
