:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #d6dae2;
  --accent: #4c6ef5;
  --accent-hover: #3b5bdb;
  --danger: #e03131;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 25, 40, .06), 0 6px 20px rgba(20, 25, 40, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
}
.app-header h1 {
  margin: 0;
  font-size: 2.2rem;
  letter-spacing: -0.02em;
}

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

/* Fields */
.controls, .amounts {
  display: flex;
  gap: 1.25rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.amounts { margin-top: 1.25rem; }
.field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.field-label {
  font-size: .95rem;
  font-weight: 600;
  color: var(--muted);
}
.muted { font-weight: 400; color: var(--muted); }
.field-refresh { align-self: flex-end; }

input, select {
  font: inherit;
  font-size: 1.05rem;
  padding: .6rem .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-width: 190px;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 110, 245, .15);
}
input:disabled { background: #f3f4f7; color: var(--muted); }

/* Buttons */
.btn {
  font: inherit;
  font-size: 1rem;
  padding: .6rem 1.15rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { background: #b6c2f5; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: #fff; border-color: #f1b0b0; color: var(--danger); font-size: .9rem; padding: .4rem .8rem; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

#add-form { margin-top: 1.5rem; }

/* Rate info */
.rate-info {
  min-height: 1.5em;
  margin: 1.25rem 0 0;
  padding: .85rem 1rem;
  background: #f0f4ff;
  border: 1px solid #dbe4ff;
  border-radius: 8px;
  color: #364fc7;
  font-size: 1rem;
}
.rate-info:empty { display: none; }

/* Banner */
.banner {
  padding: .85rem 1.1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-weight: 500;
}
.banner-error { background: #fff0f0; border: 1px solid #ffc9c9; color: var(--danger); }

/* Table */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 1rem;
}
th, td {
  padding: .8rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th {
  background: #f7f8fb;
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafbff; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.empty td { text-align: center; color: var(--muted); padding: 1.5rem; }

/* Inline szerkeszthető email cella */
.email-cell { padding: .4rem .6rem; }
.email-edit {
  min-width: 180px;
  font-size: .95rem;
  padding: .4rem .55rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
}
.email-edit:hover { border-color: var(--border); }
.email-edit:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 110, 245, .15);
}
.email-edit.saved { border-color: #37b24d; background: #ebfbee; }
.email-edit.save-error { border-color: var(--danger); background: #fff0f0; }

/* Login */
.login {
  max-width: 380px;
  margin: 12vh auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}
.login h1 { margin: 0 0 1.25rem; font-size: 1.8rem; }
.login label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--muted);
  font-size: .95rem;
}
.login input { width: 100%; margin-top: .35rem; }
.login .btn, .login button {
  width: 100%;
  font-size: 1.05rem;
  padding: .7rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.login button:hover { background: var(--accent-hover); }
.error { color: var(--danger); font-weight: 500; }

@media (max-width: 640px) {
  .page { padding: 1.5rem 1rem 3rem; }
  .app-header h1 { font-size: 1.7rem; }
  input, select { min-width: 0; width: 100%; }
  .field { flex: 1 1 100%; }
}
