/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #F2EDE3;    /* warm cream — brand background */
  --surface:     #FDFEFE;    /* off-white */
  --border:      #ddd8ce;
  --text:        #11181C;    /* deep charcoal */
  --text-muted:  #5a6472;
  --accent:      #0A3143;    /* weathered teal — primary */
  --accent-hover:#0d3d52;
  --amber:       #FFBF00;    /* golden amber — highlight */
  --amber-hover: #E5AC00;
  --danger:      #c0392b;
  --radius:      10px;
  --shadow:      0 2px 12px rgba(0,0,0,0.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── Utilities ────────────────────────────────────────────── */
.hidden { display: none !important; }

.view { min-height: 100vh; }

.centered {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Login ────────────────────────────────────────────────── */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 48px;
  text-align: center;
  max-width: 420px;
  width: 100%;
}

.login-logo {
  width: 140px;
  height: 140px;
  margin: 0 auto 20px;
  display: block;
}

.login-card h1 {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
  color: var(--accent);
}

.login-card .tagline {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 6px;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.9rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn-google {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-size: 1rem;
}

.btn-google:hover { background: var(--bg); }

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 6px 12px;
}

.btn-ghost:hover { color: var(--text); background: var(--bg); }

/* Ghost button inside teal header needs white text */
header .btn-ghost {
  color: rgba(253,254,254,0.8);
}

header .btn-ghost:hover {
  color: #FDFEFE;
  background: rgba(255,255,255,0.12);
}

/* ── Header ───────────────────────────────────────────────── */
header {
  background: var(--accent);
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-icon {
  width: 30px;
  height: 30px;
  margin-right: 8px;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
}

.app-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
  color: #FDFEFE;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-email {
  font-size: 0.825rem;
  color: rgba(253,254,254,0.75);
}

/* ── Tab Nav ──────────────────────────────────────────────── */
.tab-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 12px 16px;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--amber);
}

.tab-btn:hover:not(.active) { color: var(--text); }

/* ── Main ─────────────────────────────────────────────────── */
main {
  max-width: 700px;
  margin: 0 auto;
  padding: 32px 20px;
}

.tab-section { width: 100%; }

.placeholder-message {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 0;
  font-size: 0.95rem;
}

/* ── Prompt Flow ──────────────────────────────────────────── */
.prompt-meta {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.prompt-progress {
  font-size: 0.825rem;
  color: var(--text-muted);
  background: var(--border);
  padding: 4px 12px;
  border-radius: 20px;
}

.prompt-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}

.prompt-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  border-left: 3px solid var(--amber);
  padding-left: 8px;
}

.prompt-question {
  font-size: 1.1rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 20px;
}

.prompt-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  transition: border-color 0.15s;
}

.prompt-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.prompt-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prompt-nav-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ── Success Card ─────────────────────────────────────────── */
.success-card {
  text-align: center;
  padding: 60px 20px;
}

.success-icon {
  width: 56px;
  height: 56px;
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.success-card h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.success-card p {
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ── History ──────────────────────────────────────────────── */
.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

.entry-header {
  width: 100%;
  background: none;
  border: none;
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  transition: background 0.15s;
}

.entry-header:hover { background: var(--bg); }

.entry-header-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.entry-date {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.entry-preview {
  font-size: 0.825rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-chevron {
  font-size: 1.3rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.entry-chevron.open { transform: rotate(90deg); }

.entry-body {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
}

.entry-content {
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}

.entry-actions {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-download {
  font-size: 0.825rem;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  font-size: 0.825rem;
  padding: 6px 14px;
  border-radius: 6px;
}

.btn-danger:hover { background: #a93226; }
.btn-danger:disabled { opacity: 0.6; cursor: default; }

.btn-danger-ghost {
  color: var(--danger);
  font-size: 0.825rem;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
}

.btn-danger-ghost:hover { background: #fdecea; color: var(--danger); }

.entry-delete-confirm {
  margin-top: 12px;
}

.delete-warning {
  font-size: 0.875rem;
  color: var(--danger);
  margin-bottom: 10px;
}

.delete-confirm-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Preferences ──────────────────────────────────────────── */
.prefs-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}

.prefs-heading {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.prefs-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--amber);
  width: 16px;
  height: 16px;
}

.radio-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.radio-label strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.radio-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.prefs-note {
  font-size: 0.825rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 8px;
}

.prefs-danger-zone {
  border-color: #f5c6c6;
}

/* ── Admin View ───────────────────────────────────────────── */
.admin-heading {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.admin-note {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.admin-note code {
  background: var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.825rem;
}

.admin-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin-bottom: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.admin-cell {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.admin-cell-count {
  font-weight: 600;
  color: var(--accent);
}

.admin-loading {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
}
