:root {
  --ink: #0f2030;
  --muted: #5e7186;
  --soft: #f4f7fa;
  --line: #e4ebf2;
  --brand: #173b5e;
  --brand-2: #21557d;
  --green: #157f52;
  --amber: #9a6400;
  --red: #c13a2b;
  --blue-soft: #eaf1f8;
  --green-soft: #e4f4ec;
  --amber-soft: #fbf0dc;
  --red-soft: #fbe8e5;
  --shadow: 0 22px 70px rgba(8, 28, 46, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #173b5e;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.phone {
  position: relative;
  width: min(100%, 420px);
  height: min(860px, calc(100vh - 48px));
  min-height: 720px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 10px solid #0b1a27;
  border-radius: 42px;
  background: #f7f9fb;
  box-shadow: var(--shadow);
}

.statusbar {
  height: 36px;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 24px 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  background: #fff;
}

.statusbar-icons {
  letter-spacing: 0;
}

.screen {
  flex: 1;
  overflow: auto;
  padding: 18px 18px 104px;
  background: #f7f9fb;
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 88px;
  display: grid;
  grid-template-columns: 1fr 1fr 74px 1fr 1fr;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 18px;
  border-top: 1px solid rgba(15, 32, 48, 0.08);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.tab {
  height: 52px;
  border: 0;
  display: grid;
  place-items: center;
  gap: 2px;
  color: #9caab7;
  background: transparent;
  font-size: 10.5px;
  font-weight: 700;
}

.tab.is-active {
  color: var(--brand);
}

.tab-icon {
  font-size: 20px;
  line-height: 1;
}

.tab-scan {
  width: 62px;
  height: 62px;
  margin: -24px auto 0;
  border-radius: 22px;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 12px 26px rgba(23, 59, 94, 0.34);
  font-size: 34px;
}

.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 15px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  font-size: 20px;
}

.hero-panel {
  padding: 18px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(160deg, #173b5e 0%, #21557d 100%);
}

.hero-panel .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}

.hero-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
  margin-top: 18px;
}

.big-number {
  font-size: 34px;
  font-weight: 800;
}

.progress-ring {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, #173b5e 0 54%, transparent 55%),
    conic-gradient(#fff 0 72%, rgba(255,255,255,.22) 72% 100%);
  font-size: 17px;
  font-weight: 800;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
}

.btn-primary {
  color: #fff;
  background: var(--brand);
}

.btn-secondary {
  color: var(--brand);
  background: #eaf1f8;
}

.btn-white {
  color: var(--brand);
  background: #fff;
}

.btn-danger {
  color: var(--red);
  background: var(--red-soft);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 12px;
}

.link-btn {
  border: 0;
  color: var(--brand);
  background: transparent;
  font-size: 13px;
  font-weight: 750;
}

.mini-action {
  border: 0;
  padding: 0;
  color: var(--brand);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.list {
  display: grid;
  gap: 9px;
}

.item {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.thumb {
  width: 46px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: #edf3f8;
  font-weight: 850;
}

.item-main {
  min-width: 0;
}

.item-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.amount {
  text-align: right;
  font-size: 14px;
  font-weight: 850;
}

.badge {
  display: inline-flex;
  align-items: center;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.ok {
  color: var(--green);
  background: var(--green-soft);
}

.badge.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.bad {
  color: var(--red);
  background: var(--red-soft);
}

.badge.neutral {
  color: var(--muted);
  background: #eef2f5;
}

.search {
  width: 100%;
  height: 46px;
  margin: 8px 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 13px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 780;
}

.chip.is-active {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.scanner {
  min-height: 100%;
  margin: -18px;
  padding: 54px 18px 24px;
  color: #fff;
  background: #0c1722;
}

.scan-frame {
  position: relative;
  height: 460px;
  margin-top: 26px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(transparent 0 49%, rgba(255,255,255,.08) 50%, transparent 51%),
    radial-gradient(circle at center, rgba(255,255,255,.08), transparent 62%);
}

.doc-preview {
  width: 72%;
  aspect-ratio: 0.72;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
  transform: perspective(500px) rotateX(2deg) rotateZ(-1deg);
}

.corner {
  position: absolute;
  width: 38px;
  height: 38px;
  border-color: #fff;
  border-style: solid;
}

.corner.tl { top: 50px; left: 42px; border-width: 3px 0 0 3px; }
.corner.tr { top: 50px; right: 42px; border-width: 3px 3px 0 0; }
.corner.bl { bottom: 50px; left: 42px; border-width: 0 0 3px 3px; }
.corner.br { bottom: 50px; right: 42px; border-width: 0 3px 3px 0; }

.scan-actions {
  display: grid;
  grid-template-columns: 1fr 74px 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}

.shutter {
  width: 72px;
  height: 72px;
  border: 5px solid #fff;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.form {
  display: grid;
  gap: 13px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.field textarea {
  min-height: 78px;
  resize: vertical;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
}

.segment {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px;
  color: var(--muted);
  background: #fff;
  font-size: 12.5px;
  font-weight: 780;
}

.segment.is-active {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.upload-card {
  padding: 16px;
  border: 1px dashed #b9c8d6;
  border-radius: 18px;
  background: #fff;
}

.upload-card strong {
  display: block;
  margin-bottom: 5px;
}

.upload-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.match-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.match-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.compare-box {
  padding: 12px;
  border-radius: 14px;
  background: var(--soft);
}

.compare-box span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.compare-box strong {
  display: block;
  margin-top: 6px;
  font-size: 13px;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebf1;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.category-row {
  display: grid;
  grid-template-columns: 92px 1fr 76px;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.category-row:last-child {
  border-bottom: 0;
}

.toast {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 100px;
  padding: 13px 16px;
  border-radius: 16px;
  color: #fff;
  background: rgba(15, 32, 48, 0.95);
  font-size: 13px;
  font-weight: 760;
  transform: translateY(140%);
  transition: transform 0.22s ease;
}

.toast.is-open {
  transform: translateY(0);
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
  }

  .phone {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }
}
