:root {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;

  --emerald: #059669;
  --emerald-light: #ecfdf5;
  --rose: #dc2626;
  --rose-light: #fef2f2;
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Space Mono', monospace;
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Card White Utility */
.card-white {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
}

/* Header */
.navbar-white {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Status Indicator Light */
.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.status-indicator-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.light-online {
  background-color: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulse-light 1.8s infinite;
}

.light-offline {
  background-color: var(--rose);
}

@keyframes pulse-light {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

.status-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.3px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.tag-primary {
  background: var(--blue-light);
  color: var(--blue);
}

.tag-gray {
  background: #f1f5f9;
  color: var(--text-muted);
}

.btn-refresh {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-refresh:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

/* Cards Row */
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.metric-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.icon-emerald { background: var(--emerald-light); color: var(--emerald); }
.icon-blue { background: var(--blue-light); color: var(--blue); }
.icon-purple { background: var(--purple-light); color: var(--purple); }

.metric-value {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-top: 10px;
  color: var(--text-main);
}

.currency-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.sub-target {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--emerald), #34d399);
  transition: width 0.4s ease;
}

/* Machine Card */
.machine-card {
  padding: 20px 24px;
}

.machine-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.machine-title-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.machine-status-icon {
  position: relative;
  width: 44px;
  height: 44px;
  background: var(--emerald-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.machine-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.machine-state {
  font-size: 11px;
  font-weight: 700;
  color: var(--emerald);
  letter-spacing: 0.5px;
}

.machine-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.machine-tags {
  display: flex;
  gap: 8px;
}

.machine-files-box {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-color);
}

.files-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.file-item i {
  font-size: 18px;
  flex-shrink: 0;
}

.file-item strong {
  display: block;
  font-size: 13px;
  color: var(--text-main);
}

.file-item small {
  font-size: 11px;
  color: var(--text-muted);
}

/* Chart Card */
.chart-card {
  padding: 24px;
}

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

.chart-title {
  font-size: 16px;
  font-weight: 700;
}

.chart-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--emerald);
  background: var(--emerald-light);
  padding: 4px 10px;
  border-radius: 12px;
}

.live-dot {
  width: 6px;
  height: 6px;
  background: var(--emerald);
  border-radius: 50%;
  animation: pulse-light 1.5s infinite;
  flex-shrink: 0;
}

.chart-wrapper {
  position: relative;
  height: 240px;
  width: 100%;
}

/* Tab Section */
.tab-section {
  padding: 0;
  overflow: hidden;
}

/* Scrollable Tab Buttons Bar for Mobile */
.tab-buttons {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

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

.tab-btn {
  padding: 14px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
}

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

.tab-btn.active {
  background: #ffffff;
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.tab-content {
  display: none;
  padding: 20px;
}

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

.tab-pane-grid {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 20px;
}

.pane-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

/* Classic Tables */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.classic-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  text-align: left;
}

.classic-table th {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
}

.classic-table td {
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

.classic-table tr:hover {
  background: #f8fafc;
}

.btn-action {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

.btn-danger-sm {
  background: var(--rose-light);
  color: var(--rose);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.btn-danger-sm:hover {
  background: var(--rose);
  color: #fff;
}

/* Monitored Coins Box */
.monitored-box {
  background: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.monitored-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coin-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.coin-symbol {
  font-weight: 700;
  font-size: 13px;
}

.coin-status {
  font-size: 12px;
  font-weight: 600;
}

/* Machine Activity Logs Console */
.logs-wrapper {
  background: #0f172a;
  border-radius: var(--radius-sm);
  overflow: hidden;
  color: #cbd5e1;
  font-family: var(--font-mono);
}

.logs-header {
  background: #1e293b;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
  color: #94a3b8;
}

.logs-console {
  padding: 14px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 11px;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}

.log-line {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding: 3px 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.text-emerald { color: var(--emerald); }
.text-rose { color: var(--rose); }
.text-blue { color: var(--blue); }
.text-purple { color: var(--purple); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* Footer */
.footer-white {
  text-align: center;
  padding: 12px;
  font-size: 12px;
  color: var(--text-dim);
}

/* =========================================================
   MOBILE / SMARTPHONE OPTIMIZATIONS (@media queries)
   ========================================================= */

@media (max-width: 900px) {
  .tab-pane-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-shell {
    padding: 12px 10px;
    gap: 14px;
  }

  .navbar-white {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .cards-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .metric-card {
    padding: 16px;
  }

  .metric-value {
    font-size: 22px;
  }

  .machine-card {
    padding: 16px;
  }

  .machine-name {
    font-size: 15px;
  }

  .files-grid {
    grid-template-columns: 1fr;
  }

  .chart-card {
    padding: 16px;
  }

  .chart-wrapper {
    height: 190px;
  }

  .tab-content {
    padding: 14px 10px;
  }

  .tab-btn {
    padding: 12px 14px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .brand-logo {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .status-badge {
    padding: 4px 10px;
  }

  .status-label {
    font-size: 11px;
  }

  .tag-pill {
    padding: 4px 8px;
    font-size: 11px;
  }

  .metric-value {
    font-size: 20px;
  }

  .pane-title {
    font-size: 13px;
  }
}
