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

:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --primary: #1a1a2e;
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #ef4444;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Nav */
nav {
  background: var(--primary);
  color: #fff;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
nav .logo { font-weight: 700; font-size: 1.1rem; letter-spacing: .03em; }
nav a { color: #a5b4fc; text-decoration: none; font-size: .9rem; }
nav a:hover { color: #fff; }

/* Container */
.container { max-width: 900px; margin: 0 auto; padding: 2rem 1rem; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
}
.stat-card .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .4rem; }
.stat-card .value { font-size: 2rem; font-weight: 700; color: var(--accent); line-height: 1; }

/* Section headings */
h2 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 1rem; }

/* Table */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 2rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead tr { background: var(--bg); }
th, td { text-align: left; padding: .65rem 1.2rem; }
th { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
tbody tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--accent-light); }
.rel-time { color: var(--muted); font-size: .82rem; }

/* Chart bars */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 80px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .75rem 1rem; margin-bottom: 2rem; overflow-x: auto; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 28px; }
.bar { width: 20px; background: var(--accent); border-radius: 3px 3px 0 0; transition: opacity .15s; }
.bar:hover { opacity: .75; }
.bar-label { font-size: .6rem; color: var(--muted); white-space: nowrap; transform: rotate(-45deg); transform-origin: top right; }

/* Refresh button */
.toolbar { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
button.refresh {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: .45rem 1rem; font-size: .85rem; cursor: pointer;
}
button.refresh:hover { opacity: .85; }

/* Login */
.login-wrap {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 2.5rem 2rem; width: 100%; max-width: 360px;
}
.login-card h1 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.login-card label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.login-card input {
  width: 100%; padding: .55rem .75rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: .95rem; margin-bottom: 1rem;
}
.login-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login-card button {
  width: 100%; padding: .65rem; background: var(--accent); color: #fff;
  border: none; border-radius: 6px; font-size: 1rem; cursor: pointer;
}
.login-card button:hover { opacity: .85; }
.error { color: var(--danger); font-size: .85rem; margin-bottom: 1rem; }
