:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #cbd5e1;
  --success: #16a34a;
  --danger: #dc2626;
  --sidebar: #0f172a;
}

* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 16px;
}

.hidden { display: none !important; }

h1, h2 { color: var(--primary); margin: 0 0 8px; }
h2 { font-size: 18px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  margin-bottom: 16px;
}

label {
  display: block;
  font-weight: 600;
  margin-top: 12px;
  font-size: 14px;
}

input, select {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  background: #fff;
  color: inherit;
}

input:focus, select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 16px;
  font-size: 16px;
  font-family: inherit;
}

button:hover { background: var(--primary-dark); }
button:disabled { opacity: 0.6; cursor: default; }

.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: -16px;
  padding: 16px;
}

.login-card { width: 100%; max-width: 380px; margin-bottom: 0; }

.error {
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
  margin: 12px 0 0;
}

.switch-line {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

.link-btn {
  width: auto;
  margin: 0 0 0 6px;
  padding: 0;
  background: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
}

.link-btn:hover { background: none; color: var(--primary-dark); }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 4px 16px;
}

.brand { font-weight: 700; color: var(--primary); font-size: 18px; }
#topbarUser { margin-left: auto; }

.icon-btn {
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.icon-btn:hover { background: #e2e8f0; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--sidebar);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  z-index: 30;
}

.sidebar.open { transform: translateX(0); }

.nav-item {
  margin: 0;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  font-size: 15px;
  padding: 14px 16px;
  border-radius: 8px;
}

.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-exit { margin-top: auto; color: #fca5a5; }
.nav-exit:hover { background: #7f1d1d; color: #fff; }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 20;
}

.container { max-width: 720px; margin: 0 auto; }

.summary {
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 13px;
}

th, td {
  border: 1px solid var(--border);
  padding: 8px;
  text-align: left;
}

th { background: #f1f5f9; }

td.num { text-align: right; white-space: nowrap; }

.btn-delete {
  width: auto;
  margin: 0;
  padding: 6px 10px;
  font-size: 13px;
  background: transparent;
  color: var(--danger);
  border: 1px solid currentColor;
}

.btn-delete:hover { background: var(--danger); color: #fff; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 40;
  max-width: calc(100vw - 32px);
}

.toast.bad { background: var(--danger); }

@media (min-width: 900px) {
  body { padding-left: 276px; }

  .sidebar { transform: none; }

  .icon-btn { display: none; }

  .scrim { display: none !important; }
}
