:root {
  --wine: #7b1e3a;
  --wine-deep: #5a1529;
  --gold: #c9a227;
  --gold-soft: rgba(201,162,39,0.15);
  --graphite: #2b2b2b;
  --bg: #0f0c0b;
  --card: #1c1613;
  --card-border: #2f2621;
  --text: #f2ece6;
  --muted: #9c9088;
  --danger: #b5533f;
  --success: #3b8a52;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { overflow-x: hidden; max-width: 100vw; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 40px;
}

h1, h2, h3, .headline { font-family: 'Playfair Display', Georgia, serif; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
  border-bottom: 1px solid #201a17;
}
.topbar-title {
  font-size: 15px;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 12px;
}
.topbar-spacer { flex: 1; }
.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  padding: 4px 8px;
  line-height: 1;
  cursor: pointer;
}
.energy-preset.active { background: var(--gold); color: #211705; border-color: var(--gold); font-weight: 700; }

/* ---------- Sidebar drawer ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: 280px;
  max-width: 84vw;
  background: #140f0d;
  border-right: 1px solid #241d19;
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  padding: 18px 16px;
}
.sidebar.open { transform: translateX(0); }

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px;
  border: 1px solid var(--gold);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  border-radius: 8px;
}
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: 0.08em; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: 0.12em; }

.create-btn {
  background: var(--gold);
  color: #211705;
  border: none;
  font-weight: 700;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 22px;
}

.nav-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 8px;
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 11px 10px;
  border-radius: 10px;
  font-size: 15px;
}
.side-link.active { background: rgba(201,162,39,0.1); color: var(--gold); }
.side-icon { width: 18px; display: inline-block; text-align: center; opacity: 0.8; }
.side-link .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  background: #241d19;
  padding: 1px 7px;
  border-radius: 999px;
}
.side-link.active .count { color: var(--gold); }

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid #241d19; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--wine);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; }
.user-status { font-size: 11px; color: var(--muted); }
.user-status.connected { color: var(--success); }

/* ---------- Main content ---------- */
main { padding: 18px 16px 0; }

.greeting-block { margin-bottom: 18px; }
.greeting-date {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}
.greeting-title {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 8px;
}
.greeting-sub { color: var(--muted); font-size: 13.5px; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
}
.stat-num { font-size: 22px; font-weight: 700; font-family: 'Playfair Display', serif; }
.stat-label { font-size: 12.5px; color: var(--text); margin-top: 2px; }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px 17px;
  margin-bottom: 12px;
}
.card h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.card .meta { color: var(--muted); font-size: 13px; margin-bottom: 4px; }

.progress-bar { height: 6px; border-radius: 3px; background: #332721; overflow: hidden; margin-top: 10px; }
.progress-bar > div { height: 100%; background: var(--gold); }

.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #241d19;
}
.task-row:last-child { border-bottom: none; }
.task-row.done { opacity: 0.4; }
.task-row.done .t-title { text-decoration: line-through; }
.task-row input[type=checkbox] {
  width: 22px; height: 22px;
  accent-color: var(--gold);
  flex-shrink: 0;
}
.task-row .t { flex: 1; }
.t-title { font-size: 14.5px; font-weight: 500; }
.t-meta { color: var(--muted); font-size: 12px; margin-top: 1px; }
.task-row .time { color: var(--muted); font-size: 12px; }

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  margin-bottom: 8px;
}

.gcal-btn {
  display: block;
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
  margin: 4px 0 18px;
}
.gcal-btn.connected { border-color: var(--success); color: var(--success); }

.empty { color: var(--muted); text-align: center; padding: 50px 0; font-size: 14px; }

.section-title {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 16px;
}

/* ---------- Clickable cards ---------- */
.stat-card, .card.clickable { cursor: pointer; transition: border-color 0.15s; }
.stat-card:active, .card.clickable:active { border-color: var(--gold); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-sheet {
  background: #17110f;
  border: 1px solid var(--card-border);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px 18px 28px;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title { font-size: 20px; font-weight: 700; font-family: 'Playfair Display', serif; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 22px; padding: 4px 8px; }

.detail-row { padding: 10px 0; border-bottom: 1px solid #241d19; }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 3px; }
.detail-value { font-size: 14.5px; }

.detail-section-title { font-size: 13px; font-weight: 700; color: var(--gold); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: 0.06em; }

.action-list { display: flex; flex-direction: column; gap: 10px; }
.action-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 15px;
  text-align: left;
}
.action-item .a-icon { font-size: 20px; width: 26px; text-align: center; }
.action-item .a-title { font-weight: 600; font-size: 15px; }
.action-item .a-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: block; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: #0f0c0b;
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14.5px;
  font-family: inherit;
}
.form-textarea { min-height: 72px; resize: vertical; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-primary {
  width: 100%;
  background: var(--gold);
  color: #211705;
  border: none;
  font-weight: 700;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  margin-top: 6px;
}
.btn-secondary {
  width: 100%;
  background: none;
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  margin-top: 8px;
}

.settings-block { margin-bottom: 22px; }
.settings-label { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.08em; margin-bottom: 8px; }
.type-chip {
  display: inline-block;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--card-border);
  margin: 0 6px 6px 0;
}

/* ---------- Creative Navigator wizard ---------- */
.wizard-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.wizard-ring {
  width: 56px; height: 56px; border-radius: 50%;
  border: 3px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--gold);
  flex-shrink: 0;
}
.wizard-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
}
.wizard-step {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--card-border);
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.wizard-step.active { border-color: var(--gold); color: var(--gold); }
.wizard-step.done { color: var(--success); }
.wizard-step .n { width: 18px; height: 18px; border-radius: 50%; border: 1px solid currentColor; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }

.wizard-num {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--gold-soft);
  color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
  margin-bottom: 10px;
}
.wizard-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.wizard-title { font-size: 24px; font-weight: 700; font-family: 'Playfair Display', serif; margin: 4px 0 8px; }
.wizard-hint { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

.dna-box {
  display: flex; gap: 10px;
  background: rgba(201,162,39,0.08);
  border: 1px solid rgba(201,162,39,0.25);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.prompt-output {
  background: #0a0807;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: #d8cfc5;
  margin: 12px 0;
  max-height: 320px;
  overflow-y: auto;
}

.wizard-nav { display: flex; gap: 10px; margin-top: 16px; }
.wizard-nav .btn-secondary, .wizard-nav .btn-primary { margin-top: 0; }

/* ---------- Department AI console ---------- */
.chat-scroll {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px 2px 10px;
  margin-bottom: 10px;
}
.chat-bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--gold-soft);
  color: var(--text);
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-bottom-left-radius: 4px;
}
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 100px;
}
.chat-send-btn {
  background: var(--gold);
  color: #211705;
  border: none;
  border-radius: 10px;
  padding: 0 18px;
  font-weight: 700;
}
.ai-disconnected {
  background: rgba(181,83,63,0.1);
  border: 1px solid rgba(181,83,63,0.3);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ---------- Internal Calendar ---------- */
.cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.cal-nav-btn {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 16px;
}
.cal-title { font-size: 20px; font-weight: 700; font-family: 'Playfair Display', serif; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 18px;
  width: 100%;
}
.cal-weekday {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  padding-bottom: 6px;
}
.cal-day {
  aspect-ratio: 1;
  min-width: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid transparent;
  font-size: 12px;
  gap: 2px;
  position: relative;
  overflow: hidden;
}
.cal-day.empty { background: none; }
.cal-day.today { border-color: var(--gold); }
.cal-day.selected { background: var(--gold); color: #211705; font-weight: 700; }
.cal-day-dots { display: flex; gap: 2px; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }
.cal-day.selected .cal-dot { background: #211705; }
.cal-dot.done { background: var(--success); }

.cal-selected-label {
  font-size: 15px; font-weight: 700;
  margin-bottom: 10px;
  text-transform: capitalize;
}

