:root {
  --color-bg: #faf7f2;
  --color-surface: #ffffff;
  --color-surface-alt: #f4efe6;
  --color-border: #e6ddcf;
  --color-text: #2a2420;
  --color-text-muted: #7a6f60;
  --color-primary: #5b3a53;
  --color-primary-dark: #402940;
  --color-primary-light: #f0e6ee;
  --color-accent: #b78a4f;
  --color-warning: #b0791f;
  --color-warning-bg: #fbf0dc;
  --color-danger: #b8433a;
  --color-danger-bg: #fbe8e6;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-md: 0 4px 16px rgba(30, 20, 10, 0.1);
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
}

/* ---------- Login ---------- */
#loginRoot.card {
  max-width: 380px;
  margin: 10vh auto 0;
}
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
}
.brand { text-align: center; margin-bottom: 20px; }
.brand h1 { font-size: 1.3rem; color: var(--color-primary); margin: 0; }
.brand small { display: block; color: var(--color-text-muted); font-size: 0.8rem; margin-top: 4px; }
label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 4px; margin-top: 12px; }
input {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--color-border);
  font-size: 1rem;
}
button {
  padding: 12px; border: none; border-radius: var(--radius-md);
  background: var(--color-primary); color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer;
}
#loginForm button { width: 100%; margin-top: 20px; }
button:hover { background: var(--color-primary-dark); }
button:disabled { opacity: 0.6; cursor: not-allowed; }
.error { background: var(--color-danger-bg); color: var(--color-danger); padding: 10px 12px; border-radius: var(--radius-md); font-size: 0.85rem; margin-top: 14px; }

/* ---------- Overview page ---------- */
.overview-page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.overview-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.overview-header h1 { font-size: 1.5rem; color: var(--color-primary); margin: 0; }
.overview-date { color: var(--color-text-muted); font-size: 0.9rem; margin: 4px 0 0; }
.logout-link { background: none; border: 1px solid var(--color-border); color: var(--color-text-muted); font-size: 0.85rem; cursor: pointer; padding: 8px 14px; border-radius: var(--radius-md); }
.logout-link:hover { background: var(--color-surface-alt); }

.business-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; }
.business-card {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-md);
}
.business-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.business-card-header .icon { font-size: 1.6rem; margin-right: 8px; }
.business-card-header h3 { display: inline; font-size: 1.15rem; margin: 0; }
.business-card-header .role { font-size: 0.72rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; margin-top: 4px; }
.open-link { color: var(--color-primary); font-weight: 700; font-size: 0.88rem; text-decoration: none; white-space: nowrap; }
.open-link:hover { text-decoration: underline; }

.loading { color: var(--color-text-muted); font-size: 0.85rem; padding: 10px 0; }

.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat {
  display: block; background: var(--color-surface-alt); border-radius: var(--radius-md); padding: 12px;
  text-decoration: none; color: inherit; transition: transform .08s, box-shadow .08s; cursor: pointer;
}
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-warn { background: var(--color-warning-bg); }
.stat-value { font-size: 1.4rem; font-weight: 700; }
.stat-warn .stat-value { color: var(--color-warning); }
.stat-label { font-size: 0.72rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; margin-top: 2px; }

.attention-block { margin-bottom: 12px; }
.attention-title { font-size: 0.78rem; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 6px; }
.attention-empty { display: block; font-size: 0.85rem; color: var(--color-text-muted); text-decoration: none; }
.attention-empty:hover { text-decoration: underline; }
.attention-row {
  display: flex; justify-content: space-between; font-size: 0.86rem; padding: 5px 4px; margin: 0 -4px;
  border-bottom: 1px solid var(--color-border); text-decoration: none; color: inherit; border-radius: 6px;
}
.attention-row:hover { background: var(--color-surface-alt); }
.attention-row:last-child { border-bottom: none; }
.attention-right { color: var(--color-text-muted); white-space: nowrap; margin-left: 10px; }
.attention-footnote { display: inline-block; font-size: 0.8rem; color: var(--color-text-muted); margin-top: 8px; text-decoration: none; }
.attention-footnote:hover { text-decoration: underline; }
.attention-warn { color: var(--color-warning); font-weight: 600; }

.empty { text-align: center; color: var(--color-text-muted); padding: 30px; }

@media (max-width: 500px) {
  .overview-header { flex-direction: column; gap: 12px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}
