:root {
  --teal: #1e9e8f;
  --teal-deep: #137c70;
  --teal-ink: #0d5e56;
  --teal-soft: #e8f6f3;
  --ink: #172235;
  --muted: #687384;
  --line: #e3e9ed;
  --surface: #ffffff;
  --canvas: #f6f8f9;
  --danger: #c04c55;
  --danger-soft: #fff0f1;
  --amber: #9b6b14;
  --amber-soft: #fff7e6;
  --blue: #3d6fa8;
  --blue-soft: #eef5fb;
  --shadow: 0 20px 60px rgba(27, 50, 67, .08);
  --shadow-soft: 0 8px 28px rgba(27, 50, 67, .06);
  --radius: 18px;
  --container: 1320px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.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;
}
.container { width: min(calc(100% - 48px), var(--container)); margin-inline: auto; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 650;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button-primary { color: #fff; background: var(--teal-deep); box-shadow: 0 9px 20px rgba(24, 133, 120, .18); }
.button-primary:hover { background: #106c62; box-shadow: 0 11px 24px rgba(24, 133, 120, .24); }
.button-secondary { background: var(--surface); border-color: #cedadd; color: var(--teal-ink); }
.button-ghost { background: transparent; border-color: var(--line); color: #455364; }
.button-small { min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13px; }
.button-wide { width: 100%; }
.eyebrow { margin: 0 0 9px; color: var(--teal-deep); font-size: 11px; font-weight: 800; letter-spacing: .16em; }

.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 18px; font-weight: 760; letter-spacing: -.025em; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  color: #fff;
  background: linear-gradient(145deg, #24ad9c, #14786e);
  border-radius: 9px 4px 9px 4px;
  font-family: Georgia, serif;
  font-size: 20px;
  font-style: italic;
  box-shadow: 0 7px 18px rgba(30, 158, 143, .22);
}
.brand-divider { width: 1px; height: 19px; margin-inline: 2px; background: #d5dee2; }
.brand-product { color: #6d7987; font-size: 14px; font-weight: 620; letter-spacing: .01em; }
.brand-large { font-size: 24px; }
.brand-large .brand-mark { width: 40px; height: 40px; font-size: 26px; }

.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 28px;
  background:
    linear-gradient(rgba(20, 73, 68, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 73, 68, .035) 1px, transparent 1px),
    #f2f8f7;
  background-size: 48px 48px;
}
.login-glow { position: absolute; border-radius: 999px; filter: blur(1px); opacity: .8; }
.login-glow-one { width: 520px; height: 520px; top: -250px; right: -100px; background: radial-gradient(circle, rgba(53, 184, 167, .25), transparent 68%); }
.login-glow-two { width: 600px; height: 600px; bottom: -340px; left: -140px; background: radial-gradient(circle, rgba(39, 120, 144, .16), transparent 68%); }
.login-card {
  position: relative;
  width: min(100%, 520px);
  padding: 54px;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(202, 220, 218, .9);
  border-radius: 28px;
  box-shadow: 0 38px 100px rgba(21, 70, 66, .14);
  backdrop-filter: blur(18px);
}
.login-card .brand { margin-bottom: 55px; }
.login-card h1 { margin: 0; font-size: clamp(34px, 6vw, 48px); line-height: 1.14; letter-spacing: -.045em; }
.login-copy { margin: 22px 0 30px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.security-note { margin: 20px 0 0; color: #87919d; font-size: 12px; text-align: center; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  background: rgba(255, 255, 255, .87);
  border-bottom: 1px solid rgba(219, 227, 231, .9);
  backdrop-filter: blur(15px);
}
.topbar-inner { display: flex; width: min(calc(100% - 48px), var(--container)); height: 100%; margin: auto; align-items: center; justify-content: space-between; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.user-name { color: #5e6b7a; font-size: 13px; }

main { padding-bottom: 80px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding-block: 56px 34px; }
.hero h1 { margin: 0; font-size: clamp(36px, 5vw, 54px); letter-spacing: -.05em; line-height: 1; }
.hero p:last-child { margin: 17px 0 0; color: var(--muted); font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card {
  position: relative;
  min-height: 145px;
  padding: 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-soft);
}
.stat-card span { display: block; color: #5e6c7c; font-size: 13px; font-weight: 650; }
.stat-card strong { display: block; margin: 16px 0 9px; font-size: 32px; letter-spacing: -.04em; }
.stat-card small { color: #929ca7; font-size: 12px; }
.stat-accent { color: #fff; background: linear-gradient(135deg, #188578, #1ba193); border-color: transparent; }
.stat-accent::after { content: ""; position: absolute; width: 130px; height: 130px; right: -42px; bottom: -70px; border: 25px solid rgba(255,255,255,.09); border-radius: 50%; }
.stat-accent span, .stat-accent small { color: rgba(255,255,255,.78); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .8fr); gap: 18px; margin-top: 18px; }
.panel { padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.panel h2, .history h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.panel-heading, .history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.history-heading-actions { display: flex; align-items: center; gap: 12px; }
.format-note, .result-count { color: #8a95a1; font-size: 12px; }
.drop-zone {
  display: flex;
  min-height: 206px;
  margin-top: 23px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  color: #6a7684;
  background: #f8fbfb;
  border: 1.5px dashed #b9d5d1;
  border-radius: 15px;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.drop-zone:hover, .drop-zone:focus, .drop-zone.dragging { outline: none; border-color: var(--teal); background: var(--teal-soft); transform: translateY(-1px); }
.drop-zone strong { color: #334353; font-size: 15px; }
.drop-zone span { font-size: 12px; }
.upload-icon { display: grid; width: 48px; height: 48px; margin-bottom: 2px; place-items: center; color: var(--teal-deep); background: var(--teal-soft); border-radius: 14px; }
.upload-icon svg { width: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.upload-queue { display: grid; gap: 8px; margin: 14px 0; }
.queue-item { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; background: #f8fafb; border: 1px solid var(--line); border-radius: 10px; }
.queue-item div { min-width: 0; }
.queue-item strong { display: block; overflow: hidden; color: #3c4958; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.queue-item span { color: #909aa5; font-size: 11px; }
.queue-remove { color: #9b6570; background: none; border: 0; cursor: pointer; font-size: 18px; }
.verification-flow { display: flex; margin-top: 21px; align-items: center; justify-content: center; gap: 12px; color: #84909b; font-size: 11px; }
.verification-flow i { width: 32px; height: 1px; background: #dce4e7; }

.trust-panel { color: #eaf8f6; background: linear-gradient(150deg, #173c3a, #155e58); border-color: transparent; box-shadow: 0 22px 60px rgba(15, 69, 64, .17); }
.trust-panel .eyebrow { color: #7ce0d4; }
.trust-panel h2 { color: #fff; line-height: 1.35; }
.trust-panel > p:not(.eyebrow) { margin: 17px 0 22px; color: rgba(235, 250, 248, .72); font-size: 13px; line-height: 1.72; }
.trust-list { display: grid; gap: 13px; padding-block: 5px 21px; }
.trust-list > div { display: flex; align-items: center; gap: 11px; }
.trust-list strong, .trust-list small { display: block; }
.trust-list strong { color: #fff; font-size: 13px; }
.trust-list small { margin-top: 3px; color: rgba(235, 250, 248, .58); font-size: 11px; }
.trust-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; box-shadow: 0 0 0 5px rgba(255,255,255,.05); }
.trust-dot.success { background: #6ce2b7; }
.trust-dot.danger { background: #ff9aa2; }
.trust-dot.neutral { background: #f4ce78; }
.text-link { color: #89ded3; font-size: 12px; font-weight: 700; }
.scope-doc-link { display: inline-block; margin-left: 14px; }
.verification-scope { margin: 0 0 20px; border-block: 1px solid rgba(235, 250, 248, .12); }
.verification-scope summary {
  display: flex;
  padding: 13px 0;
  align-items: center;
  justify-content: space-between;
  color: #dff7f3;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}
.verification-scope summary::-webkit-details-marker { display: none; }
.verification-scope summary::after { content: "+"; margin-left: 10px; color: #7ce0d4; font-size: 18px; font-weight: 400; }
.verification-scope[open] summary::after { content: "−"; }
.verification-scope summary span { margin-left: auto; color: rgba(235, 250, 248, .48); font-size: 10px; font-weight: 650; }
.scope-content { display: grid; gap: 11px; padding: 1px 0 15px; }
.scope-content section strong { display: block; color: #fff; font-size: 11px; }
.scope-content section p, .scope-note { margin: 4px 0 0; color: rgba(235, 250, 248, .6); font-size: 10px; line-height: 1.55; }
.scope-content .scope-note { margin-top: 2px; padding: 10px; color: #e9dca8; background: rgba(244, 206, 120, .08); border-radius: 8px; }

.history { margin-top: 18px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters { display: grid; margin: 23px 0 17px; gap: 9px; }
.filter-row { display: flex; align-items: center; gap: 9px; }
.filter-row-primary { flex-wrap: wrap; }
.filter-row-secondary label { flex: 1 1 145px; }
.filter-row-secondary select { width: 100%; }
.filters input, .filters select {
  height: 40px;
  padding: 0 12px;
  color: #465462;
  background: #fff;
  border: 1px solid #d9e1e5;
  border-radius: 9px;
  outline: none;
  font-size: 12px;
}
.filters input:focus, .filters select:focus { border-color: #78bcb4; box-shadow: 0 0 0 3px rgba(30, 158, 143, .09); }
.search-field { position: relative; flex: 1 1 320px; }
.search-field input { width: 100%; padding-left: 37px; }
.search-field svg { position: absolute; left: 12px; top: 11px; width: 18px; fill: none; stroke: #84909c; stroke-width: 1.7; }
.filter-label { margin-right: 5px; color: #8a96a1; font-size: 11px; }
.date-separator { color: #a5afb8; }
.date-filter-group { display: flex; flex: 0 1 auto; align-items: center; gap: 8px; }
.date-filter-group input { width: 132px; }
.date-presets { display: flex; align-items: center; gap: 5px; }
.date-preset {
  height: 32px;
  padding: 0 10px;
  color: #667381;
  background: #f7f9fa;
  border: 1px solid #dfe6e9;
  border-radius: 8px;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}
.date-preset:hover { color: var(--teal-deep); border-color: #acd1cc; }
.date-preset.active { color: var(--teal-ink); background: var(--teal-soft); border-color: #9bcfc8; font-weight: 700; }
.table-wrap { position: relative; min-height: 250px; overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; min-width: 1020px; border-collapse: collapse; }
th { padding: 14px 12px; color: #8b96a1; font-size: 10px; font-weight: 750; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
td { padding: 15px 12px; border-top: 1px solid #edf1f3; color: #556271; font-size: 12px; vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fbfcfc; }
.file-cell { max-width: 230px; }
.file-cell strong, .counterparty strong { display: block; overflow: hidden; color: #253444; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.file-download-link { color: inherit; text-decoration: underline; text-decoration-color: #a9d7d1; text-underline-offset: 2px; }
.file-download-link:hover { color: #137f73; text-decoration-color: currentColor; }
.file-cell span, .counterparty span { display: block; margin-top: 4px; overflow: hidden; color: #96a0aa; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.invoice-type { min-width: 118px; max-width: 180px; }
.invoice-type strong, .invoice-type span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invoice-type strong { color: #344454; font-size: 11px; }
.invoice-type span { margin-top: 4px; color: #96a0aa; font-size: 9px; }
.amount { color: #273746; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 0 9px; border-radius: 999px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-success { color: #177366; background: #e7f7f3; }
.badge-danger { color: #b44650; background: var(--danger-soft); }
.badge-warning { color: var(--amber); background: var(--amber-soft); }
.badge-info { color: var(--blue); background: var(--blue-soft); }
.badge-neutral { color: #6f7c89; background: #f0f3f5; }
.table-action-select { width: 86px; height: 31px; padding: 0 25px 0 9px; color: #60707f; background-color: #fff; border: 1px solid #e0e6e9; border-radius: 8px; cursor: pointer; font-size: 11px; }
.table-action-select:hover, .table-action-select:focus { color: var(--teal-deep); border-color: #acd1cc; outline: none; }
.table-action-select:disabled { cursor: wait; opacity: .65; }
.empty-state, .loading-state { display: flex; position: absolute; inset: 48px 0 0; align-items: center; justify-content: center; flex-direction: column; color: #8d98a3; background: #fff; font-size: 12px; }
.empty-state strong { margin: 8px 0 4px; color: #566372; font-size: 14px; }
.empty-icon { display: grid; width: 44px; height: 44px; place-items: center; color: var(--teal); background: var(--teal-soft); border-radius: 50%; font-size: 25px; }
.spinner { width: 20px; height: 20px; margin-bottom: 10px; border: 2px solid #d8e7e5; border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pagination { display: flex; margin-top: 17px; align-items: center; justify-content: flex-end; gap: 12px; }
.pagination span { color: #87939e; font-size: 11px; }

.detail-dialog { width: min(calc(100% - 34px), 820px); max-height: 88vh; padding: 0; overflow: hidden; color: var(--ink); background: #fff; border: 0; border-radius: 21px; box-shadow: 0 35px 110px rgba(24, 45, 59, .28); }
.detail-dialog::backdrop { background: rgba(18, 34, 45, .5); backdrop-filter: blur(5px); }
.dialog-header { display: flex; padding: 25px 28px 21px; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 21px; }
.icon-button { width: 34px; height: 34px; color: #6f7b87; background: #f4f6f7; border: 0; border-radius: 50%; cursor: pointer; font-size: 23px; line-height: 1; }
.detail-content { max-height: calc(88vh - 91px); padding: 25px 28px 30px; overflow-y: auto; }
.detail-actions { display: flex; margin-bottom: 23px; justify-content: space-between; align-items: center; gap: 12px; }
.detail-section { margin-top: 23px; }
.detail-section h3 { margin: 0 0 12px; color: #657281; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 12px; }
.detail-field { min-height: 77px; padding: 13px; background: #fff; }
.detail-field span { display: block; margin-bottom: 7px; color: #919ba5; font-size: 10px; }
.detail-field strong { display: block; overflow-wrap: anywhere; color: #344250; font-size: 12px; line-height: 1.45; }
.check-list { display: grid; gap: 8px; }
.check-row { display: grid; grid-template-columns: 18px minmax(100px, .4fr) 1fr; gap: 9px; padding: 11px 13px; align-items: start; background: #f8fafb; border-radius: 9px; font-size: 11px; }
.check-symbol { font-weight: 850; }
.check-pass .check-symbol { color: var(--teal-deep); }
.check-fail .check-symbol { color: var(--danger); }
.check-warn .check-symbol { color: var(--amber); }
.check-skip .check-symbol { color: #89949e; }
.check-row strong { color: #465462; }
.check-row span:last-child { color: #77838f; line-height: 1.45; }
.disclaimer { margin-top: 18px; padding: 12px 14px; color: #7d704f; background: var(--amber-soft); border-radius: 9px; font-size: 10px; line-height: 1.55; }
.edit-dialog { width: min(calc(100% - 34px), 900px); }
.edit-form { max-height: calc(88vh - 91px); padding: 24px 28px 28px; overflow-y: auto; }
.edit-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.edit-grid label { display: grid; gap: 6px; }
.edit-grid label span { color: #778490; font-size: 10px; font-weight: 700; }
.edit-grid input, .edit-grid select { width: 100%; height: 39px; padding: 0 11px; color: #30404e; background: #fff; border: 1px solid #dce4e7; border-radius: 9px; font-size: 12px; }
.edit-grid input:focus, .edit-grid select:focus { border-color: #78bcb4; box-shadow: 0 0 0 3px rgba(30, 158, 143, .09); outline: none; }
.edit-actions { display: flex; margin-top: 19px; justify-content: flex-end; gap: 10px; }

.toast-region { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 9px; width: min(calc(100% - 44px), 380px); }
.toast { padding: 13px 15px; color: #fff; background: #263b48; border-radius: 11px; box-shadow: 0 16px 40px rgba(24, 45, 59, .22); font-size: 12px; line-height: 1.5; animation: toast-in .22s ease-out; }
.toast.error { background: #9f3f48; }
.toast.success { background: #116d63; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .trust-panel { min-height: auto; }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .edit-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 650px) {
  .container, .topbar-inner { width: min(calc(100% - 28px), var(--container)); }
  .topbar { height: 62px; }
  .user-name, .brand-product, .brand-divider { display: none; }
  .hero { align-items: flex-start; flex-direction: column; padding-block: 40px 27px; }
  .hero h1 { font-size: 39px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 125px; padding: 18px; }
  .stat-card strong { margin: 13px 0 7px; font-size: 28px; }
  .panel, .history { padding: 20px; border-radius: 15px; }
  .drop-zone { min-height: 180px; padding: 18px; text-align: center; }
  .verification-flow { gap: 6px; }
  .verification-flow i { width: 13px; }
  .history-heading { align-items: stretch; flex-direction: column; }
  .history-heading-actions { justify-content: space-between; }
  .filter-row { align-items: stretch; flex-direction: column; }
  .filter-row label, .filter-row input, .filter-row select { width: 100%; }
  .date-filter-group { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .date-filter-group > .filter-label, .date-presets { grid-column: 1 / -1; }
  .date-separator { display: none; }
  .date-presets { display: grid; grid-template-columns: repeat(4, 1fr); }
  .date-preset { padding-inline: 5px; }
  .detail-grid { grid-template-columns: 1fr; }
  .edit-grid { grid-template-columns: 1fr; }
  .login-card { padding: 34px 27px; border-radius: 22px; }
  .login-card .brand { margin-bottom: 42px; }
}
