/* =========================================================
   Design tokens
   ========================================================= */
:root {
  --ink: #0a0a0a;
  --paper: #ffffff;
  --surface: #f4f4f4;
  --line: #dcdcdc;
  --mute: #7c7c7c;
  --radius: 2px;

  --font-display: 'Archivo', 'Helvetica Neue', sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

::selection { background: var(--ink); color: var(--paper); }

/* =========================================================
   Layout shell
   ========================================================= */
.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand i { font-size: 13px; }

.topbar nav a {
  font-size: 12px;
  text-decoration: none;
  color: var(--mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topbar nav a:hover { color: var(--ink); }

/* =========================================================
   Hero / generator
   ========================================================= */
.hero {
  padding: 64px 0 8px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  background: var(--ink);
  border-radius: 50%;
  display: inline-block;
}

h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 5vw, 42px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.sub {
  color: var(--mute);
  font-size: 15px;
  line-height: 1.5;
  max-width: 46ch;
  margin: 0 0 40px;
}

/* Prompt form */
.composer {
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
}

.composer textarea {
  width: 100%;
  border: none;
  resize: vertical;
  min-height: 88px;
  padding: 18px 20px 8px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: transparent;
  outline: none;
}

.composer textarea::placeholder { color: #b5b5b5; }

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 14px 20px;
  border-top: 1px solid var(--line);
}

.char-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mute);
}

.generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 10px 18px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.generate-btn:hover { opacity: 0.82; }
.generate-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.generate-btn i { font-size: 12px; }

.hint {
  font-size: 12px;
  color: var(--mute);
  margin: 10px 2px 0;
}

.error-banner {
  margin-top: 14px;
  border: 1px solid var(--ink);
  padding: 12px 14px;
  font-size: 13px;
  display: none;
  align-items: flex-start;
  gap: 10px;
}
.error-banner.visible { display: flex; }
.error-banner i { margin-top: 2px; }

/* =========================================================
   Result / signature scan reveal
   ========================================================= */
.result-frame {
  margin-top: 34px;
  border: 1px solid var(--line);
  background: var(--surface);
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.result-frame.empty {
  color: var(--mute);
  font-size: 13px;
  font-family: var(--font-mono);
  flex-direction: column;
  gap: 10px;
}
.result-frame.empty i { font-size: 22px; opacity: 0.5; }

.result-frame img {
  width: 100%;
  display: block;
}

.scan-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: var(--ink);
  top: 0;
  display: none;
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
}

.result-frame.loading .scan-line {
  display: block;
  animation: scan 1.4s ease-in-out infinite;
}

.result-frame.loading .loading-copy {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mute);
  letter-spacing: 0.04em;
}

@keyframes scan {
  0%   { top: 0%; }
  50%  { top: 100%; }
  100% { top: 0%; }
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.icon-btn {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 8px 14px;
  font-size: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}
.icon-btn:hover { border-color: var(--ink); }

footer.site-footer {
  margin: 80px 0 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--mute);
  display: flex;
  justify-content: space-between;
}

@media (max-width: 560px) {
  .hero { padding: 40px 0 8px; }
  footer.site-footer { flex-direction: column; gap: 6px; }
}

/* =========================================================
   Dashboard
   ========================================================= */
.dash-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.dash-header h1 {
  font-size: 20px;
  margin: 0;
}

.dash-header .logout {
  font-size: 12px;
  color: var(--mute);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-header .logout:hover { color: var(--ink); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 40px;
}

.stat-card {
  background: var(--paper);
  padding: 20px;
}

.stat-card .label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mute);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}

.stat-card .value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.panel {
  border: 1px solid var(--line);
}

.panel h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mute);
}
.panel h2 i { color: var(--ink); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table th, table td {
  padding: 10px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

table th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 500;
}

table tr:last-child td { border-bottom: none; }

.bar-row { display: flex; align-items: center; gap: 10px; }
.bar-track {
  flex: 1;
  height: 6px;
  background: var(--surface);
}
.bar-fill { height: 100%; background: var(--ink); }
.bar-count { font-family: var(--font-mono); font-size: 11px; color: var(--mute); width: 32px; text-align: right; }

.recent-table i { color: var(--mute); margin-right: 6px; }

.empty-row td {
  color: var(--mute);
  font-size: 13px;
  text-align: center;
  padding: 30px 18px;
}

/* Login gate */
.login-shell {
  max-width: 360px;
  margin: 14vh auto 0;
  padding: 0 24px;
  text-align: center;
}
.login-shell h1 { font-size: 20px; }
.login-shell form {
  border: 1px solid var(--ink);
  display: flex;
  margin-top: 24px;
}
.login-shell input[type="password"] {
  flex: 1;
  border: none;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
}
.login-shell button {
  border: none;
  background: var(--ink);
  color: var(--paper);
  padding: 0 18px;
  cursor: pointer;
}
.login-error {
  color: var(--ink);
  font-size: 12px;
  margin-top: 12px;
  font-family: var(--font-mono);
}

@media (max-width: 800px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panels { grid-template-columns: 1fr; }
}
