/* SAT-1 web app — Bitcoin Scientific. Clean, precise, navy-accented. */
:root {
  --accent: #151033;
  --accent-dark: #0c0820;
  --accent-soft: rgba(21, 16, 51, 0.10);
  --ink: #14122a;
  --ink-2: #4c4a63;
  --ink-3: #8a89a3;
  --bg: #f4f5fa;
  --card: #ffffff;
  --border: #e6e7f0;
  --border-2: #d4d6e4;
  --green: #2d7a47;
  --red: #b3382d;
  --shadow: 0 1px 3px rgba(20, 18, 42, 0.06), 0 8px 28px rgba(20, 18, 42, 0.07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header.app-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { height: 30px; width: auto; display: block; }
.brand .divider { width: 1px; height: 26px; background: var(--border-2); }
.brand .app-name {
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3);
}
.header-meta { font-size: 12px; color: var(--ink-3); }
.header-meta .logout { color: var(--accent); text-decoration: none; font-weight: 600; }
.header-meta .logout:hover { text-decoration: underline; }

/* Layout */
main { flex: 1; width: 100%; }
.wrap { max-width: 760px; margin: 0 auto; padding: 48px 28px 64px; }
.wrap.wide { max-width: 1180px; }

.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; }
.page-sub { color: var(--ink-2); font-size: 15px; margin-bottom: 32px; }

/* Card + form */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 32px;
}
.field { margin-bottom: 24px; }
.field:last-child { margin-bottom: 0; }
label.lbl {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink);
  margin-bottom: 8px;
}
.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
input[type=text], input[type=password], input[type=date] {
  width: 100%; font-family: var(--mono); font-size: 14px; color: var(--ink);
  padding: 12px 14px; border: 1px solid var(--border-2); border-radius: 9px;
  background: #fbfbfe; transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Segmented radio control */
.segmented { display: flex; gap: 0; border: 1px solid var(--border-2); border-radius: 9px; overflow: hidden; }
.segmented label {
  flex: 1; text-align: center; padding: 11px 12px; font-size: 13px; font-weight: 600;
  color: var(--ink-2); cursor: pointer; background: #fbfbfe; transition: background 0.15s, color 0.15s;
  user-select: none;
}
.segmented label + label { border-left: 1px solid var(--border-2); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + label, .segmented label.on { background: var(--accent); color: #fff; }

.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.collapsible { overflow: hidden; transition: max-height 0.25s ease, opacity 0.2s, margin 0.25s; }
.collapsible.hidden { max-height: 0; opacity: 0; margin: 0; pointer-events: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  padding: 13px 22px; border-radius: 9px; border: 1px solid transparent;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: var(--ink-3); cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--border-2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* Inline error banner */
.banner-error {
  background: #fcecea; border: 1px solid #f0c8c2; color: #8a2820;
  font-size: 13px; padding: 12px 14px; border-radius: 9px; margin-bottom: 20px;
}
.banner-error.hidden { display: none; }

/* Progress view */
.progress-card { text-align: center; padding: 48px 32px; }
.spinner {
  width: 44px; height: 44px; border: 3px solid var(--accent-soft);
  border-top-color: var(--accent); border-radius: 50%;
  margin: 0 auto 24px; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-phase { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.progress-detail { font-size: 13px; color: var(--ink-3); margin-bottom: 24px; font-family: var(--mono); }
.bar { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); width: 0%; transition: width 0.4s ease; border-radius: 99px; }
.bar-pct { font-size: 12px; color: var(--ink-3); margin-top: 10px; font-family: var(--mono); }

/* Result view */
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.result-meta { font-size: 13px; color: var(--ink-2); }
.preview-frame {
  width: 100%; height: 72vh; min-height: 460px; border: 1px solid var(--border);
  border-radius: 12px; background: #fff; box-shadow: var(--shadow);
}

/* Login */
.login-wrap { max-width: 420px; margin: 8vh auto 0; padding: 0 24px; }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { height: 38px; }
.login-wrap .card { padding: 28px; }
p.error { background: #fcecea; border: 1px solid #f0c8c2; color: #8a2820; font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; }

/* Footer */
footer.app-footer {
  border-top: 1px solid var(--border); padding: 22px 0; margin-top: auto;
  font-size: 12px; color: var(--ink-3);
}
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 0 28px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

.hidden { display: none !important; }

@media (max-width: 620px) {
  .wrap { padding: 28px 18px 48px; }
  .card { padding: 22px; }
  .date-row { grid-template-columns: 1fr; }
  .header-inner { padding: 0 16px; }
}
