:root {
  --cornflower: #6186FF;
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --border: #334155;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: 'Nunito', system-ui, sans-serif;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: 'Manrope', sans-serif; font-weight: 700; margin: 0 0 0.5em 0; }

button {
  font-family: inherit; font-size: 1rem;
  padding: 0.8em 1.2em; border: none; border-radius: 8px;
  cursor: pointer; background: var(--cornflower); color: white; font-weight: 600;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--danger); }

input, textarea, select {
  font-family: inherit; font-size: 1rem;
  padding: 0.7em; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-weight: 600; margin: 1em 0 0.3em 0; color: var(--muted); font-size: 0.9rem; }
label .required { color: var(--danger); }

#app { max-width: 640px; margin: 0 auto; padding: 1rem; padding-bottom: 6rem; }
#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 0.4em; }
.toast-pill {
  background: var(--surface); color: var(--text);
  padding: 0.6em 1.1em; border-radius: 999px; font-size: 0.85rem;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.toast-pill.error { border-color: var(--danger); }
.toast-pill.success { border-color: var(--success); }

.card {
  background: var(--surface); border-radius: 12px; padding: 1rem;
  margin-bottom: 0.8rem; border: 1px solid var(--border);
}
.card.incomplete { border-left: 4px solid var(--warning); }
.card.clickable { cursor: pointer; }
.card.clickable:active { transform: scale(0.99); }

.badge { display: inline-block; padding: 0.2em 0.6em; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.warning { background: var(--warning); color: #0f172a; }
.badge.success { background: var(--success); color: #0f172a; }

.fab {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  padding: 1em 2em; font-size: 1.05rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4); z-index: 50;
}

header.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.8rem 0; gap: 0.5rem;
}
header.app-header img.logo { height: 32px; }
header.app-header .actions { display: flex; gap: 0.5rem; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: flex-end; justify-content: center; z-index: 200;
}
.modal {
  background: var(--surface); border-radius: 16px 16px 0 0;
  padding: 1.5rem; width: 100%; max-width: 640px;
  max-height: 90vh; overflow-y: auto;
}

.big-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.5em;
  width: 100%; padding: 1.2em; font-size: 1.05rem; margin-bottom: 0.8em;
}

.sync-pill {
  position: fixed; top: 0.6rem; right: 0.8rem;
  font-size: 0.75rem; padding: 0.3em 0.7em; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); z-index: 90;
}
.sync-pill.online { border-color: var(--success); }
.sync-pill.offline { border-color: var(--danger); }
.sync-pill.syncing { border-color: var(--warning); }

.muted { color: var(--muted); font-size: 0.9rem; }
.row-flex { display: flex; gap: 0.5rem; }
.row-flex > * { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5em 0.3em; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }

details summary { cursor: pointer; padding: 0.5em 0; }
details pre { background: var(--bg); padding: 0.8em; border-radius: 6px; font-family: inherit; white-space: pre-wrap; }

.highlight-flash { animation: flash 1.5s ease; }
@keyframes flash { 0% { background: #334155; } 100% { background: var(--surface); } }
