:root {
  --bg: #f8fafc;
  --bg-deep: #eef2ff;
  --card: rgba(255, 255, 255, .94);
  --line: #e2e8f0;
  --line-soft: #edf2f7;
  --muted: #64748b;
  --text: #0f172a;
  --ink: #182033;
  --accent: #6366f1;
  --accent-soft: #eef2ff;
  --field-blue: #2563eb;
  --field-blue-soft: #eff6ff;
  --review-teal: #0f766e;
  --review-teal-soft: #f0fdfa;
  --warning-amber: #b45309;
  --warning-amber-soft: #fffbeb;
  --risk-red: #be123c;
  --risk-red-soft: #fff1f2;
  --sidebar-width: 280px;
  --shadow: 0 18px 40px rgba(15, 23, 42, .055);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
}

* { box-sizing: border-box; }
html { min-width: 320px; overflow-x: hidden; background: var(--bg); }
body { margin: 0; min-width: 320px; overflow-x: hidden; background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { border: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(99,102,241,.2); outline-offset: 2px; }
a { color: inherit; }
svg { width: 16px; height: 16px; stroke-width: 1.9; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; overflow: hidden; background: radial-gradient(circle at 20% 0, rgba(224,231,255,.78) 0, transparent 34%), linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%); }
.sidebar { display: flex; min-width: 0; flex-direction: column; gap: 16px; padding: 20px 16px; border-right: 1px solid var(--line); background: rgba(255,255,255,.84); backdrop-filter: blur(16px); overflow: hidden; }
.sidebar-brand { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 2px 4px 4px; }
.sidebar-brand__logo { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 17px; background: #fff; padding: 6px; box-shadow: 0 10px 25px rgba(15,23,42,.1); }
.sidebar-brand__name { overflow: hidden; color: var(--ink); font-size: 18px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-brand__sub { margin-top: 2px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.primary-action { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px 14px; border: 1px solid #4f46e5; border-radius: 12px; background: #4f46e5; color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 8px 18px rgba(79,70,229,.2); transition: transform .15s, background .15s; }
.primary-action:hover { background: #4338ca; transform: translateY(-1px); }
.sidebar-content { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 18px; overflow-y: auto; padding-right: 4px; }
.sidebar-group { display: flex; flex-direction: column; gap: 8px; }
.sidebar-group__label { display: flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.nav-list { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; min-height: 40px; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; background: transparent; color: #334155; font-size: 14px; text-align: left; cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.nav-item svg { color: #7c8aa0; flex: 0 0 16px; }
.nav-item:hover { background: #f1f5f9; color: var(--ink); transform: translateX(1px); }
.nav-item:hover svg { color: var(--accent); }
.nav-item.active { background: var(--accent-soft); color: #3730a3; font-weight: 800; }
.nav-item.active svg { color: var(--accent); }
.nav-item > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { display: inline-flex; min-width: 20px; height: 20px; align-items: center; justify-content: center; margin-left: auto; padding: 0 6px; border: 1px solid #c7d2fe; border-radius: 999px; background: #fff; color: #4f46e5; font-size: 11px; font-weight: 800; }
.sidebar-grow { flex: 1; min-height: 20px; }
.sidebar-user { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 14px; background: rgba(248,250,252,.88); }
.sidebar-user__avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 12px; background: #e0e7ff; color: #4338ca; font-weight: 800; }
.sidebar-user__meta { min-width: 0; flex: 1; }
.sidebar-user__name { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user__role { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user__dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px #dcfce7; }
.sidebar-toggle, .sidebar-backdrop { display: none; }

.app-main { min-width: 0; min-height: 100vh; min-height: 100dvh; overflow: auto; }
.topbar { display: flex; min-height: 96px; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 32px 16px; border-bottom: 1px solid rgba(226,232,240,.72); background: rgba(255,255,255,.58); backdrop-filter: blur(18px); }
.topbar-context { min-width: 0; }
.topbar-kicker { margin-bottom: 4px; color: var(--field-blue); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.topbar-title { overflow: hidden; color: var(--ink); font-size: 26px; font-weight: 800; letter-spacing: 0; line-height: 1.22; text-overflow: ellipsis; white-space: nowrap; }
.topbar-subtitle { margin-top: 6px; max-width: 720px; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-toolbar { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 8px; }
.session-field { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.session-field select { min-width: 180px; max-width: 240px; padding: 9px 30px 9px 11px; border: 1px solid #dbe3ef; border-radius: 11px; background: #fff; color: var(--ink); cursor: pointer; }
.ghost-icon-button { display: inline-grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.82); color: #52657d; cursor: pointer; transition: background .15s, color .15s, transform .15s; }
.ghost-icon-button:hover { background: #fff; color: var(--accent); transform: translateY(-1px); }
.page-content { width: min(1240px, 100%); margin: 0 auto; padding: 26px 32px 44px; }
.page-actions { display: flex; justify-content: flex-end; gap: 8px; margin: -6px 0 18px; }
.page-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.page-title h1 { margin: 0; color: var(--ink); font-size: 24px; font-weight: 800; }
.page-title p { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.icp-footer { padding: 0 32px 24px; color: #94a3b8; font-size: 11px; text-align: center; }

.btn { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font-weight: 800; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover:not(:disabled) { border-color: #c7d2fe; background: #f8faff; transform: translateY(-1px); }
.btn.primary { border-color: #4f46e5; background: #4f46e5; color: #fff; box-shadow: 0 7px 16px rgba(79,70,229,.17); }
.btn.primary:hover:not(:disabled) { border-color: #4338ca; background: #4338ca; }
.btn.secondary { color: #40536d; }
.btn.warn { border-color: #fde68a; background: var(--warning-amber-soft); color: var(--warning-amber); }
.btn.danger { border-color: #fecdd3; background: var(--risk-red-soft); color: var(--risk-red); }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.stat-card { position: relative; overflow: hidden; min-height: 105px; padding: 17px 18px; }
.stat-card::after { position: absolute; right: -20px; bottom: -26px; width: 96px; height: 96px; border-radius: 50%; background: rgba(99,102,241,.08); content: ""; }
.stat-card small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-card strong { display: block; margin-top: 9px; color: var(--ink); font-size: 24px; font-variant-numeric: tabular-nums; }
.panel { min-width: 0; margin-bottom: 16px; padding: 19px 20px; }
.panel h2 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 800; }
.panel h2 small { color: var(--muted); font-size: 12px; font-weight: 500; }
.table-wrap { overflow: auto; border: 1px solid var(--line-soft); border-radius: 12px; }
.data-table { width: 100%; min-width: 700px; border-collapse: collapse; background: #fff; }
.data-table th, .data-table td { padding: 12px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
.data-table th { background: #f8fafc; color: var(--muted); font-size: 11px; font-weight: 800; }
.data-table td { color: #334155; font-size: 13px; }
.data-table tbody tr { cursor: pointer; transition: background .15s; }
.data-table tbody tr:hover { background: #f8faff; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.empty, .aq-empty-state { display: flex; min-height: 170px; align-items: center; justify-content: center; padding: 30px 18px; border: 1px dashed #cbd5e1; border-radius: 14px; color: var(--muted); background: rgba(255,255,255,.66); text-align: center; }
.aq-loading-state { display: inline-flex; min-height: 80px; align-items: center; gap: 8px; color: var(--muted); }
.aq-loading-state__spinner { width: 15px; height: 15px; border: 2px solid #dbeafe; border-top-color: var(--accent); border-radius: 50%; animation: aq-spin .75s linear infinite; }
@keyframes aq-spin { to { transform: rotate(360deg); } }

.status { display: inline-flex; min-height: 24px; align-items: center; padding: 3px 9px; border: 1px solid transparent; border-radius: 999px; font-size: 11px; font-weight: 800; line-height: 1.3; white-space: nowrap; }
.status.DRAFT, .status.NEEDS_CORRECTION { border-color: var(--line); background: #f8fafc; color: var(--muted); }
.status.SUBMITTED, .status.APPROVAL_REVIEW, .status.GM_REVIEW, .status.FINANCE_REVIEW, .status.WAITING_PAYOUT { border-color: #bfdbfe; background: var(--field-blue-soft); color: var(--field-blue); }
.status.PAID { border-color: #99f6e4; background: var(--review-teal-soft); color: var(--review-teal); }
.status.REJECTED, .status.CANCELLED { border-color: #fecdd3; background: var(--risk-red-soft); color: var(--risk-red); }
.notice { display: flex; gap: 9px; margin: 12px 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; color: #42536b; background: #f8fafc; font-size: 13px; line-height: 1.6; }
.notice.info { border-color: #bfdbfe; color: #1d4ed8; background: var(--field-blue-soft); }
.notice.warn { border-color: #fde68a; color: #92400e; background: var(--warning-amber-soft); }
.notice.error { border-color: #fecdd3; color: var(--risk-red); background: var(--risk-red-soft); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #42536a; font-size: 12px; font-weight: 800; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid #dbe3ef; border-radius: 11px; outline: 0; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.field textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
.field input::placeholder, .field textarea::placeholder { color: #a0aec0; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.13); }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.proof-notice { margin-top: -4px; }
.proof-sheet { padding: 24px; overflow: hidden; }
.proof-sheet-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 19px; border-bottom: 1px solid var(--line-soft); }
.proof-sheet-kicker { color: var(--field-blue); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.proof-sheet-heading h2 { margin: 5px 0 0; color: var(--ink); font-size: 28px; letter-spacing: .04em; }
.proof-sheet-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.proof-sheet-badge { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid #c7d2fe; border-radius: 999px; background: var(--accent-soft); color: #4338ca; font-size: 11px; font-weight: 800; white-space: nowrap; }
.proof-head-grid { display: grid; grid-template-columns: 1fr 1.6fr 1fr 1.5fr; gap: 14px; margin-top: 19px; }
.proof-field { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.proof-field-wide { grid-column: 1 / -1; }
.proof-field label, .proof-extra-grid label { color: #42536a; font-size: 12px; font-weight: 800; }
.proof-field label em { color: var(--risk-red); font-style: normal; }
.proof-field input, .proof-field select, .proof-field textarea { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid #dbe3ef; border-radius: 11px; outline: 0; background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.proof-field textarea { min-height: 70px; resize: vertical; line-height: 1.6; }
.proof-field input:focus, .proof-field select:focus, .proof-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.13); }
.proof-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.proof-section-title > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.proof-section-title h3, .proof-section-title h2 { margin: 0; color: var(--ink); font-size: 16px; }
.proof-section-title p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.proof-section-number { display: grid; width: 29px; height: 29px; flex: 0 0 29px; place-items: center; border-radius: 10px; background: var(--accent-soft); color: #4f46e5; font-size: 11px; font-weight: 800; }
.proof-section-title--compact { margin-top: 25px; }
.proof-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.proof-table { width: 100%; min-width: 1080px; border-collapse: separate; border-spacing: 0; }
.proof-table th, .proof-table td { padding: 11px 9px; border-bottom: 1px solid var(--line-soft); vertical-align: top; text-align: left; }
.proof-table th { background: #f8fafc; color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.proof-table tbody tr:last-child td { border-bottom: 1px solid var(--line-soft); }
.proof-table tfoot td { background: #fbfdff; border-bottom: 0; }
.proof-table input { width: 100%; min-width: 0; padding: 9px 9px; border: 1px solid #dbe3ef; border-radius: 9px; outline: 0; background: #fff; color: var(--ink); font-size: 12px; }
.proof-table input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.proof-table input[readonly] { background: #f8fafc; color: #334155; font-weight: 800; }
.proof-col-reason { width: 24%; }
.proof-col-qty { width: 8%; }
.proof-col-unit { width: 8%; }
.proof-col-price, .proof-col-amount { width: 11%; }
.proof-col-file { width: 17%; }
.proof-col-check { width: 13%; }
.proof-col-action { width: 42px; }
.proof-reason-cell { min-width: 240px; }
.proof-inline-details { margin-top: 8px; }
.proof-inline-details summary { color: var(--field-blue); font-size: 11px; font-weight: 800; cursor: pointer; }
.proof-inline-details[open] summary { margin-bottom: 8px; }
.proof-extra-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; border: 1px solid #e0e7ff; border-radius: 10px; background: #fafbff; }
.proof-extra-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 10px; }
.proof-extra-grid input { padding: 7px 8px; font-size: 11px; }
.proof-file-cell { min-width: 170px; }
.proof-file-picker { display: block; cursor: pointer; }
.proof-file-picker input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.proof-file-picker span { display: flex; min-height: 36px; align-items: center; gap: 6px; overflow: hidden; padding: 8px 9px; border: 1px dashed #a5b4fc; border-radius: 9px; background: #f8faff; color: #4f46e5; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.proof-file-picker:hover span { border-color: var(--accent); background: var(--accent-soft); }
.proof-file-hint { display: block; margin-top: 4px; color: #94a3b8; font-size: 10px; }
.proof-check-status { display: inline-flex; min-height: 26px; align-items: center; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: #f8fafc; color: var(--muted); font-size: 10px; font-weight: 800; white-space: nowrap; }
.proof-check-status.is-ready { border-color: #bfdbfe; background: var(--field-blue-soft); color: var(--field-blue); }
.icon-button { display: inline-grid; width: 31px; height: 31px; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: #64748b; cursor: pointer; }
.icon-button:hover { border-color: #c7d2fe; color: var(--accent); }
.danger-icon:hover { border-color: #fecdd3; color: var(--risk-red); background: var(--risk-red-soft); }
.proof-total-label { color: var(--muted); font-size: 12px; font-weight: 800; text-align: right !important; }
.proof-total-amount { color: var(--ink); font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
.proof-total-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 13px; padding: 13px 15px; border: 1px solid #dbeafe; border-radius: 12px; background: linear-gradient(90deg, #f8fbff, #f5f3ff); }
.proof-total-bar span { display: block; color: var(--muted); font-size: 11px; }
.proof-total-bar strong { display: block; margin-top: 4px; color: var(--ink); font-size: 15px; }
.proof-total-tip { display: inline-flex; align-items: center; gap: 6px; color: #52657d; font-size: 11px; }
.proof-total-tip svg { color: var(--review-teal); }
.proof-payment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.proof-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line-soft); }
.proof-table--readonly { min-width: 820px; }
.proof-table--readonly td { color: #334155; font-size: 12px; vertical-align: middle; }
.proof-table--readonly td strong { color: var(--ink); }
.proof-detail-panel { padding-bottom: 18px; }
.proof-section-title--detail { margin-top: 0; }
.proof-detail-total { color: var(--ink); font-size: 14px; font-weight: 900; }
.proof-total-bar--detail { margin-bottom: 0; }
.muted-text { color: #94a3b8; }
.workflow-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.workflow-step { display: flex; min-height: 44px; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.7); color: #8290a4; font-size: 12px; font-weight: 700; }
.workflow-step strong { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 8px; background: #eef2f7; color: #7b8aa0; font-size: 11px; }
.workflow-step.is-current { border-color: #c7d2fe; background: var(--accent-soft); color: #4338ca; }
.workflow-step.is-current strong { background: var(--accent); color: #fff; }
.workflow-step.is-done { border-color: #a7f3d0; background: #f0fdf4; color: var(--review-teal); }
.workflow-step.is-done strong { background: #10b981; color: #fff; }
.detail-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.back { display: inline-flex; min-height: 38px; align-items: center; gap: 6px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: #63748a; cursor: pointer; }
.back:hover { border-color: #c7d2fe; color: var(--accent); }
.detail-title { min-width: 0; flex: 1; }
.detail-title h1 { margin: 0; overflow: hidden; color: var(--ink); font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.detail-title p { margin: 6px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.detail-head > div:last-child { flex: 0 0 auto; }
.meta-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.meta-item { min-width: 0; }
.meta-item small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.meta-item strong { display: block; overflow: hidden; color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.invoice-card { margin: 11px 0; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.invoice-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.invoice-name { min-width: 0; overflow: hidden; color: var(--ink); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.invoice-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; color: var(--muted); font-size: 11px; }
.invoice-fields b { display: block; margin-top: 4px; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.invoice-meta-note { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; line-height: 1.6; }
.invoice-meta-note strong { color: var(--ink); }
.manual-edit { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.manual-edit summary { color: var(--field-blue); font-size: 12px; font-weight: 800; cursor: pointer; }
.manual-edit[open] summary { margin-bottom: 13px; }
.action-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.action-bar textarea { flex: 1 1 100%; min-height: 72px; padding: 10px 11px; border: 1px solid #dbe3ef; border-radius: 11px; resize: vertical; }
.timeline { position: relative; margin: 14px 0 0 8px; }
.event { position: relative; padding: 0 0 18px 25px; border-left: 1px solid #dbe3ef; }
.event:last-child { border-left-color: transparent; }
.event::before { position: absolute; top: 3px; left: -5px; width: 9px; height: 9px; border: 3px solid #fff; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px #c7d2fe; content: ""; }
.event-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.event-head strong { color: var(--ink); font-size: 12px; }
.event-head small { color: var(--muted); font-size: 11px; }
.event p { margin: 5px 0 0; color: #5f7188; font-size: 12px; line-height: 1.6; }
.notification { display: flex; align-items: flex-start; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.notification:last-child { border-bottom: 0; }
.notification-dot { width: 8px; height: 8px; flex: 0 0 8px; margin-top: 6px; border-radius: 50%; background: #d7dee8; }
.notification.unread .notification-dot { background: var(--accent); box-shadow: 0 0 0 3px #e0e7ff; }
.notification-body { min-width: 0; flex: 1; }
.notification-body strong { display: block; color: var(--ink); font-size: 13px; }
.notification-body p { margin: 5px 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.notification-body small { color: #94a3b8; font-size: 11px; }
.notice-open { flex: 0 0 auto; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: min(420px, calc(100vw - 32px)); padding: 11px 15px; border: 1px solid rgba(255,255,255,.18); border-radius: 12px; background: #172033; color: #fff; box-shadow: 0 14px 30px rgba(15,23,42,.2); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #9f1239; }
.admin-table { min-width: 720px; }
.route-skip-badge { display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid #a7f3d0; border-radius: 999px; background: #f0fdf4; color: #047857; font-weight: 800; }
.flow-node-list { display: grid; gap: 8px; margin-top: 12px; }
.flow-node-card { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.flow-node-card strong { display: grid; width: 26px; height: 26px; flex: 0 0 26px; place-items: center; border-radius: 8px; background: var(--accent-soft); color: #4338ca; font-size: 11px; }
.flow-node-card__meta { min-width: 0; flex: 1; }
.flow-node-card__meta b { display: block; color: var(--ink); font-size: 12px; }
.flow-node-card__meta small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.flow-node-card--skip { opacity: .68; background: #f8fafc; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.admin-tab { padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-weight: 800; cursor: pointer; }
.admin-tab.is-active { border-color: #c7d2fe; background: var(--accent-soft); color: #4338ca; }
.directory-picker { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(0, 1.2fr); gap: 12px; }
.directory-tree, .directory-users { min-height: 220px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.directory-tree button, .directory-user { width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: #42536a; text-align: left; cursor: pointer; }
.directory-tree button:hover, .directory-tree button.is-active, .directory-user:hover { background: var(--accent-soft); color: #4338ca; }
.directory-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line-soft); }
.directory-user small { color: var(--muted); }
.flow-editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }

@media (max-width: 1180px) {
  .app-shell { display: block; overflow: visible; }
  .sidebar { position: fixed; z-index: 1050; top: 0; bottom: 0; left: 0; width: min(var(--sidebar-width), 88vw); border-right: 1px solid var(--line); border-bottom: 0; box-shadow: 16px 0 42px rgba(15,23,42,.13); transform: translateX(-105%); transition: transform .25s cubic-bezier(.4,0,.2,1); }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-toggle { position: fixed; z-index: 1100; top: 12px; left: 12px; display: inline-grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.92); color: var(--ink); box-shadow: 0 5px 18px rgba(15,23,42,.08); cursor: pointer; }
  .app-shell.sidebar-open .sidebar-toggle { left: calc(min(var(--sidebar-width), 88vw) - 52px); }
  .sidebar-backdrop { position: fixed; z-index: 1040; inset: 0; display: block; background: rgba(15,23,42,.38); opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s; }
  .app-shell.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
  .topbar { padding-left: 68px; }
}

@media (max-width: 900px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; padding: 18px 16px 15px 68px; }
  .topbar-title { font-size: 22px; }
  .topbar-subtitle { max-width: none; white-space: normal; }
  .topbar-toolbar { justify-content: flex-start; }
  .session-field { flex: 1; min-width: 0; }
  .session-field select { width: 100%; max-width: none; min-width: 0; }
  .page-content { padding: 20px 16px 34px; }
  .icp-footer { padding: 0 16px 20px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proof-head-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proof-field-wide { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .topbar { min-height: 110px; }
  .topbar-kicker { font-size: 10px; }
  .topbar-title { font-size: 20px; }
  .page-content { padding: 18px 12px 30px; }
  .page-title { align-items: stretch; flex-direction: column; gap: 10px; }
  .page-title h1 { font-size: 21px; }
  .page-actions { justify-content: stretch; margin-top: -2px; }
  .page-actions .btn { flex: 1; }
  .cards { gap: 9px; }
  .stat-card { min-height: 92px; padding: 13px; }
  .stat-card strong { font-size: 20px; }
  .panel { padding: 15px; border-radius: 14px; }
  .form-grid { grid-template-columns: 1fr; gap: 13px; }
  .field.full { grid-column: auto; }
  .meta-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; }
  .meta-item strong { font-size: 12px; }
  .invoice-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .invoice-top { align-items: flex-start; flex-direction: column; }
  .workflow-strip { grid-template-columns: 1fr; }
  .workflow-step { min-height: 40px; }
  .detail-head { align-items: stretch; flex-wrap: wrap; }
  .detail-head .back { flex: 0 0 auto; }
  .detail-title { flex-basis: calc(100% - 60px); }
  .detail-head > div:last-child { flex-basis: 100%; }
  .action-bar .btn { flex: 1; }
  .notification { gap: 9px; }
  .notice-open { padding-inline: 10px; }
  .data-table { min-width: 640px; }
  .proof-sheet { padding: 15px; }
  .proof-sheet-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .proof-sheet-heading h2 { font-size: 24px; }
  .proof-head-grid { grid-template-columns: 1fr; gap: 11px; }
  .proof-field-wide { grid-column: auto; }
  .proof-section-title { align-items: flex-start; flex-direction: column; }
  .proof-section-title > .btn { width: 100%; }
  .proof-extra-grid { grid-template-columns: 1fr; }
  .proof-total-bar { align-items: flex-start; flex-direction: column; gap: 9px; }
  .proof-payment-grid { grid-template-columns: 1fr; }
  .proof-actions { flex-direction: column-reverse; }
  .proof-actions .btn { width: 100%; }
  .directory-picker { grid-template-columns: 1fr; }
  .toast { right: 16px; bottom: 16px; }
}
