:root {
  --ink: #22282b;
  --muted: #6b7573;
  --line: #e2e6e4;
  --accent: #4c6ef5;
  --bg: #f5f6f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  cursor: pointer;
}

input, select {
  font: inherit;
}

/* ---------- Login ---------- */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: white;
  border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.login-card h1 {
  font-size: 20px;
  margin: 0 0 20px;
  text-align: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.field input, .field select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.primary-button {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.error-text {
  color: #d64545;
  font-size: 13px;
  margin: -6px 0 12px;
  min-height: 16px;
}

.ms-signin {
  display: block;
  text-align: center;
  text-decoration: none;
}

/* ---------- App shell ---------- */

#app { min-height: 100vh; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: white;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.app-header h1 {
  font-size: 16px;
  margin: 0;
}

.app-header .who {
  font-size: 13px;
  color: var(--muted);
}

.logout-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
}

.tab-bar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: white;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.tab-button.is-active {
  background: var(--bg);
  color: var(--ink);
}

.view-content {
  padding: 14px 16px 90px;
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- Calendar view ---------- */

.range-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.range-nav button {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 6px 12px;
}

.range-nav .range-label {
  font-weight: 600;
}

.day-group {
  margin-bottom: 16px;
}

.day-group h3 {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.event-card {
  background: white;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 4px solid var(--accent-color, var(--accent));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.event-card .event-time {
  font-size: 12px;
  color: var(--muted);
}

.event-card .event-title {
  font-weight: 600;
}

.event-card .event-location {
  font-size: 12px;
  color: var(--muted);
}

.event-card.is-editable { cursor: pointer; }

.empty-note {
  color: var(--muted);
  font-size: 14px;
  padding: 12px 0;
}

.fab {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 28px;
  border: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  line-height: 1;
}

/* ---------- Agenda view ---------- */

.member-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
  padding-bottom: 2px;
}

.member-chip {
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 7px 14px;
  white-space: nowrap;
  font-weight: 600;
}

.member-chip.is-active {
  background: var(--accent-color, var(--accent));
  color: white;
  border-color: transparent;
}

.date-picker {
  margin-bottom: 14px;
}

.date-picker input {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.agenda-item {
  display: flex;
  gap: 12px;
  background: white;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.agenda-item .agenda-time {
  min-width: 64px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.agenda-item .agenda-kind {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}

.modal {
  width: 100%;
  max-width: 480px;
  background: white;
  border-radius: 16px 16px 0 0;
  padding: 16px;
  max-height: 96vh;
  overflow-y: auto;
}

@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 16px; }
}

.modal h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.modal .field { margin-bottom: 8px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.checkbox-row input { width: auto; }

.time-row {
  display: flex;
  gap: 10px;
}

.time-row .field { flex: 1; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.modal-actions button {
  flex: 1;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}

.modal-actions .primary-button { border: none; }

.modal-actions .danger {
  color: #d64545;
  border-color: #f0c8c8;
}

.location-field {
  position: relative;
}

.location-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.location-suggestion {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.location-suggestion:last-child {
  border-bottom: none;
}

.location-suggestion:hover {
  background: var(--bg);
}

/* ---------- Settings (admin accounts) ---------- */

.settings-intro {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 14px;
}

.accounts-table {
  margin-bottom: 20px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.account-row .account-email {
  flex: 1;
  font-weight: 600;
  word-break: break-all;
}

.admin-badge {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  margin-left: 6px;
}

.account-row .remove-account {
  border: 1px solid #f0c8c8;
  color: #d64545;
  background: white;
  border-radius: 8px;
  padding: 6px 10px;
}

.account-row .edit-account {
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 6px 10px;
}

.edit-account-form {
  width: 100%;
}

.add-account-form {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.add-account-form h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

