/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #1c2333;
  --border:    #30363d;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --accent:    #58a6ff;
  --accent-2:  #3d8bff;
  --success:   #3fb950;
  --warning:   #d29922;
  --danger:    #f85149;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.nav-logo { font-size: 22px; }

.nav-links { display: flex; align-items: center; gap: 4px; }

.nav-link {
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link.active { color: var(--text); background: var(--surface-2); }
.nav-link-logout { color: var(--danger) !important; }
.nav-link-logout:hover { background: rgba(248,81,73,0.1) !important; }

/* ── Main Content ───────────────────────────────────────────────────────────── */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }
.alert-success  { background: rgba(63,185,80,0.1);  border-color: rgba(63,185,80,0.3);  color: #3fb950; }
.alert-error    { background: rgba(248,81,73,0.1);  border-color: rgba(248,81,73,0.3);  color: #f85149; }
.alert-warning  { background: rgba(210,153,34,0.1); border-color: rgba(210,153,34,0.3); color: #d29922; }
.alert-info     { background: rgba(88,166,255,0.1); border-color: rgba(88,166,255,0.3); color: #58a6ff; }
.alert-close { background: none; border: none; cursor: pointer; color: inherit; font-size: 16px; opacity: 0.7; }
.alert-close:hover { opacity: 1; }

/* ── Page Header ────────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}
.page-sub {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}
.breadcrumb {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.breadcrumb a { color: var(--accent); }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary  { background: var(--accent);   color: #0d1117; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-success  { background: var(--success);  color: #0d1117; border-color: var(--success); }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger   { background: var(--danger);   color: #fff; border-color: var(--danger); }
.btn-warning  { background: var(--warning);  color: #0d1117; border-color: var(--warning); }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-sm       { padding: 5px 12px; font-size: 12px; }
.btn-full     { width: 100%; justify-content: center; }
.btn-danger-ghost { background: none; border: none; color: var(--danger); padding: 4px 8px; font-size: 13px; }
.btn-danger-ghost:hover { background: rgba(248,81,73,0.1); }

.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; text-align: left; padding: 0; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.15s;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } }

/* ── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-hint  { font-size: 12px; color: var(--muted); margin-top: 4px; }
.required   { color: var(--danger); }
.muted      { color: var(--muted); }

.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  transition: border-color 0.15s;
  appearance: none;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.12);
}
.form-input::placeholder { color: var(--muted); }

.file-input {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px;
  cursor: pointer;
}

/* ── Radio Groups ───────────────────────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.radio-option:hover { border-color: var(--accent); background: rgba(88,166,255,0.04); }
.radio-option input[type=radio] { margin-top: 3px; accent-color: var(--accent); }
.radio-title { font-size: 13px; font-weight: 600; }
.radio-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: none;
  cursor: default;
}
.badge-draft    { background: rgba(139,148,158,0.2); color: #8b949e; }
.badge-active   { background: rgba(63,185,80,0.2);  color: #3fb950; cursor: pointer; }
.badge-closed   { background: rgba(248,81,73,0.15); color: #f85149; }
.badge-inactive { background: rgba(248,81,73,0.15); color: #f85149; cursor: pointer; }
.badge-email    { background: rgba(88,166,255,0.15); color: #58a6ff; }
.badge-manual   { background: rgba(210,153,34,0.15); color: #d29922; }

/* ── Active Banner ──────────────────────────────────────────────────────────── */
.active-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(63,185,80,0.08);
  border: 1px solid rgba(63,185,80,0.3);
  border-radius: var(--radius);
  margin-bottom: 24px;
}
.active-banner-left { display: flex; align-items: center; gap: 14px; }
.active-banner-title { font-weight: 600; font-size: 14px; }
.active-banner-sub   { font-size: 12px; color: var(--muted); }

.pulse-dot {
  width: 10px;
  height: 10px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 1.8s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63,185,80,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(63,185,80,0); }
}

/* ── Rounds Grid ────────────────────────────────────────────────────────────── */
.rounds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.round-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  display: block;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.round-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
}
.round-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.round-card-name { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.round-card-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.round-token { font-size: 11px; color: var(--muted); font-family: monospace; }

.round-active  { border-color: rgba(63,185,80,0.4); }
.round-closed  { opacity: 0.7; }

/* ── Steps ──────────────────────────────────────────────────────────────────── */
.steps-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .steps-row { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps-row { grid-template-columns: 1fr; } }

.step-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color 0.15s;
}
.step-done   { border-color: rgba(63,185,80,0.4);  background: rgba(63,185,80,0.04); }
.step-active { border-color: rgba(88,166,255,0.4); background: rgba(88,166,255,0.04); }
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--muted);
}
.step-done .step-num { background: rgba(63,185,80,0.2); border-color: rgba(63,185,80,0.5); color: var(--success); }
.step-title { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.step-sub   { font-size: 12px; color: var(--muted); line-height: 1.4; }
.step-body  { flex: 1; min-width: 0; }

/* ── Stats Row ──────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 600px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-num   { font-size: 28px; font-weight: 800; color: var(--accent); letter-spacing: -1px; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* ── Section Cards ──────────────────────────────────────────────────────────── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.section-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(48,54,61,0.6);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(88,166,255,0.03); }
.data-table-sm td, .data-table-sm th { padding: 7px 10px; font-size: 12px; }
.row-inactive { opacity: 0.5; }

.item-list-scroll { max-height: 340px; overflow-y: auto; border-radius: 6px; border: 1px solid var(--border); }

/* ── Tags ───────────────────────────────────────────────────────────────────── */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.tag-pending { background: rgba(210,153,34,0.15); color: #d29922; border: 1px solid rgba(210,153,34,0.3); }

/* ── Manual Order Items ─────────────────────────────────────────────────────── */
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(48,54,61,0.5);
  transition: background 0.1s;
}
.item-row:last-child { border-bottom: none; }
.item-row:hover { background: rgba(88,166,255,0.03); }
.item-row-info { flex: 1; min-width: 0; }
.item-row-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row-meta { font-size: 11px; color: var(--muted); }
.qty-input {
  width: 72px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: center;
  flex-shrink: 0;
}
.qty-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(88,166,255,0.12); }

/* ── Info Box ───────────────────────────────────────────────────────────────── */
.info-box {
  background: rgba(88,166,255,0.08);
  border: 1px solid rgba(88,166,255,0.25);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-icon  { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-sub   { font-size: 13px; }

/* ── Login ──────────────────────────────────────────────────────────────────── */
.login-wrap {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-icon  { font-size: 48px; margin-bottom: 16px; }
.login-title { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.login-sub   { font-size: 13px; color: var(--muted); margin-bottom: 28px; }

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