*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3250;
  --accent: #5b8dee;
  --accent-hover: #4a7de0;
  --danger: #e05b5b;
  --danger-hover: #c94a4a;
  --text: #e2e4f0;
  --text-muted: #7880a0;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 72px; /* action bar height */
}

/* ── Header ─────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.global-settings {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.global-settings label {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.global-settings input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}

.global-settings input:focus {
  border-color: var(--accent);
}

/* ── Main / card grid ────────────────────────────────────── */
main {
  padding: 24px;
  flex: 1;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  margin-top: 80px;
  font-size: 15px;
}

.hidden {
  display: none !important;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s;
}

.card:focus-within {
  border-color: var(--accent);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.btn-delete:hover {
  color: var(--danger);
  background: rgba(224, 91, 91, 0.1);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.field input,
.field textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s;
  font-family: "SF Mono", "Fira Code", "Menlo", monospace;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
}

.field textarea {
  min-height: 68px;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field-inline label {
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}

.field-inline input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* ── Status bar ──────────────────────────────────────────── */
.status-bar {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  z-index: 100;
  box-shadow: var(--shadow);
  max-width: 90vw;
  text-align: center;
}

.status-bar.error {
  border-color: var(--danger);
  color: var(--danger);
}

.status-bar.success {
  border-color: #5be08a;
  color: #5be08a;
}

/* ── Action bar ──────────────────────────────────────────── */
.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px;
  z-index: 50;
}

.btn {
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 20px;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}
