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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1e1e1e;
  --border: #2a2a2a;
  --text: #e5e5e5;
  --text-muted: #888;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.hidden { display: none !important; }

.view { width: 100%; min-height: 100vh; }

/* Login */
.login-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
  padding: 20px;
}

.login-box h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.login-box .subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.login-box input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.login-box input:focus {
  border-color: var(--primary);
}

.login-box button {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 4px;
}

.login-box button:hover { background: var(--primary-hover); }

.error { color: var(--danger); font-size: 13px; text-align: center; }

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

header h1 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; }

nav { display: flex; gap: 4px; }

.nav-btn {
  padding: 6px 14px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover { color: var(--text); background: var(--surface-2); }
.nav-btn.active { color: var(--text); background: var(--surface-2); }

.btn-ghost {
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

/* Main */
main { padding: 24px; max-width: 1200px; margin: 0 auto; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 { font-size: 20px; font-weight: 600; }

.btn-primary {
  padding: 8px 16px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover { background: var(--primary-hover); }

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.card:hover { border-color: var(--primary); transform: translateY(-1px); }

.card-nominal {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-price {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.card-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
}

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

.stat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.stat-dot.green { background: var(--success); }
.stat-dot.yellow { background: var(--warning); }
.stat-dot.red { background: var(--danger); }

.card-price-edit {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.card-price-edit input {
  width: 80px;
  padding: 4px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.card-price-edit button {
  padding: 4px 10px;
  background: var(--primary);
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 12px;
  cursor: pointer;
}

/* Table */
.table-wrap { overflow-x: auto; }

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

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

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:hover td { background: var(--surface); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.badge-processing { background: #1e3a5f; color: #60a5fa; }
.badge-completed { background: #14532d; color: #4ade80; }
.badge-failed { background: #450a0a; color: #fca5a5; }
.badge-cancelled { background: #451a03; color: #fbbf24; }

.btn-sm {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sm:hover { border-color: var(--text-muted); color: var(--text); }
.btn-sm.danger { border-color: var(--danger); color: var(--danger); }
.btn-sm.danger:hover { background: var(--danger); color: white; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-large { max-width: 800px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 { font-size: 18px; font-weight: 600; }

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.close-btn:hover { color: var(--text); }

/* Tabs mini */
.tabs-mini {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.tab-mini {
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-mini.active { background: var(--surface-2); color: var(--text); border-color: var(--text-muted); }

/* Codes section */
.codes-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.codes-actions textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: monospace;
  resize: vertical;
  outline: none;
}

.codes-actions textarea:focus { border-color: var(--primary); }

.codes-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.code-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.pagination button {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Filters */
.filters select {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

/* Order detail */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.detail-item {
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.detail-item label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.detail-item span {
  font-size: 14px;
  font-weight: 500;
}

/* Copy */
.copy-text {
  cursor: pointer;
  position: relative;
}

.copy-text:hover { opacity: 0.8; }

/* Key display */
.key-display {
  font-family: monospace;
  font-size: 12px;
  background: var(--surface-2);
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-top: 8px;
  word-break: break-all;
  user-select: all;
}

@media (max-width: 768px) {
  .header-left { flex-direction: column; align-items: flex-start; gap: 12px; }
  .cards-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  main { padding: 16px; }
}
