/* ─────────────────────────────────────────────────────────────────────
   ProofLedger app shell — tech-SaaS direction
   See .interface-design/system.md (Direction 1).
   ───────────────────────────────────────────────────────────────────── */

:root {
  --bg:           #f7f7f5;
  --panel:        #ffffff;
  --panel-border: #e5e7eb;
  --panel-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --panel-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.07);

  --ink:        #18181b;
  --ink-soft:   #374151;
  --muted:      #6b7280;
  --dim:        #9ca3af;

  --accent:        #dc4f00;
  --accent-glow:   rgba(220, 79, 0, 0.30);
  --accent-hover:  #6366f1;

  --success:       #10b981;
  --success-bg:    rgba(16, 185, 129, 0.10);
  --success-glow:  rgba(16, 185, 129, 0.20);

  --warning:       #f59e0b;
  --warning-bg:    rgba(245, 158, 11, 0.10);

  --alert:         #dc2626;
  --alert-bg:      rgba(220, 38, 38, 0.10);

  --font-sans:  'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  --text-xs:    11px;
  --text-sm:    12.5px;
  --text-base:  14px;
  --text-md:    15px;
  --text-lg:    17px;
  --text-xl:    22px;
  --text-2xl:   28px;
  --text-display: 38px;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-10: 56px; --s-12: 80px;

  --radius-card: 16px;
  --radius-btn:  8px;
  --radius-pill: 999px;

  --motion-fast:   180ms cubic-bezier(0.2, 0, 0, 1);
  --motion-medium: 280ms cubic-bezier(0.2, 0, 0, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }
body.shell {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; transition: color var(--motion-fast); }
a:hover { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

button { font: inherit; cursor: pointer; }

::selection { background: var(--accent); color: white; }

.skip-link {
  position: absolute; left: -1000px; top: 8px;
  background: var(--ink); color: white; padding: 8px 14px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.10em; font-size: var(--text-xs);
  border-radius: var(--radius-btn); z-index: 100;
}
.skip-link:focus { left: 8px; }

/* ─── App shell layout ─── */
.app {
  max-width: 1440px; margin: 0 auto; padding: var(--s-6) clamp(16px, 3vw, 32px);
  min-height: 100vh; display: flex; flex-direction: column; gap: var(--s-7);
}

.navbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-6);
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--panel-border);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  font-weight: 600; font-size: var(--text-lg); letter-spacing: 0.02em;
  color: var(--ink);
}
.brand:hover { color: var(--ink); }
.brand-mark { color: var(--accent); }

.tabs {
  display: flex; gap: var(--s-7); justify-content: center;
}
.tab {
  font-family: var(--font-sans);
  font-size: var(--text-sm); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--muted);
  padding: 8px 0;
  position: relative;
  transition: color var(--motion-fast);
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab.active::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -25px;
  height: 2px; background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.nav-right { display: flex; gap: var(--s-3); align-items: center; }
.about-link {
  font-size: var(--text-sm); color: var(--muted);
  padding: 6px 10px; border-radius: var(--radius-btn);
  transition: background var(--motion-fast), color var(--motion-fast);
}
.about-link:hover { color: var(--ink); background: rgba(0,0,0,0.04); }

.lang-switch {
  font-family: var(--font-mono); font-size: var(--text-xs); letter-spacing: 0.08em;
  background: transparent; color: var(--muted); border: 1px solid var(--panel-border);
  padding: 6px 10px; border-radius: var(--radius-btn);
  transition: all var(--motion-fast);
}
.lang-switch:hover { background: var(--ink); color: white; border-color: var(--ink); }

.signed-in-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-xs);
  padding: 6px 10px; border-radius: var(--radius-btn);
  background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.20);
}
.signed-in-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 6px var(--success-glow);
}
.signed-in-email { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#signinLink { font-size: var(--text-sm); }

.signin-form { display: flex; flex-direction: column; gap: var(--s-3); margin-top: var(--s-4); max-width: 420px; }
.account-email {
  font-family: var(--font-mono); font-size: var(--text-md); color: var(--ink);
  background: var(--bg); padding: var(--s-3) var(--s-4); border-radius: var(--radius-btn);
  border: 1px solid var(--panel-border); display: inline-block; margin-bottom: var(--s-4);
}
.kv-grid { display: flex; flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-5); }
.kv-grid > div { display: flex; gap: var(--s-3); align-items: baseline; }
.kv-grid dt { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); min-width: 100px; }
.kv-grid dd { margin: 0; color: var(--ink); }

@media (max-width: 1100px) {
  .navbar { grid-template-columns: auto auto; }
  .tabs { grid-column: 1 / -1; order: 3; overflow-x: auto; padding-bottom: 4px; }
  .tab.active::after { bottom: -8px; }
}

/* ─── 3-column main ─── */
.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  gap: var(--s-6);
  flex: 1;
}
@media (max-width: 1280px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr) 240px; gap: var(--s-5); }
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar-left { order: 2; }
  .sidebar-right { order: 3; }
  .center { order: 1; }
}

/* ─── Panel (a.k.a. "card") ─── */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-card);
  padding: var(--s-6);
  box-shadow: var(--panel-shadow);
}
.panel + .panel { margin-top: var(--s-5); }

.panel-head {
  display: flex; align-items: center; justify-content: flex-start;
  margin-bottom: var(--s-4);
}
.panel-head.split { justify-content: space-between; }
.panel-title {
  font-size: var(--text-sm); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--muted);
}

/* ─── Sidebars ─── */
.sidebar { align-self: start; position: sticky; top: var(--s-5); }
@media (max-width: 1100px) { .sidebar { position: static; } }

/* ─── Recent activity ─── */
.recent-list { list-style: none; display: flex; flex-direction: column; gap: var(--s-4); }
.recent-empty { color: var(--dim); font-size: var(--text-sm); font-style: italic; padding: var(--s-4) 0; }
.recent-item { display: block; }
.recent-link {
  display: flex; flex-direction: column; gap: var(--s-1);
  padding: var(--s-3) var(--s-2);
  border-radius: var(--radius-btn);
  transition: background var(--motion-fast);
}
.recent-link:hover { background: rgba(0,0,0,0.03); color: inherit; }
.recent-title { font-size: var(--text-sm); color: var(--ink); font-weight: 500; word-break: break-word; }

/* ─── Network Status ─── */
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-xs); font-weight: 500;
  color: var(--success); background: var(--success-bg);
  padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid rgba(16, 185, 129, 0.20);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 6px var(--success-glow);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(1.2); }
}
.live-pill.offline { color: var(--alert); background: var(--alert-bg); border-color: rgba(220, 38, 38, 0.20); }
.live-pill.offline .live-dot { background: var(--alert); box-shadow: none; animation: none; }

.net-stats { display: flex; flex-direction: column; gap: var(--s-3); }
.net-stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-2); }
.net-stats dt { font-size: var(--text-sm); color: var(--muted); }
.net-stats dd { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--ink); font-weight: 500; word-break: break-all; text-align: right; }
.net-stats .ok { color: var(--success); }
.net-stats .warn { color: var(--warning); }
.net-stats .down { color: var(--alert); }

/* ─── Center column / views ─── */
.center { min-width: 0; }

.view { animation: fadeIn 0.4s var(--motion-medium); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-head { margin-bottom: var(--s-6); }
.view-title {
  font-family: var(--font-sans);
  font-size: var(--text-2xl); font-weight: 600;
  letter-spacing: -0.005em; line-height: 1.1;
  margin-bottom: var(--s-2);
}
.view-sub {
  font-size: var(--text-md);
  color: var(--ink-soft);
  max-width: 70ch;
}

/* ─── Dashboard ─── */
.metric-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--s-4); margin-bottom: var(--s-5);
}
.metric { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); }
.metric-label {
  font-size: var(--text-xs); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.10em; font-weight: 500;
}
.metric-value { font-size: var(--text-2xl); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.warning-color { color: var(--warning); }
.success-color { color: var(--success); }

.chart-card { padding: var(--s-6); }
.spark { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding-top: var(--s-3); }
.spark .bar {
  flex: 1;
  background: var(--accent); opacity: 0.85;
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: opacity var(--motion-fast), transform var(--motion-fast);
}
.spark .bar:hover { opacity: 1; transform: scaleY(1.05); transform-origin: bottom; }
.spark .bar.empty { background: var(--panel-border); opacity: 0.6; }

/* ─── Primary card (Certify) ─── */
.primary-card { position: relative; overflow: hidden; padding: var(--s-7); }
.glow-accent {
  position: absolute; top: 0; left: 50%;
  transform: translateX(-50%);
  width: 60%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

.mode-tabs {
  display: inline-flex; padding: 3px;
  background: var(--bg); border: 1px solid var(--panel-border); border-radius: var(--radius-btn);
  margin-bottom: var(--s-5);
}
.mode-tab {
  background: transparent; border: 0; padding: 6px 14px;
  font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--muted); border-radius: 6px;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.mode-tab.active { background: var(--ink); color: white; }
.mode-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.input-pane { display: none; }
.input-pane.active { display: block; margin-bottom: var(--s-5); }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--s-2);
  padding: var(--s-10) var(--s-5);
  border: 2px dashed var(--success);
  border-radius: var(--radius-btn);
  background: rgba(16, 185, 129, 0.03);
  text-align: center; cursor: pointer;
  transition: all var(--motion-fast);
  position: relative;
}
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone:hover, .dropzone.drag-active {
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 24px var(--success-glow);
  transform: scale(1.01);
}
.dropzone.compact { padding: var(--s-5); }
.drop-content { display: flex; flex-direction: column; gap: var(--s-1); pointer-events: none; }
.drop-headline {
  font-family: var(--font-sans); font-weight: 500; font-size: var(--text-md);
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink);
}
.drop-sub { font-size: var(--text-xs); color: var(--muted); }

/* ─── Forms ─── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-bottom: var(--s-5); }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.form-field { display: flex; flex-direction: column; gap: var(--s-2); }
.form-label {
  display: block;
  font-family: var(--font-mono); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 500;
}
.form-label.inverse { color: rgba(255, 255, 255, 0.5); }
.form-label .dim { color: var(--dim); font-style: normal; text-transform: none; letter-spacing: 0.02em; font-weight: 400; }

input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-btn);
  padding: 10px 14px;
  font-family: var(--font-sans); font-size: var(--text-base);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--accent);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-input {
  width: 320px; max-width: 100%;
  background: var(--bg);
  border: 1px solid var(--panel-border);
  padding: 9px 14px;
  border-radius: var(--radius-btn);
  font-family: var(--font-sans); font-size: var(--text-sm);
}

.hash-output {
  background: var(--ink);
  color: white;
  border-radius: var(--radius-btn);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-5);
}
.hash-output code {
  display: block;
  font-family: var(--font-mono); font-size: var(--text-sm);
  color: white; word-break: break-all; line-height: 1.6;
  margin-top: var(--s-2);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-sans); font-weight: 500; font-size: var(--text-sm);
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: all var(--motion-fast);
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent); color: white;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.30);
}
.btn-primary:disabled { background: var(--panel-border); color: var(--dim); cursor: not-allowed; box-shadow: none; }

.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: white; }

.btn-ghost {
  background: transparent; color: var(--ink); border-color: var(--panel-border);
}
.btn-ghost:hover { background: var(--ink); color: white; border-color: var(--ink); }

.btn-danger { background: transparent; color: var(--alert); border-color: var(--alert); }
.btn-danger:hover { background: var(--alert); color: white; }

.btn-small { padding: 5px 10px; font-size: var(--text-xs); border-radius: 6px; }

.actions { display: flex; gap: var(--s-3); flex-wrap: wrap; }

/* ─── Result line ─── */
.result-line {
  display: none;
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--muted);
  padding: var(--s-3) 0; margin-top: var(--s-3);
  border-top: 1px solid var(--panel-border);
}
.result-line:not(:empty) { display: block; }
.result-line.success { color: var(--success); }
.result-line.fail    { color: var(--alert); }
.result-line.info    { color: var(--accent); }

/* ─── Verify grid ─── */
.verify-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
@media (max-width: 980px) { .verify-grid { grid-template-columns: 1fr; } }
.verify-grid > .panel { display: flex; flex-direction: column; gap: var(--s-4); }
.ext-steps { display: flex; flex-direction: column; gap: var(--s-3); padding-left: var(--s-5); }
.ext-steps li { line-height: 1.5; font-size: var(--text-sm); }
code.cmd, .ext-steps code {
  display: inline-block;
  font-family: var(--font-mono); font-size: var(--text-xs);
  background: var(--ink); color: white;
  padding: 4px 8px; border-radius: 4px;
  margin-bottom: 4px; word-break: break-all;
}

/* ─── Status pills ─── */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 10px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.status-pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pending   { color: var(--warning); background: var(--warning-bg); }
.status-confirmed { color: var(--success); background: var(--success-bg); }
.status-failed    { color: var(--alert);   background: var(--alert-bg); }

.visibility-pill {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--panel-border);
  white-space: nowrap;
}
.visibility-pill.private  { color: var(--alert);   border-color: rgba(220,38,38,0.20); background: var(--alert-bg); }
.visibility-pill.public   { color: var(--success); border-color: rgba(16,185,129,0.20); background: var(--success-bg); }
.visibility-pill.unlisted { color: var(--muted); }

/* ─── Assets table ─── */
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.data-table th {
  text-align: left; font-family: var(--font-mono); font-size: var(--text-xs);
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--dim);
  padding: var(--s-3) var(--s-3); border-bottom: 1px solid var(--panel-border);
}
.data-table td {
  padding: var(--s-3) var(--s-3);
  border-bottom: 1px solid var(--panel-border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: rgba(0,0,0,0.02); }
.asset-title strong { display: block; font-weight: 500; color: var(--ink); }
.asset-id, .asset-created, .asset-hash { color: var(--muted); }
.asset-hash { word-break: break-all; }
.asset-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.empty-state { padding: var(--s-8) var(--s-4); text-align: center; color: var(--muted); font-style: italic; font-size: var(--text-sm); }

/* ─── Transactions ledger ─── */
.ledger-list { display: flex; flex-direction: column; gap: var(--s-5); padding-left: var(--s-3); }
.ledger-item {
  border-left: 2px solid var(--accent);
  padding-left: var(--s-5);
  position: relative;
}
.ledger-item::before {
  content: '';
  position: absolute; left: -7px; top: 0;
  width: 12px; height: 12px;
  background: var(--bg); border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-glow);
}
.ledger-item.success { border-left-color: var(--success); }
.ledger-item.success::before { border-color: var(--success); box-shadow: 0 0 8px var(--success-glow); }
.ledger-item.warning { border-left-color: var(--warning); }
.ledger-item.warning::before { border-color: var(--warning); box-shadow: none; }
.ledger-item.alert { border-left-color: var(--alert); }
.ledger-item.alert::before { border-color: var(--alert); box-shadow: none; }
.ledger-time { color: var(--muted); margin-bottom: 2px; }
.ledger-event { font-size: var(--text-base); font-weight: 500; color: var(--ink); margin-bottom: var(--s-1); }
.ledger-proof { color: var(--muted); }
.ledger-payload { background: var(--bg); border: 1px solid var(--panel-border); padding: var(--s-2) var(--s-3); border-radius: 6px; font-size: 11px; color: var(--ink-soft); margin-top: var(--s-2); white-space: pre-wrap; word-break: break-all; max-height: 120px; overflow-y: auto; }

/* ─── Account placeholder ─── */
.placeholder-card { text-align: center; padding: var(--s-10) var(--s-6); display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.placeholder-icon { font-size: 36px; opacity: 0.7; }
.placeholder-title { font-size: var(--text-xl); font-weight: 600; }
.placeholder-body { color: var(--muted); max-width: 60ch; line-height: 1.6; }

/* ─── Utilities ─── */
.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: var(--text-xs); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
