:root {
  --green: #075e54;
  --green-dark: #054d44;
  --green-light: #25d366;
  --text: #111b21;
  --muted: #667781;
  --border: #e9edef;
  --bg: #f0f2f5;
  --card: #fff;
  --header-h: 56px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ─── LOGIN ─────────────────────── */

.login-screen {
  align-items: center;
  justify-content: center;
  background: var(--green);
}

.login-card {
  background: var(--card);
  border-radius: 16px;
  padding: 40px 32px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--green);
  color: #fff;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.login-card h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text);
}

.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border 0.2s;
}

.login-card input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(7,94,84,0.15);
}

.login-card button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-card button:hover { background: var(--green-dark); }
.login-card button:disabled { opacity: 0.6; cursor: default; }

.login-error {
  color: #e53e3e;
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

/* ─── TOP BAR ───────────────────── */

.top-bar {
  height: var(--header-h);
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-bar h1 {
  font-size: 18px;
  font-weight: 600;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.last-update {
  font-size: 11px;
  opacity: 0.7;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.2s;
}

.icon-btn:hover { background: rgba(255,255,255,0.22); }

.icon-btn.spinning {
  animation: spin 0.6s ease;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ─── DASHBOARD CONTENT ─────────── */

.dash-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: calc(16px + var(--safe-bottom));
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
  font-size: 14px;
}

/* ─── METRIC CARDS ──────────────── */

.dash-card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: transform 0.12s, box-shadow 0.12s;
  cursor: default;
}

.dash-card:active {
  transform: scale(0.98);
}

.dash-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.dash-card-body { flex: 1; min-width: 0; }

.dash-card-title {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.dash-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
}

.dash-card-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* accent colors */
.accent-blue .dash-card-icon   { background: #e3f2fd; color: #1565c0; }
.accent-orange .dash-card-icon { background: #fff3e0; color: #e65100; }
.accent-red .dash-card-icon    { background: #fce4ec; color: #c62828; }
.accent-green .dash-card-icon  { background: #e8f5e9; color: #2e7d32; }
.accent-purple .dash-card-icon { background: #f3e5f5; color: #6a1b9a; }
.accent-teal .dash-card-icon   { background: #e0f2f1; color: #00695c; }

/* ─── LIST CARDS ────────────────── */

.dash-list {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  grid-column: 1 / -1;
}

.dash-list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.dash-list-icon { font-size: 18px; }

.dash-list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.dash-list-badge {
  font-size: 11px;
  background: #e53e3e;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 700;
}

.dash-list-badge.green { background: var(--green-light); }

.dash-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 13px;
  gap: 8px;
}

.dash-row:last-child { border-bottom: none; }

.dash-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.dash-row-detail {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  text-align: right;
}

.dash-row-detail.warn {
  color: #e53e3e;
  font-weight: 700;
}

.dash-row-detail.money {
  color: var(--green-dark);
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.processing { background: #ff9800; }
.status-dot.shipped    { background: #2196f3; }
.status-dot.completed  { background: #4caf50; }
.status-dot.pending    { background: #9e9e9e; }
.status-dot.on-hold    { background: #ff5722; }

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 12px 0;
  font-size: 13px;
}

/* ─── RESPONSIVE ────────────────── */

@media (max-width: 480px) {
  .dash-grid {
    grid-template-columns: 1fr;
  }
  .dash-list { grid-column: 1; }
  .dash-card-value { font-size: 22px; }
}

@media (min-width: 768px) {
  .dash-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .dash-content {
    padding: 24px;
  }
}

@media (min-width: 1200px) {
  .dash-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}
