:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #657085;
  --line: #dbe1ea;
  --panel: #ffffff;
  --canvas: #f3f6fa;
  --navy: #111d31;
  --blue: #1464d2;
  --blue-dark: #0f4eaa;
  --red: #c93b32;
  --green: #07865e;
  --amber: #b66a08;
  --shadow: 0 18px 50px rgba(30, 43, 68, .12);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 4%, rgba(32, 105, 210, .08), transparent 27rem),
    var(--canvas);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; }

.app-shell { display: flex; min-height: 100vh; flex-direction: column; }
main { flex: 1 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
  padding: 14px clamp(20px, 4vw, 64px);
  color: #fff;
  background: rgba(17, 29, 49, .97);
  box-shadow: 0 8px 28px rgba(11, 20, 35, .2);
  backdrop-filter: blur(16px);
}

.brand-block, .topbar-actions, .hero-facts, .file-title-row, .modal-heading {
  display: flex;
  align-items: center;
}

.brand-block { gap: 14px; }
.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 10px);
  gap: 3px;
  width: 28px;
}
.brand-mark span {
  display: block;
  height: 10px;
  border-radius: 2px;
  background: #60a5fa;
}
.brand-mark span:first-child { grid-row: span 2; height: 23px; background: #fff; }
.brand-mark span:last-child { background: #2676dd; }
.eyebrow, .section-label {
  color: #71809a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.topbar .eyebrow { color: #9eabc0; }
.topbar h1 { margin: 2px 0 0; font-size: 20px; line-height: 1.15; }
.topbar h1 span { color: #65a9ff; font-weight: 500; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.auth-actions { display: flex; align-items: center; gap: 8px; }
.account-chip {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  min-height: 40px;
  padding: 5px 13px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 10px;
  color: #dce7f7;
  background: rgba(255,255,255,.06);
}
.account-chip span { max-width: 180px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.account-chip strong { color: #70e1b8; font-size: 13px; }
.privacy-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #cfd8e7;
  font-size: 13px;
}
.privacy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #36d399;
  box-shadow: 0 0 0 5px rgba(54, 211, 153, .12);
}

main { width: min(1540px, 100%); margin: 0 auto; padding: 0 clamp(16px, 3vw, 44px) 48px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: clamp(28px, 5vw, 90px);
  align-items: center;
  min-height: 420px;
  padding: 52px 0 46px;
}
.hero-kicker {
  margin-bottom: 16px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .18em;
}
.hero h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(34px, 4.4vw, 66px);
  line-height: 1.01;
  letter-spacing: -.045em;
}
.hero-copy > p {
  max-width: 690px;
  margin: 22px 0 26px;
  color: var(--muted);
  font-size: clamp(16px, 1.35vw, 20px);
  line-height: 1.6;
}
.hero-facts { flex-wrap: wrap; gap: 10px; }
.hero-facts span {
  padding: 8px 12px;
  border: 1px solid #d7e0ed;
  border-radius: 999px;
  color: #526078;
  background: rgba(255, 255, 255, .68);
  font-size: 13px;
  font-weight: 700;
}

.drop-card {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  min-height: 300px;
  padding: 34px;
  overflow: hidden;
  border: 1px solid #cbd7e8;
  border-radius: 24px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.drop-card::before {
  position: absolute;
  inset: 10px;
  border: 1px dashed #b5c4da;
  border-radius: 17px;
  content: "";
  pointer-events: none;
}
.drop-card.dragover {
  transform: translateY(-3px);
  border-color: var(--blue);
  box-shadow: 0 22px 60px rgba(20, 100, 210, .2);
}
.drop-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 18px;
  color: var(--blue);
  background: #eaf3ff;
}
.drop-icon svg { width: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drop-card h3 { margin: 0; font-size: 22px; }
.drop-card p { margin: 7px 0 20px; color: var(--muted); }
.drop-card small { margin-top: 14px; color: #7c879a; }

.button {
  min-height: 40px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
  transition: background .18s ease, border-color .18s ease, transform .18s ease, opacity .18s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .42; }
.button-primary { color: #fff; background: var(--blue); }
.button-primary:hover:not(:disabled) { background: var(--blue-dark); }
.button-ghost { color: inherit; border-color: rgba(255,255,255,.34); background: transparent; }
.button-small { min-height: 34px; padding: 0 13px; color: var(--blue); border-color: #c6d5e9; }
.button-muted { color: #334056; border-color: #cfd7e3; background: #fff; }
.button-danger { color: #fff; background: var(--red); }
.token-editor > .button-danger { width: 100%; margin-top: 12px; }
.button-success { color: #fff; background: var(--green); }

.workspace { padding-bottom: 24px; }
.status-banner {
  margin-bottom: 14px;
  padding: 14px 18px;
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  color: #24476f;
  background: #e9f3ff;
  font-size: 14px;
}
.status-banner.warning { border-color: var(--amber); color: #71450c; background: #fff5dc; }
.status-banner.success { border-color: var(--green); color: #07583f; background: #e8f8f2; }

.file-overview, .options-panel, .control-panel, .table-card, .action-bar {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 8px 25px rgba(40, 54, 80, .06);
}
.options-panel { padding: 16px 22px; border-top: 0; }
.option-row { display: flex; gap: 18px; align-items: center; margin-top: 9px; }
.option-toggle { display: inline-flex; gap: 9px; align-items: center; font-weight: 700; cursor: pointer; }
.option-toggle input { width: 18px; height: 18px; accent-color: var(--blue); }
.option-toggle:has(input:disabled) { opacity: .55; cursor: default; }
.option-hint { color: #6d788c; font-size: 12px; }
.file-overview {
  padding: 22px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.file-title-row { justify-content: space-between; gap: 18px; }
.file-title-row h3 { max-width: 1000px; margin: 5px 0 0; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.metrics {
  display: grid;
  grid-template-columns: 1.05fr 1.6fr 1.6fr 1fr;
  gap: 12px;
  margin-top: 18px;
}
.metrics article {
  min-width: 0;
  padding: 14px 15px;
  border-radius: 12px;
  background: #f5f7fa;
}
.metrics span { display: block; margin-bottom: 7px; color: #78849a; font-size: 11px; font-weight: 750; text-transform: uppercase; }
.metrics strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.metrics .mono { font-size: 11px; }

.control-panel {
  display: grid;
  grid-template-columns: minmax(180px, .75fr) minmax(300px, 1.3fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 18px 22px;
  border-top: 0;
}
.field span { display: block; margin-bottom: 7px; color: #6d788c; font-size: 12px; font-weight: 700; }
.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cfd7e2;
  border-radius: 9px;
  outline: none;
  background: #fbfcfd;
}
.field input:focus { border-color: #5a97e6; box-shadow: 0 0 0 3px rgba(20,100,210,.1); }
.button-control { height: 42px; white-space: nowrap; }

.table-card { border-top: 0; }
.table-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.table-header h3 { margin: 4px 0 0; font-size: 18px; }
.table-stats { color: var(--muted); font-size: 13px; }
.table-wrap { position: relative; min-height: 330px; max-height: 560px; overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead { position: sticky; top: 0; z-index: 3; }
th {
  padding: 11px 12px;
  border-bottom: 1px solid #cbd3df;
  color: #344157;
  background: #e9edf3;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 9px 12px;
  border-bottom: 1px solid #e3e7ed;
  color: #2b3548;
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:nth-child(even) { background: #fafbfd; }
tbody tr:hover { background: #edf5ff; }
tbody tr.modified { background: #fff0ed; }
tbody tr.disabled td { color: #8b94a5; }
tbody tr.selected { box-shadow: inset 3px 0 0 var(--blue); }
td:nth-child(2) { color: #1558ae; font-family: "Cascadia Mono", Consolas, monospace; font-weight: 800; }
td:nth-child(5) { font-family: "Cascadia Mono", Consolas, monospace; }
.check-cell { width: 48px; text-align: center; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--blue); }
.empty-table { display: grid; min-height: 280px; place-items: center; color: var(--muted); }

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 22px;
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 -8px 28px rgba(30,43,68,.08);
}
.action-bar > div:first-child { display: flex; gap: 18px; color: #606d82; font-size: 13px; }
.action-bar strong { color: var(--ink); }
.cost-label { color: var(--blue); font-weight: 700; }
.action-buttons { display: flex; gap: 10px; }

.how-it-works {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 42px 0 0;
}
.how-it-works article { position: relative; padding: 24px; border-top: 1px solid #cbd5e3; }
.how-it-works span { color: #4a8de5; font-size: 12px; font-weight: 900; }
.how-it-works h3 { margin: 10px 0 7px; font-size: 18px; }
.how-it-works p { margin: 0; color: var(--muted); line-height: 1.55; }

footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 24px clamp(20px, 4vw, 64px);
  color: #8e9aaf;
  background: var(--navy);
  font-size: 12px;
}
footer > :last-child { text-align: right; }
.footer-contacts {
  display: flex;
  gap: 24px;
  align-items: center;
}
.footer-contact {
  color: inherit;
  font-size: 13px;
  text-decoration: none;
}
.footer-contact:hover,
.footer-contact:focus-visible {
  color: inherit;
  text-decoration: underline;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(9, 16, 28, .7);
  backdrop-filter: blur(7px);
}
.modal {
  width: min(680px, 100%);
  max-height: min(760px, 90vh);
  padding: 25px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(0,0,0,.32);
}
.modal-wide { width: min(980px, 100%); }
.modal-heading { justify-content: space-between; gap: 16px; }
.modal-heading h2 { margin: 4px 0 0; font-size: 24px; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 10px; color: #536079; background: #eff2f6; font-size: 25px; }
.modal-note { margin: 18px 0; color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.profile-option {
  padding: 15px;
  border: 1px solid #d6dde8;
  border-radius: 12px;
  text-align: left;
  background: #f9fafc;
}
.profile-option:hover { border-color: #6da4e9; background: #eff6ff; }
.profile-option strong, .profile-option span { display: block; }
.profile-option span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.supported-list { display: grid; gap: 18px; margin-top: 20px; }
.controller-group h3 { margin: 0 0 9px; }
.controller-items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.controller-item { padding: 11px; border: 1px solid #e0e5ec; border-radius: 9px; background: #fafbfc; }
.controller-item strong { display: block; color: #1c5aa9; font-family: "Cascadia Mono", Consolas, monospace; }
.controller-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.auth-modal { width: min(520px, 100%); }
.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 22px 0 18px;
  padding: 5px;
  border-radius: 11px;
  background: #edf1f6;
}
.auth-switch button {
  height: 38px;
  border: 0;
  border-radius: 8px;
  color: #647086;
  background: transparent;
  font-weight: 750;
}
.auth-switch button.active { color: #fff; background: var(--navy); }
#authForm { display: grid; gap: 15px; }
.auth-submit { width: 100%; margin-top: 2px; }
.auth-resend { width: 100%; margin-top: 10px; }
.auth-link { justify-self: center; padding: 4px 8px; border: 0; color: var(--blue); background: transparent; font-size: 13px; font-weight: 700; }
.auth-link:hover { text-decoration: underline; }
.auth-message { min-height: 20px; margin: 0; color: var(--red); font-size: 13px; }
.auth-message.success { color: var(--green); }
.auth-footnote { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.captcha-block { margin-bottom: 14px; }
.captcha-label { display: block; margin-bottom: 7px; color: #6d788c; font-size: 12px; font-weight: 700; }
.captcha-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.captcha-row img { width: min(232px, calc(100% - 52px)); height: auto; border: 1px solid var(--line); border-radius: 9px; background: #f5f7fb; }
.captcha-refresh { flex: 0 0 42px; font-size: 24px; }
.balance-card {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  margin: 22px 0 16px;
  padding: 20px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, #14243d, #1d61b9);
}
.balance-card > span { color: #b7cae7; font-size: 12px; text-transform: uppercase; }
.balance-card strong { margin: 4px 0; font-size: 28px; }
.balance-card small { color: #d8e4f7; }
.payment-card { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; margin: 18px 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #f7f9fc; }
.payment-card h3 { margin: 5px 0 8px; font-size: 21px; }
.payment-card p { margin: 0 0 14px; color: var(--muted); line-height: 1.5; }
.payment-card img { width: 170px; height: 170px; border-radius: 10px; background: #fff; }
.payment-link { display: inline-flex; text-decoration: none; }
.receipt-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-bottom: 20px; }
.receipt-form .auth-message { grid-column: 1 / -1; margin: 0; }
.payment-history { display: grid; gap: 7px; margin: 10px 0 22px; }
.payment-request-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.payment-request-item small { grid-column: 1 / -1; color: var(--muted); }
.payment-status { font-size: 12px; font-weight: 800; }
.payment-status.pending { color: #b36b00; }
.payment-status.approved { color: var(--green); }
.payment-status.rejected { color: var(--red); }
.operation-list { display: grid; gap: 8px; margin-top: 10px; }
.operation-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 15px;
  padding: 11px 13px;
  border: 1px solid #e0e5ec;
  border-radius: 10px;
  background: #fafbfc;
}
.operation-item strong.credit { color: var(--green); }
.operation-item strong.debit { color: var(--red); }
.operation-item small { grid-column: 1 / -1; color: var(--muted); }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 150;
  max-width: min(430px, calc(100vw - 48px));
  padding: 14px 18px;
  border-radius: 12px;
  color: #fff;
  background: #1c2a40;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.toast.error { background: #9f2f29; }
.toast.success { background: #087654; }

@media (max-width: 1040px) {
  .privacy-pill { display: none; }
  .topbar { flex-wrap: wrap; }
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-copy { text-align: center; }
  .hero-copy > p { margin-inline: auto; }
  .hero-facts { justify-content: center; }
  .drop-card { min-height: 260px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .control-panel { grid-template-columns: 1fr 1fr; }
  .button-control { width: 100%; }
  .controller-items { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .payment-card { grid-template-columns: 1fr; }
  .payment-card img { justify-self: center; }
  .receipt-form { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .account-chip span { max-width: 120px; }
  .topbar-actions .button { padding-inline: 11px; font-size: 12px; }
  .hero { min-height: auto; padding-top: 34px; }
  .hero h2 { font-size: 36px; }
  .metrics, .control-panel, .how-it-works { grid-template-columns: 1fr; }
  .option-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .table-wrap { max-height: 520px; }
  table { min-width: 900px; }
  .action-bar { align-items: stretch; flex-direction: column; }
  .action-buttons { display: grid; grid-template-columns: 1fr; }
  .profile-grid, .controller-items { grid-template-columns: 1fr; }
  footer { display: flex; flex-direction: column; align-items: flex-start; }
  .footer-contacts { flex-direction: column; gap: 8px; align-items: flex-start; }
  footer > :last-child { text-align: left; }
}
