/* Milky Way - styles */
* { box-sizing: border-box; }
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --danger: #dc2626;
  --danger-600: #b91c1c;
}
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
.site-header { text-align: center; padding: 2rem 1rem 0.5rem; }
.site-header h1 { margin: 0; font-size: 2rem; }
.subtitle { margin: 0.25rem 0 0; color: var(--muted); }
.container { max-width: 1000px; margin: 0 auto; padding: 1rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin: 0 0 1rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.card h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.grid { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); gap: 0.75rem; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
label { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 500; }
label span { color: var(--muted); font-weight: 600; }
input[type="text"], input[type="tel"], input[type="number"], input[type="date"], select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
  background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.form-actions { margin-top: 0.75rem; display: flex; gap: 0.5rem; }
button { cursor: pointer; border: 1px solid transparent; border-radius: 10px; padding: 0.55rem 0.85rem; font-weight: 600; }
button.primary { background: var(--primary); color: #fff; }
button.primary:hover { background: var(--primary-600); }
button.secondary { background: #f8fafc; border-color: var(--border); }
button.secondary:hover { background: #eef2f7; }
button.danger { background: var(--danger); color: #fff; }
button.danger:hover { background: var(--danger-600); }
button.link { background: transparent; color: var(--primary); border: none; padding: 0.25rem 0.5rem; }
button.link.danger { color: var(--danger); }
.list-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.actions { display: flex; gap: 0.5rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
thead th { background: #f1f5f9; position: sticky; top: 0; z-index: 1; }
tbody tr:nth-child(even) { background: #fafafa; }
td.empty { color: var(--muted); text-align: center; padding: 1rem; }
.empty { color: var(--muted); text-align: center; padding: 1rem; }
.site-footer { text-align: center; color: var(--muted); padding: 1rem; }

/* Layout with sidebar */
.app { display: grid; grid-template-columns: 280px 1fr; gap: 1rem; }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } }
.sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  align-self: start;
}
.sidebar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.customer-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 60vh; overflow: auto; }
.customer-item {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.customer-item:hover { background: #f8fafc; }
.customer-item.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.15) inset; }
.customer-item .name { font-weight: 600; }
.customer-item .meta { color: var(--muted); font-size: 0.85rem; }
.card.mini { padding: 0.75rem; margin-top: 0.75rem; }
.hidden { display: none !important; }
.small { padding: 0.35rem 0.6rem; font-size: 0.9rem; border-radius: 8px; }
.content-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.active-customer .badge { background: #eef2ff; color: #3730a3; border-radius: 999px; padding: 0.2rem 0.5rem; border: 1px solid #c7d2fe; }
.muted { color: var(--muted); }

/* Dashboard summary */
.dashboard-summary { margin-top: 0.75rem; }
.dashboard-summary .dash-total {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.dashboard-summary .dash-total .label { color: var(--muted); }
.dashboard-summary .dash-total .value { font-weight: 700; color: #0f172a; }
.dashboard-summary .dash-list { margin-top: 0.5rem; display: grid; gap: 0.4rem; }
.dashboard-summary .dash-meta { margin-top: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.dashboard-summary .meta-item { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem 0.6rem; display: flex; gap: 0.4rem; align-items: baseline; }
.dashboard-summary .meta-item .label { color: var(--muted); }
.dashboard-summary .meta-item .value { font-weight: 700; }
.dashboard-summary .cust-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  background: #fff;
}
.dashboard-summary .cust-line.muted { opacity: 0.7; }
.dashboard-summary .cl-main { display: flex; flex-direction: column; }
.dashboard-summary .cl-main .sub { color: var(--muted); font-size: 0.85rem; }
.dashboard-summary .cl-right { display: flex; align-items: center; gap: 0.5rem; }
.dashboard-summary .amt { font-weight: 600; }

/* Mobile tweaks */
@media (max-width: 640px) {
  .list-header { flex-wrap: wrap; gap: 0.4rem; }
  .list-header .actions { width: 100%; display: flex; justify-content: flex-start; }
  .dashboard-summary .cust-line { flex-direction: column; align-items: flex-start; }
  .dashboard-summary .cl-right { width: 100%; justify-content: space-between; }
  /* removed obsolete rules */
}

/* Customer details panel */
.details { display: block; }
.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.5rem;
}
@media (max-width: 640px) { .details-grid { grid-template-columns: 1fr; } }
.field { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 0.75rem; }
.field .label { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.15rem; }
.field .value { font-weight: 700; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.9rem;
}
@media (max-width: 640px) { .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 0.75rem; text-align: center; }
.stat-label { color: var(--muted); font-size: 0.8rem; }
.stat-value { font-weight: 800; font-size: 1.1rem; margin-top: 0.15rem; }
