:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #d7dee8;
  --text: #1c2838;
  --muted: #5e6d82;
  --blue: #1a56db;
  --blue-press: #1548b8;
  --ok: #0d7a45;
  --bad: #c62828;
  --warn: #9a6700;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 10px 30px rgba(28,40,56,.08);
  text-align: center;
}
.brand-logo { height: 48px; width: auto; margin: 0 0 14px; }
.brand-logo-sm { height: 32px; width: auto; }
.login-card h1 { margin: 0 0 4px; font-size: 1.3rem; }
.login-card .muted { margin: 0 0 18px; }
.login-card input {
  width: 100%; box-sizing: border-box; margin: 0 0 10px; padding: 12px 12px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 1rem;
}
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 11px 16px; cursor: pointer; font-weight: 600;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:active { background: var(--blue-press); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.full { width: 100%; }
.error-text { color: var(--bad); font-size: .9rem; min-height: 1.2em; margin-top: 6px; }

.screen { min-height: 100vh; padding: calc(12px + env(safe-area-inset-top)) 16px 40px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.brand-row { display: flex; align-items: center; gap: 10px; }
.topbar h1 { margin: 0; font-size: 1.1rem; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 16px; cursor: pointer; font-weight: 600; color: var(--muted);
}
.tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; margin-bottom: 16px;
}
.panel h2 { margin: 0 0 12px; font-size: 1rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 600; }
.pill.ok { background: #e7f6ee; color: var(--ok); }
.pill.bad { background: #fdeaea; color: var(--bad); }

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

.modal-overlay {
  position: fixed; inset: 0; background: rgba(28,40,56,.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-card {
  width: 100%; max-width: 420px; background: var(--card); border-radius: 14px;
  padding: 20px; max-height: 90vh; overflow: auto;
}
.modal-card h2 { margin: 0 0 14px; font-size: 1.05rem; }
.modal-card label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
.modal-card input { width: 100%; box-sizing: border-box; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: .9rem; opacity: 0; transition: all .2s; pointer-events: none; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
