/* Khanah visual refresh — local CSS only; no remote fonts, images, or scripts. */
:root {
  --ink: #172033;
  --muted: #667085;
  --paper: #f5f7fb;
  --white: #ffffff;
  --line: #e2e7f0;
  --teal: #5b5ce2;
  --teal2: #4547b8;
  --mint: #ececff;
  --yellow: #fff2cf;
  --red: #a53a43;
  --shadow: 0 20px 55px rgba(35, 45, 85, .09);
  font-family: system-ui, "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

html { scroll-behavior: smooth; }
body {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 88% 2%, rgba(111, 205, 186, .19), transparent 31rem),
    radial-gradient(ellipse at 8% 18%, rgba(126, 149, 239, .09), transparent 26rem),
    linear-gradient(180deg, #f7f9fc 0%, #f2f6fa 100%);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .24;
  background-image: linear-gradient(rgba(55, 92, 120, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(55, 92, 120, .035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 82%);
}
body > * { position: relative; z-index: 1; }
header {
  padding-top: 22px;
  padding-bottom: 12px;
}
.brand { gap: 13px; }
.logo {
  position: relative;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 16px;
  background: linear-gradient(145deg, #5b5ce2, #4547b8 72%, #6d4fd3);
  color: #fff;
  box-shadow: 0 9px 24px rgba(25, 91, 125, .22), inset 0 1px 0 rgba(255,255,255,.24);
}
.logo::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  left: 7px;
  bottom: 7px;
  border-radius: 50%;
  background: #7ce2c1;
  box-shadow: 0 0 0 3px rgba(124,226,193,.16);
}
.brand strong { font-size: 20px; letter-spacing: -.45px; }
.brand small { margin-top: 2px; color: #718296; }
.header-badge {
  border-color: #c9e4dd;
  background: rgba(255,255,255,.78);
  color: #23645e;
  box-shadow: 0 4px 15px rgba(35,88,91,.045);
}
.wrap { padding-top: 17px; }
.intro {
  grid-template-columns: minmax(0, 1fr) minmax(310px, .68fr);
  gap: clamp(22px, 4vw, 52px);
  align-items: center;
  margin: 25px 0 23px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid #cde9e1;
  border-radius: 99px;
  background: rgba(235, 249, 245, .86);
  color: #08716d;
  letter-spacing: 0;
}
.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #12b99b, #5d78dc);
  box-shadow: 0 0 0 3px rgba(18,185,155,.1);
}
.intro h1 {
  max-width: 680px;
  margin-top: 14px;
  margin-bottom: 12px;
  color: #102a40;
  font-size: clamp(32px, 4.1vw, 49px);
  font-weight: 800;
  line-height: 1.24;
  letter-spacing: -.8px;
  text-wrap: balance;
}
.intro p {
  max-width: 690px;
  color: #5c7083;
  font-size: 15px;
  line-height: 1.95;
}
.architecture {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 235px;
  max-width: 440px;
  padding: 18px 19px 12px;
  overflow: hidden;
  border: 1px solid rgba(164, 209, 219, .28);
  border-radius: 22px;
  background:
    radial-gradient(circle at 84% 22%, rgba(102, 110, 229, .3), transparent 34%),
    linear-gradient(140deg, #102c40 0%, #153b52 55%, #262f5b 100%);
  color: #d5e7ef;
  box-shadow: 0 19px 48px rgba(19, 50, 78, .2), inset 0 1px 0 rgba(255,255,255,.1);
  font-size: 12px;
  line-height: 1.8;
}
.architecture::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .2;
  background-image: radial-gradient(rgba(211,237,248,.42) .7px, transparent .7px);
  background-size: 14px 14px;
  mask-image: linear-gradient(120deg, transparent 8%, #000 80%);
}
.architecture b {
  position: relative;
  z-index: 1;
  color: #f2fbff;
  font-size: 14px;
  font-weight: 700;
}
.architecture br { display: none; }
.scan-art {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100%, 340px);
  height: auto;
  margin: 5px auto 0;
  overflow: visible;
}
.scan-art .paper {
  fill: rgba(248, 253, 255, .97);
  stroke: rgba(191, 233, 237, .78);
  stroke-width: 1.2;
}
.scan-art .grid-line { stroke: #b9cbd3; stroke-width: 1.2; }
.scan-art .grid-cell { fill: #e7f4f3; }
.scan-art .grid-cell.accent { fill: #c3f1df; }
.scan-art .scan-corner { fill: none; stroke: #7ae0cb; stroke-width: 3; stroke-linecap: round; }
.scan-art .scan-beam {
  stroke: #16c2a4;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 5px rgba(37, 224, 186, .95));
  animation: khScanSweep 5.8s ease-in-out infinite;
}
.scan-art .ai-orb { fill: url(#khOrb); stroke: rgba(255,255,255,.66); stroke-width: 1.2; }
.scan-art .ai-spark { fill: #fff; }
.scan-art .connect { fill: none; stroke: rgba(113, 224, 209, .75); stroke-width: 1.5; stroke-dasharray: 3 4; }
.scan-art .chip { fill: rgba(255,255,255,.12); stroke: rgba(205,241,245,.38); stroke-width: 1; }
.scan-art .chip-dot { fill: #8de3c6; }
@keyframes khScanSweep {
  0%, 8% { transform: translateY(0); opacity: .25; }
  22% { opacity: 1; }
  78% { opacity: .9; }
  92%, 100% { transform: translateY(65px); opacity: .2; }
}
.privacy {
  margin: 17px 0;
  padding: 12px 15px;
  border-color: #cce8de;
  border-radius: 15px;
  background: linear-gradient(105deg, rgba(230,247,239,.95), rgba(238,247,251,.92));
  color: #355b57;
  box-shadow: 0 7px 22px rgba(45, 100, 92, .035);
}
.privacy .lock {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #cae8dc;
  border-radius: 9px;
  background: #f8fffb;
  color: #078376;
}
.steps { gap: 10px; margin: 20px 0 18px; }
.step { gap: 9px; color: #748499; }
.step .num {
  width: 29px;
  height: 29px;
  border-color: #d5e0e8;
  background: rgba(255,255,255,.9);
  color: #65798b;
  box-shadow: 0 3px 9px rgba(28,54,79,.04);
}
.step.active { color: #126c69; }
.step.active .num {
  border-color: transparent;
  background: linear-gradient(135deg, #0a9690, #166aa8);
  box-shadow: 0 4px 12px rgba(13,128,133,.22);
}
.step-line { width: 42px; background: linear-gradient(90deg, #d5e1e7, #b8dcd3); }
.workspace { gap: 20px; }
.card {
  border-color: rgba(211, 223, 233, .92);
  border-radius: 21px;
  box-shadow: 0 16px 42px rgba(24, 51, 76, .065), 0 2px 7px rgba(24,51,76,.025);
}
.card-head {
  padding: 18px 20px 15px;
  border-bottom-color: #edf2f6;
  background: linear-gradient(180deg, rgba(250,252,255,.98), rgba(255,255,255,.95));
}
.card-head h2 { color: #172f45; font-size: 16px; font-weight: 750; }
.card-head p { color: #77899b; }
.loading-label { color: #718598; }
.card-body { padding: 19px 20px 21px; }
.upload-grid { gap: 10px; }
.upload-btn {
  min-height: 64px;
  border-color: #dbe6ed;
  border-radius: 15px;
  background: linear-gradient(180deg, #fff, #f9fbfd);
  box-shadow: 0 3px 10px rgba(31,61,86,.035);
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.upload-btn:hover {
  border-color: #9bcfc4;
  background: #f3fbf8;
  box-shadow: 0 8px 18px rgba(22, 117, 104, .08);
  transform: translateY(-2px);
}
.upload-btn .ico { display: inline-grid; place-items: center; color: #087f83; }
.upload-btn .ico svg { display: block; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hint { color: #75889a; line-height: 1.8; }
.page-controls select, .export-line select {
  border-color: #d8e3eb;
  border-radius: 10px;
  color: #223a50;
}
.canvas-wrap {
  border-color: #dfe8ed;
  border-radius: 15px;
  background: repeating-conic-gradient(#edf2f4 0% 25%, #f8fafb 0% 50%) 50% / 20px 20px;
}
.empty-state { color: #73879a; }
.empty-state span { color: #338e91; }
.toolbar { gap: 8px; }
.btn {
  min-height: 42px;
  border-color: #d8e3ea;
  border-radius: 11px;
  color: #20384d;
  box-shadow: 0 2px 7px rgba(29,58,83,.025);
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.btn:hover:not(:disabled) {
  border-color: #9ecdc2;
  background: #f5fbf8;
  box-shadow: 0 5px 14px rgba(25,103,99,.07);
  transform: translateY(-1px);
}
.btn.primary {
  border-color: #0c8285;
  background: linear-gradient(120deg, #087f83, #126da0);
  box-shadow: 0 5px 13px rgba(16, 112, 137, .16);
}
.btn.primary:hover:not(:disabled) {
  border-color: #09656f;
  background: linear-gradient(120deg, #096e76, #155889);
}
.btn.soft { background: #eaf7f2; border-color: #cce9df; color: #23655d; }
.auto-option { color: #586f82; line-height: 1.55; }
.auto-option input { accent-color: #0d8582; }
.status { border: 1px solid #d3e8e1; background: #f0f8f5; color: #315d57; }
.progress { background: #e7eef1; }
.progress > i { background: linear-gradient(90deg, #0c8585, #36b99b, #7281db); }
.summary { gap: 8px; }
.chip { border-color: #dfe8ec; background: #f7fafb; color: #5f7385; }
.review-empty {
  border-color: #cfdfdf;
  border-radius: 15px;
  background: linear-gradient(145deg, #f7fbfa, #f7f9fd);
  color: #71859a;
}
.review-actions { gap: 8px; }
.table-scroll { border-color: #dce6eb; border-radius: 13px; }
.review-table td { border-color: #c6d3d8; }
.review-table td.selected { outline-color: #14858a; background: #e9f7f3; }
.review-table td.low { background: #fff3d3; }
.review-table textarea {
  font-family: system-ui, "Segoe UI", Tahoma, Arial, sans-serif;
  color: #233b50;
}
.review-table textarea:focus { background: #f3faf7; }
.confidence-note, .review-foot { color: #74879a; line-height: 1.8; }
.export-line { gap: 9px; }
.manual-panel { border-color: #d6e9e2; border-radius: 14px; background: #f4faf7; }
.manual-panel p { color: #536d6b; }
.footnote { border-top-color: #dce6ed; color: #6c8092; }
.modal-bg { backdrop-filter: blur(7px); }
.modal { border: 1px solid #dce7ef; border-radius: 20px; }
.modal .close { min-width: 36px; min-height: 36px; border-radius: 10px; }
.toast { background: linear-gradient(110deg, #102c40, #1c3e58); }

@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; gap: 20px; }
  .architecture { max-width: none; min-height: 220px; }
  .scan-art { width: min(100%, 360px); }
  .workspace { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  header { padding: 14px 15px 7px; }
  .logo { width: 43px; height: 43px; border-radius: 14px; }
  .brand { gap: 10px; }
  .brand strong { font-size: 18px; }
  .brand small { max-width: 150px; font-size: 10px; }
  .header-badge { max-width: 152px; padding: 7px 9px; font-size: 10px; text-align: center; line-height: 1.45; }
  .wrap { padding: 8px 13px 30px; }
  .intro { margin: 18px 0 17px; gap: 16px; }
  .intro h1 { margin-top: 12px; font-size: 31px; letter-spacing: -.45px; }
  .intro p { font-size: 13px; line-height: 1.85; }
  .architecture { min-height: 204px; padding: 14px 15px 8px; border-radius: 18px; font-size: 11px; }
  .architecture b { font-size: 13px; }
  .scan-art { width: min(100%, 300px); margin-top: 3px; }
  .privacy { gap: 8px; padding: 10px 11px; font-size: 12px; line-height: 1.68; }
  .steps { gap: 5px; margin: 15px 0; }
  .step { gap: 5px; font-size: 10px; }
  .step .num { width: 26px; height: 26px; font-size: 11px; }
  .step-line { width: 12px; }
  .card { border-radius: 18px; }
  .card-head { padding: 15px 14px 12px; align-items: flex-start; }
  .card-head h2 { font-size: 15px; }
  .card-head p { font-size: 11px; }
  .loading-label { font-size: 10px; text-align: left; }
  .card-body { padding: 14px; }
  .upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .upload-btn { min-height: 56px; padding-inline: 6px; gap: 6px; font-size: 12px; }
  .upload-btn:last-child { grid-column: span 2; }
  .hint { font-size: 10px; }
  .toolbar { gap: 7px; }
  .btn { min-height: 40px; padding: 8px 9px; font-size: 11px; }
  .btn.small { min-height: 36px; }
  .auto-option { font-size: 10px; }
  .canvas-wrap { max-height: 430px; }
  .review-table td { min-width: 112px; }
  .review-table textarea { min-width: 103px; font-size: 12px; }
  .export-line { align-items: stretch; }
  .export-line label { width: 100%; }
  .footnote { margin-top: 20px; font-size: 10px; }
}

/* PWA/mobile finishing: safe areas, reliable touch targets, and install CTA. */
header { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
.wrap { padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
.upload-btn, .mode-option, .btn, select, .auto-option {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.install-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1232px;
  margin: 8px auto 0;
  padding: 11px 15px;
  border: 1px solid #c8e4dc;
  border-radius: 14px;
  background: linear-gradient(110deg, #effaf5, #f3f6ff);
  color: #315d57;
  font-size: 12px;
  line-height: 1.6;
}
.install-cta[hidden] { display: none !important; }
.install-cta button {
  flex: 0 0 auto;
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  background: linear-gradient(120deg, #087f83, #126da0);
  color: #fff;
  font: inherit;
  font-weight: 700;
  touch-action: manipulation;
}
.install-cta button:disabled { opacity: .55; }
@media (pointer: coarse) {
  .upload-btn, .mode-option { min-height: 58px; }
  .btn { min-height: 46px; }
  .btn.small { min-height: 42px; }
  .page-controls select, .export-line select { min-height: 44px; }
}
@media (max-width: 520px) {
  .install-cta { align-items: flex-start; margin: 7px 13px 0; padding: 10px 11px; font-size: 11px; }
  .install-cta button { padding-inline: 11px; }
  .table-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .upload-btn:active, .mode-option:active, .btn:active { transform: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .scan-art .scan-beam { animation: none !important; }
  .upload-btn:hover, .btn:hover:not(:disabled) { transform: none; }
}
