@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&family=Space+Mono:wght@400;700&display=swap');

:root {
  --bg:          #040d1a;
  --surface:     #081525;
  --surface2:    #0d1e35;
  --surface3:    #162540;
  --border:      #1a2e4a;
  --border2:     #2a4060;
  --accent:      #e8950a;
  --accent2:     #f5b030;
  --accent-dim:  rgba(232,149,10,0.12);
  --green:       #00c878;
  --green-dim:   rgba(0,200,120,0.1);
  --red:         #ff4060;
  --red-dim:     rgba(255,64,96,0.1);
  --blue:        #3090ff;
  --text:        #d0e0f0;
  --text2:       #7090b0;
  --text3:       #3a5070;
  --mono:        'Space Mono', monospace;
  --head:        'Syne', sans-serif;
  --body:        'DM Sans', sans-serif;
  --radius:      10px;
  --transition:  0.2s ease;
}

/* ── THEME: Warm Dark (amber-brown) ─────────────────────────────── */
[data-theme="warm"] {
  --bg:       #100a04;
  --surface:  #1a1008;
  --surface2: #251808;
  --surface3: #2e2010;
  --border:   #3a2810;
  --border2:  #503818;
  --accent:   #e8950a;
  --accent2:  #f5b030;
  --accent-dim: rgba(232,149,10,0.15);
  --text:     #f0e0c8;
  --text2:    #a08060;
  --text3:    #604830;
  --green:    #40d080;
  --green-dim:rgba(64,208,128,0.12);
  --red:      #ff5a4a;
  --red-dim:  rgba(255,90,74,0.12);
  --blue:     #60b0ff;
}

/* ── THEME: Ocean (teal-dark) ───────────────────────────────────── */
[data-theme="ocean"] {
  --bg:       #020e10;
  --surface:  #041820;
  --surface2: #062028;
  --surface3: #082830;
  --border:   #0c3040;
  --border2:  #144858;
  --accent:   #00d4c8;
  --accent2:  #20ece0;
  --accent-dim: rgba(0,212,200,0.12);
  --text:     #c0eaea;
  --text2:    #507080;
  --text3:    #284050;
  --green:    #00e080;
  --green-dim:rgba(0,224,128,0.12);
  --red:      #ff5070;
  --red-dim:  rgba(255,80,112,0.12);
  --blue:     #40b0ff;
}

/* ── THEME: Light Paper ─────────────────────────────────────────── */
[data-theme="light"] {
  --bg:       #f5f0e8;
  --surface:  #ffffff;
  --surface2: #f0ebe0;
  --surface3: #e8e0d0;
  --border:   #d8cfc0;
  --border2:  #c0b098;
  --accent:   #c06000;
  --accent2:  #e07800;
  --accent-dim: rgba(192,96,0,0.10);
  --text:     #1a1410;
  --text2:    #5a4e42;
  --text3:    #9a8e82;
  --green:    #1a7840;
  --green-dim:rgba(26,120,64,0.10);
  --red:      #c82020;
  --red-dim:  rgba(200,32,32,0.08);
  --blue:     #1850a0;
}

/* Light theme specific overrides */
[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="light"] .topbar {
  background: var(--surface) !important;
  border-bottom-color: var(--border) !important;
}
[data-theme="light"] .modal {
  background: var(--surface) !important;
}

/* ── Theme switcher widget ──────────────────────────────────────── */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
}
.theme-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  outline: none;
}
.theme-btn:hover { transform: scale(1.2); }
.theme-btn.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent); }
.theme-btn[data-t="navy"]  { background: linear-gradient(135deg, #040d1a 50%, #e8950a 50%); }
.theme-btn[data-t="warm"]  { background: linear-gradient(135deg, #100a04 50%, #f5b030 50%); }
.theme-btn[data-t="ocean"] { background: linear-gradient(135deg, #020e10 50%, #00d4c8 50%); }
.theme-btn[data-t="light"] { background: linear-gradient(135deg, #f5f0e8 50%, #c06000 50%); }
.theme-btn[data-t="light"] { border-color: var(--border); }

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

body {
  /* background: var(--bg); */
  background:
    radial-gradient(circle at 15% 20%, rgba(255,159,28,0.12), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(58,134,255,0.12), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--head); letter-spacing: -0.02em; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent2); color: #fff; transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255,64,96,0.25);
}
.btn-danger:hover { background: rgba(255,64,96,0.2); }

.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ── Form elements ─────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

input, select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--surface3);
}

input::placeholder, textarea::placeholder { color: var(--text3); }

select option { background: var(--surface2); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
}

.card:hover { border-color: var(--border2); }

/* ── Status badges ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.badge::before { content: '●'; font-size: 7px; }

.badge-active  { background: var(--green-dim);  color: var(--green); }
.badge-cleared { background: rgba(48,144,255,.1); color: var(--blue); }
.badge-on_hold { background: rgba(232,149,10,.12); color: var(--accent2); }
.badge-completed { background: rgba(120,100,200,.12); color: #a088ff; }

/* ── Toast notifications ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  max-width: 340px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: var(--green); color: #000; }
.toast-error   { background: var(--red);   color: #fff; }
.toast-info    { background: var(--accent); color: #000; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4,13,26,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.modal-title {
  font-family: var(--head);
  font-size: 20px;
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  color: #fff;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--head);
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
}

.logo-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.1em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.company-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
}
.company-chip span {
  font-size: 13px;
  font-weight: 500;
}

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Hash display ──────────────────────────────────────────── */
.hash-display {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 10px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-block;
}
.hash-display:hover { color: var(--accent); border-color: var(--accent); }

/* ── Chain indicator ───────────────────────────────────────── */
.chain-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  letter-spacing: 0.1em;
}
.chain-indicator::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
}
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { color: var(--text2); margin-bottom: 8px; font-size: 18px; }
.empty-state p { color: var(--text3); font-size: 14px; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 0 16px; }
}