:root {
  --navy: #16324f;
  --gold: #b8863b;
  --bg: #f6f5f2;
  --card-bg: #ffffff;
  --border: #e0ddd6;
  --text: #26241f;
  --muted: #6b675f;
  --error: #b3261e;
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }

.screen { min-height: 100vh; }

/* Login */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px;
  width: 320px;
  text-align: center;
}
.login-box h1 { font-size: 20px; margin-bottom: 24px; color: var(--navy); }
#login-form { display: flex; flex-direction: column; gap: 12px; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--navy);
  color: white;
}
.topbar h1 { font-size: 18px; margin: 0; }
.link-btn {
  background: none;
  border: none;
  color: white;
  text-decoration: underline;
  cursor: pointer;
  font-size: 14px;
}

/* Prompt grid */
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding: 32px;
  max-width: 1200px;
  margin: 0 auto;
}
.prompt-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.prompt-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.prompt-card .badge {
  display: inline-block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 8px;
}
.prompt-card h3 { margin: 0 0 8px; font-size: 16px; color: var(--navy); }
.prompt-card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 15, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal-box {
  background: white;
  border-radius: 10px;
  padding: 32px;
  width: 420px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}
.modal-wide { width: 640px; }
.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--muted);
}
.modal h2 { margin-top: 0; color: var(--navy); font-size: 18px; }
.modal-subtitle { color: var(--muted); font-size: 13px; margin-top: -8px; margin-bottom: 16px; }

input[type="text"], input[type="password"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 10px;
}
textarea { min-height: 90px; resize: vertical; }

button {
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}
button:hover { opacity: 0.92; }

.client-results { max-height: 220px; overflow-y: auto; margin-bottom: 8px; }
.client-result-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 14px;
}
.client-result-item:hover { background: #f2f0ea; }
.client-result-item .muted { color: var(--muted); font-size: 12px; }

.new-client-form { margin-top: 10px; }

.form-field { margin-bottom: 14px; }
.form-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--navy);
}
.form-field .hint { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form-field .required-mark { color: var(--error); }

.result-actions { margin-bottom: 12px; }
.result-text {
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  background: #f6f5f2;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  max-height: 55vh;
  overflow-y: auto;
}

.error { color: var(--error); font-size: 13px; }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 100;
}
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
