:root {
  --blue: #0038a8;
  --red: #ce1126;
  --yellow: #fcd116;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* Auth screen */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--blue), var(--red));
}

.auth-card {
  background: var(--card);
  padding: 2.5rem;
  border-radius: var(--radius);
  width: 380px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.auth-card h1 { margin: 0; font-size: 1.8rem; }
.tagline { color: var(--muted); margin-top: 0.25rem; margin-bottom: 1.5rem; }

.form input, .form select {
  width: 100%;
  padding: 0.7rem;
  margin-bottom: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
}

.form button {
  width: 100%;
  padding: 0.75rem;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

.form button:hover { opacity: 0.9; }

.switch { text-align: center; color: var(--muted); font-size: 0.9rem; }
.switch a { color: var(--blue); cursor: pointer; text-decoration: underline; }
.error { color: var(--red); font-size: 0.85rem; min-height: 1.2rem; }

/* App screen */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--card);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

header h1 { margin: 0; font-size: 1.4rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.ws-status { font-size: 0.8rem; color: var(--red); }
.ws-status.online { color: #16a34a; }

button.ghost {
  background: none;
  border: 1px solid #d1d5db;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
}

main {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

.card .label { color: var(--muted); font-size: 0.85rem; }
.card .value { font-size: 1.6rem; font-weight: 700; margin-top: 0.3rem; }

.payday-cycle, .add-expense, .expense-list {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.payday-cycle h3, .add-expense h3, .expense-list h3 { margin-top: 0; }

.cycle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  text-align: center;
}

.cycle-grid > div {
  background: var(--bg);
  border-radius: 8px;
  padding: 1rem;
}

.expense-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.expense-form input, .expense-form select {
  padding: 0.6rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}

.vat-check {
  grid-column: span 2;
  font-size: 0.9rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.expense-form button {
  grid-column: span 2;
  padding: 0.75rem;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.6rem; border-bottom: 1px solid #eef0f4; font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; }
td button {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 0.85rem;
}
