:root {
  --bg: #27292e;
  --chrome: #212327;
  --surface: #2c2e34;
  --surface-hover: #363940;
  --surface-active: #3e4149;
  --input-bg: #202226;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f4f6;
  --muted: #a6abb6;
  --warm: #e6ba83;
  --green: #4ade80;
  --amber: #fbbf24;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.browser-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Tab Strip */
.tab-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 12px;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.tab-list {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-list::-webkit-scrollbar {
  display: none;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  min-width: 115px;
  max-width: 205px;
  padding: 0 11px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.14s, color 0.14s;
}

.tab-item:hover {
  background: var(--surface);
  color: var(--text);
}

.tab-item.active {
  background: var(--surface-active);
  color: var(--text);
  border-color: var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.tab-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-close {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
}

.tab-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.edge-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.status-led.online {
  background: var(--green);
}

/* Nav Bar */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-controls, .route-controls {
  display: flex;
  align-items: center;
  gap: 3px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.14s, opacity 0.14s;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-hover);
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.omnibox {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.omnibox:focus-within {
  border-color: rgba(230, 186, 131, 0.5);
  box-shadow: 0 0 0 2px rgba(230, 186, 131, 0.12);
}

.lock-badge {
  display: flex;
  align-items: center;
  color: var(--green);
}

.omnibox input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
}

.omnibox input::placeholder {
  color: var(--muted);
}

.route-select {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

.progress-bar {
  height: 2px;
  width: 0%;
  background: var(--warm);
  transition: width 0.25s ease, opacity 0.2s ease;
  opacity: 0;
}

.progress-bar.active {
  opacity: 0.9;
}

/* Viewport */
.viewport-wrap {
  position: relative;
  flex: 1;
  background: var(--bg);
  overflow: hidden;
}

.page-frame {
  width: 100%;
  height: 100%;
  border: none;
  background: #ffffff;
}

.hidden {
  display: none !important;
}

/* Light-Dark Warm Graphite Home View */
.home-view {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 38%, #34373f 0%, #2b2d33 42%, #24262b 82%);
}

.home-hero {
  width: 100%;
  max-width: 570px;
  text-align: center;
  transform: translateY(-20px);
}

.hero-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 10px;
}

.hero-emblem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(230, 186, 131, 0.14);
  border: 1px solid rgba(230, 186, 131, 0.28);
  color: var(--warm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

.hero-title {
  font-size: 33px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text);
}

.hero-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
}

.home-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 8px 0 18px;
  background: rgba(44, 46, 52, 0.92);
  border: 1px solid var(--border-strong);
  border-radius: 15px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 14px 36px rgba(0, 0, 0, 0.22);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.home-search:focus-within {
  background: #33363d;
  border-color: rgba(230, 186, 131, 0.5);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 14px 36px rgba(0, 0, 0, 0.28),
    0 0 0 3px rgba(230, 186, 131, 0.1);
}

.search-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.home-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14.5px;
}

.home-search input::placeholder {
  color: var(--muted);
}

.go-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--warm);
  color: #1e1c18;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
}

.go-btn:hover {
  opacity: 0.92;
  transform: translateY(-0.5px);
}

.hero-status {
  margin-top: 15px;
  font-size: 12px;
  color: var(--muted);
}

/* Buttons & Error */
.primary-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--warm);
  color: #1e1c18;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
}

.secondary-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-hover);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.error-view {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.error-card {
  max-width: 400px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
}

.error-card h2 {
  font-size: 16px;
  margin-bottom: 8px;
}

.error-card p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* Settings Drawer */
.drawer {
  position: fixed;
  top: 90px;
  right: 12px;
  width: 320px;
  max-height: calc(100vh - 104px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.drawer-header h3 {
  font-size: 13px;
  font-weight: 600;
}

.drawer-body {
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.field-group input,
.field-group select {
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font-size: 12px;
  outline: none;
}

.field-group small {
  font-size: 11px;
  color: var(--muted);
}

.drawer-actions {
  display: flex;
  gap: 8px;
}

.crypto-box {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.crypto-box h4 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

.crypto-box pre {
  font-size: 11px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}
