/* Cashu Admin UI - Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Karla:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d;
  --border-color: #30363d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-primary: #763CC3;
  --accent-primary-hover: #8a4dd1;
  --accent-secondary: #f18805;
  --accent-success: #3fb950;
  --accent-warning: #d29922;
  --accent-danger: #f85149;
  --shadow: 0 4px 24px rgba(118, 60, 195, 0.08);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

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

body {
  font-family: 'Karla', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6,
.sidebar-header h2,
.nav-text,
.card-header h2,
.form-group label,
.stat-info h3,
.info-label,
.metric-label,
.page-header h1 {
  font-family: 'IBM Plex Mono', monospace;
}

/* Login Screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1025 100%);
  position: relative;
  overflow: hidden;
}

.login-screen::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(118, 60, 195, 0.08) 0%, transparent 40%),
              radial-gradient(circle at 70% 70%, rgba(241, 136, 5, 0.05) 0%, transparent 40%);
  animation: float 20s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(2%, 2%); }
}

.login-container {
  background: var(--bg-secondary);
  padding: 3.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  text-align: center;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}

.login-logo {
  margin-bottom: 1.5rem;
}

.login-logo-img {
  width: 80px !important;
  height: 80px !important;
  object-fit: contain;
}

.login-container h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  font-size: 1rem;
}

.login-field {
  margin-bottom: 1.25rem;
  text-align: left;
}

.login-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-family: 'IBM Plex Mono', monospace;
}

.login-field input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: 'Karla', sans-serif;
  transition: var(--transition);
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(118, 60, 195, 0.15);
}

.login-field input::placeholder {
  color: var(--text-muted);
}

.login-container .btn-primary {
  width: 100%;
  padding: 0.9rem;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.login-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.login-footer-nut {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}

/* Main Layout */
#main-app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo-img {
  width: 28px !important;
  height: 28px !important;
  object-fit: contain;
}

.sidebar-header h2 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-menu {
  list-style: none;
  padding: 0.75rem 0;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin-left: -1px;
}

.nav-item:hover {
  background: var(--bg-hover);
}

.nav-item.active {
  background: rgba(118, 60, 195, 0.08);
  border-left-color: var(--accent-primary);
}

.nav-icon {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.nav-item.active .nav-icon {
  color: var(--accent-primary);
}

.nav-text {
  font-size: 0.9rem;
  font-weight: 500;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.online {
  background: var(--accent-success);
  box-shadow: 0 0 8px var(--accent-success);
}

.status-dot.offline {
  background: var(--accent-danger);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 250px;
  padding: 2rem;
  min-height: 100vh;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  font-size: 2rem;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  color: var(--accent-primary);
}

.stat-icon-purple { color: var(--accent-primary); }
.stat-icon-blue { color: #58a6ff; }
.stat-icon-green { color: var(--accent-success); }
.stat-icon-orange { color: var(--accent-secondary); }

.stat-info h3 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.monitoring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

/* Cards */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.card.full-width {
  grid-column: 1 / -1;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tertiary);
}

.card-header h2 {
  font-size: 0.95rem;
  font-weight: 600;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.card-body {
  padding: 1.25rem;
}

/* Info List */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

.info-value {
  font-weight: 500;
  text-align: right;
}

.info-value.code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Resource Bars */
.resource-bars {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.resource-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.resource-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), #9d6de6);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.system-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.system-info p {
  margin-bottom: 0.25rem;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table tbody tr {
  transition: background 0.15s ease;
}

.data-table tbody tr:hover {
  background: rgba(118, 60, 195, 0.04);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.metric-box {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: var(--radius);
  text-align: center;
}

.metric-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--accent-primary);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: 'Karla', sans-serif;
  transition: var(--transition);
}

.form-group select,
select,
.card-actions select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--bg-tertiary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-group select option,
select option {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(118, 60, 195, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

.form-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-style: italic;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Karla', sans-serif;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}

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

.btn-warning {
  background: var(--accent-warning);
  color: #fff;
}

.btn-warning:hover {
  background: #b58900;
}

.btn-danger {
  background: var(--accent-danger);
  color: #fff;
}

.btn-danger:hover {
  background: #d73a49;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

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

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
}

/* Tabs */
.settings-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: var(--transition);
  font-family: 'Karla', sans-serif;
  font-size: 0.9rem;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab-btn.active {
  color: var(--accent-primary);
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--accent-primary);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Actions Sections */
.actions-section {
  margin-bottom: 2.5rem;
}

.actions-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.actions-section-header.danger {
  color: var(--accent-danger);
  border-bottom-color: rgba(248, 81, 73, 0.2);
}

.actions-section-header.utility {
  color: var(--text-secondary);
}

/* Actions Grid */
.actions-grid {
  display: grid;
  gap: 1.5rem;
}

.actions-grid-2col {
  grid-template-columns: repeat(2, 1fr);
}

/* Action Cards */
.action-card {
  position: relative;
  overflow: visible;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.action-card .card-body {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  height: 100%;
}

.action-card-severity {
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 3px;
}

.action-card-danger .action-card-severity {
  background: var(--accent-danger);
}

.action-card-warning .action-card-severity {
  background: var(--accent-warning);
}

.severity-badge {
  position: absolute;
  top: 0;
  right: 1rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.25rem 0.5rem;
  border-radius: 0 0 4px 4px;
}

.severity-danger {
  background: rgba(248, 81, 73, 0.15);
  color: var(--accent-danger);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-top: none;
}

.severity-warning {
  background: rgba(210, 153, 34, 0.15);
  color: var(--accent-warning);
  border: 1px solid rgba(210, 153, 34, 0.3);
  border-top: none;
}

.action-card-danger {
  border-color: rgba(248, 81, 73, 0.25);
  background: linear-gradient(180deg, rgba(248, 81, 73, 0.03) 0%, var(--bg-secondary) 40%);
}

.action-card-danger:hover {
  border-color: rgba(248, 81, 73, 0.4);
  box-shadow: 0 4px 20px rgba(248, 81, 73, 0.08);
}

.action-card-warning {
  border-color: rgba(210, 153, 34, 0.25);
  background: linear-gradient(180deg, rgba(210, 153, 34, 0.03) 0%, var(--bg-secondary) 40%);
}

.action-card-warning:hover {
  border-color: rgba(210, 153, 34, 0.4);
  box-shadow: 0 4px 20px rgba(210, 153, 34, 0.08);
}

.action-card-utility {
  border-color: var(--border-color);
}

.action-card-utility:hover {
  border-color: rgba(118, 60, 195, 0.3);
  box-shadow: 0 4px 20px rgba(118, 60, 195, 0.06);
}

.action-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.action-card-icon.danger {
  background: rgba(248, 81, 73, 0.1);
  color: var(--accent-danger);
}

.action-card-icon.warning {
  background: rgba(210, 153, 34, 0.1);
  color: var(--accent-warning);
}

.action-card-icon.utility {
  background: rgba(118, 60, 195, 0.1);
  color: var(--accent-primary);
}

.action-card-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.action-card-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.25rem;
  flex: 1;
}

.action-card-form {
  margin-bottom: 1rem;
}

.action-card-form .form-group {
  margin-bottom: 0.75rem;
}

.action-card-details {
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.35rem 0;
  font-size: 0.8rem;
}

.detail-item:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

.detail-label {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  margin-right: 1rem;
}

.detail-value {
  color: var(--text-secondary);
  text-align: right;
}

.action-card-footer {
  margin-top: auto;
}

.btn-action {
  padding: 0.7rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  width: 100%;
}

@media (max-width: 768px) {
  .actions-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: var(--transition);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal.visible .modal-content {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

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

.modal-body {
  padding: 1.5rem;
}

.warning-banner {
  background: rgba(210, 153, 34, 0.1);
  border: 1px solid var(--accent-warning);
  color: var(--accent-warning);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease;
  max-width: 350px;
  border-left: 3px solid var(--accent-primary);
}

.toast.success {
  border-left-color: var(--accent-success);
}

.toast.error {
  border-left-color: var(--accent-danger);
}

.toast.warning {
  border-left-color: var(--accent-warning);
}

.toast-icon {
  font-size: 1.25rem;
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.error-message {
  color: var(--accent-danger);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

/* Standalone selects (outside .form-group) */
.form-row > select,
.card-actions > select {
  padding: 0.5rem 2.5rem 0.5rem 0.75rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: 'Karla', sans-serif;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  cursor: pointer;
}

.form-row > select:focus,
.card-actions > select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(118, 60, 195, 0.1);
}

/* Log Viewer */
.log-viewer {
  background: #0a0e14;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 1rem;
  height: 600px;
  overflow-y: auto;
  overflow-x: auto;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.log-viewer::-webkit-scrollbar {
  width: 8px;
}

.log-viewer::-webkit-scrollbar-track {
  background: #0a0e14;
}

.log-viewer::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 4px;
}

.log-entry {
  display: flex;
  gap: 0.75rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.log-entry:hover {
  background: rgba(118, 60, 195, 0.06);
}

.log-time {
  color: var(--text-muted);
  min-width: 85px;
  flex-shrink: 0;
}

.log-level {
  min-width: 50px;
  flex-shrink: 0;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  padding-top: 1px;
}

.log-level.info { color: var(--accent-primary); }
.log-level.warn { color: var(--accent-warning); }
.log-level.error { color: var(--accent-danger); }
.log-level.debug { color: var(--text-muted); }

.log-source {
  color: #58a6ff;
  min-width: 72px;
  flex-shrink: 0;
}

.log-message {
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-all;
}

.log-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 3rem;
}

.log-autoscroll-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'Karla', sans-serif;
}

.log-autoscroll-label input[type="checkbox"] {
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 70px;
  }
  
  .sidebar-header h2,
  .nav-text {
    display: none;
  }
  
  .nav-item {
    justify-content: center;
    padding: 1rem;
  }
  
  .sidebar-footer {
    padding: 1rem;
  }
  
  .main-content {
    margin-left: 70px;
    padding: 1rem;
  }
  
  .dashboard-grid,
  .monitoring-grid,
  .actions-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   Database Stats — new styles for database entry count monitoring
   ========================================================================= */

/* Additional stat icon colors */
.stat-icon-teal { color: #2dd4bf; }
.stat-icon-pink { color: #e879f9; }

/* Dashboard DB stats grid */
.db-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.db-stat-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
}

/* Per-type left border accent */
.db-stat-mint   { border-left-color: var(--accent-primary); }
.db-stat-melt   { border-left-color: #58a6ff; }
.db-stat-proofs { border-left-color: #f85149; }
.db-stat-sigs   { border-left-color: #2dd4bf; }

.db-stat-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.db-stat-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.db-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-primary);
  line-height: 1;
}

.db-stat-sublabel {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Segmented distribution bar */
.db-stat-bar {
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.07);
  overflow: hidden;
  display: flex;
  margin-bottom: 8px;
}

.db-bar-seg {
  height: 100%;
  transition: width 0.4s ease;
}
.db-bar-seg.seg-issued  { background: #58a6ff; }
.db-bar-seg.seg-paid    { background: #3fb950; }
.db-bar-seg.seg-unpaid  { background: #f85149; }
.db-bar-seg.seg-expired { background: #d29922; }
.db-bar-seg.seg-pending { background: #d29922; }

.db-stat-states {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Activity row — 3 mini cards */
.db-activity-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 12px;
}

.db-activity-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.db-activity-icon {
  font-size: 1rem;
  line-height: 1;
}

.db-activity-val {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-primary);
  line-height: 1;
}

.db-activity-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

/* State badges for quote state breakdowns */
.state-badge {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.state-badge.state-unpaid   { background: rgba(248, 81, 73, 0.15);  color: #f85149; border-color: rgba(248, 81, 73, 0.3); }
.state-badge.state-paid     { background: rgba(63, 185, 80, 0.15);  color: #3fb950; border-color: rgba(63, 185, 80, 0.3); }
.state-badge.state-issued   { background: rgba(88, 166, 255, 0.15); color: #58a6ff; border-color: rgba(88, 166, 255, 0.3); }
.state-badge.state-expired  { background: rgba(210, 153, 34, 0.15); color: #d29922; border-color: rgba(210, 153, 34, 0.3); }
.state-badge.state-pending  { background: rgba(210, 153, 34, 0.15); color: #d29922; border-color: rgba(210, 153, 34, 0.3); }
/* Numeric states (older Nutshell versions store integers) */
.state-badge.state-0 { background: rgba(248, 81, 73, 0.15);  color: #f85149; border-color: rgba(248, 81, 73, 0.3); }
.state-badge.state-1 { background: rgba(63, 185, 80, 0.15);  color: #3fb950; border-color: rgba(63, 185, 80, 0.3); }
.state-badge.state-2 { background: rgba(88, 166, 255, 0.15); color: #58a6ff; border-color: rgba(88, 166, 255, 0.3); }

/* =========================================================================
   Database Page — additional styles
   ========================================================================= */

/* 2×2 stat grid for database page header */
.stats-grid-2x2 {
  grid-template-columns: repeat(2, 1fr) !important;
}

/* Table footer stat pills */
.table-footer-stats {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.table-footer-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 4px 10px;
}

.table-footer-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.table-footer-val {
  font-size: 0.9rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-primary);
}

/* Request Volume comparison table */
.req-volume-table td,
.req-volume-table th {
  text-align: center;
}

.req-volume-table th:first-child,
.req-volume-table td:first-child {
  text-align: left;
}

.period-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(255,255,255,0.07);
  color: var(--text-secondary);
  border: 1px solid rgba(255,255,255,0.1);
}

.req-count {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 1rem;
}

.req-total {
  color: var(--accent-primary);
  font-weight: 700;
}

.req-volume-note {
  margin-top: 14px;
  font-size: 0.78em;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Keysets card accent */
.card-keysets-db {
  border-left: 3px solid #2dd4bf;
}

/* DB data path label */
.db-path-label {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.72em;
  color: var(--text-muted);
  opacity: 0.5;
  word-break: break-all;
}

/* =========================================================================
   Mint Balances Section — Dashboard top banner (outstanding eCash per unit)
   ========================================================================= */

.mint-balances-section {
  margin-bottom: 24px;
}

.mint-balances-section .section-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.mint-balance-cards {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.mint-balance-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px 28px;
  flex: 1;
  min-width: 220px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.mint-balance-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), #9d6de6);
}

.mint-balance-card.unit-usd::before {
  background: linear-gradient(90deg, #3fb950, #2ea043);
}

.mint-balance-card.unit-eur::before {
  background: linear-gradient(90deg, #58a6ff, #1f6feb);
}

.mint-balance-card:hover {
  border-color: var(--accent-primary);
}

.mint-balance-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.mint-balance-info {
  min-width: 0;
}

.mint-balance-unit {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.mint-balance-amount {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  white-space: nowrap;
}

.mint-balance-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: "IBM Plex Mono", monospace;
}

.mint-balance-detail {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
  opacity: 0.7;
}

.mint-balance-placeholder {
  opacity: 0.5;
}

.mint-balance-unavailable {
  opacity: 0.65;
  border-style: dashed;
}

.mint-balance-unavailable .mint-balance-amount {
  font-size: 1rem;
  color: var(--text-muted);
}
