/*


 */

/* ===== Atlantic City, 1921 ===== */
:root {
  --gold: #c9a84c;
  --gold-light: #e8d5a3;
  --gold-dark: #a07e2e;
  --brass: #b5873a;
  --mahogany: #1c0f08;
  --mahogany-light: #2e1a10;
  --walnut: #3b2314;
  --bourbon: #4a2c17;
  --smoke: #2a2226;
  --smoke-light: #3d3438;
  --velvet: #4a1528;
  --cream: #f0e6d3;
  --cream-dark: #ddd0ba;
  --parchment: #f7f0e3;
  --ivory: #faf5ec;
  --ink: #1a0e08;
  --red: #8b2500;
  --green: #2e4a30;
  --green-light: #3a6a3e;
  --ocean: #1a3a4a;
  --ocean-light: #2a5a6a;
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: Georgia, "Times New Roman", serif;
  --font-accent: Georgia, "Times New Roman", serif;
  --radius: 2px;
  --shadow: 0 2px 8px rgba(28, 15, 8, 0.15);
  --shadow-heavy: 0 4px 16px rgba(28, 15, 8, 0.25);
}

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

html { font-size: 15px; }

body {
  font-family: var(--font-body);
  background: var(--parchment);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(221, 208, 186, 0.4) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 20%, rgba(221, 208, 186, 0.3) 0%, transparent 60%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 40px,
      rgba(160, 126, 46, 0.03) 40px,
      rgba(160, 126, 46, 0.03) 41px
    );
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  font-size: 0.95rem;
}

a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h2 {
  font-size: 1.3rem;
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
}

h3 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  letter-spacing: 0.03em;
}

/* ===== Top Bar — The Boardwalk ===== */
.top-bar {
  background: linear-gradient(180deg, var(--mahogany) 0%, var(--mahogany-light) 100%);
  border-bottom: 3px solid var(--gold);
  padding: 0 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.top-bar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.logo-img {
  width: 34px;
  height: 34px;
  border-radius: 2px;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--gold) !important;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: bold;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  line-height: 1;
}

.logo-sub {
  display: block;
  font-size: 0.52rem;
  letter-spacing: 0.35em;
  color: var(--gold-light);
  text-align: center;
  opacity: 0.7;
  margin-top: 1px;
}

.main-nav { display: flex; gap: 0.15rem; flex: 1; }

.nav-link {
  color: var(--cream-dark) !important;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: var(--font-accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--gold) !important;
  background: rgba(201, 168, 76, 0.1);
}

.nav-link.active {
  color: var(--gold) !important;
  border-bottom: 2px solid var(--gold);
}

.user-menu { display: flex; align-items: center; gap: 1rem; }
.user-name { color: var(--cream-dark); font-size: 0.85rem; }

/* ===== Main Content ===== */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mahogany);
  background-image: url(https://kessler-assets.s3.us-west-2.amazonaws.com/assets/boardwalk-e671cdf9d7734607fb2ada76118460404ef484f80427874a6946bff1366a9d2d.jpg);
  background-size: cover;
  background-position: center;
  position: relative;
}

.auth-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(28, 15, 8, 0.6) 0%, rgba(28, 15, 8, 0.85) 100%);
}

.auth-content {
  max-width: 440px;
  width: 100%;
  padding: 2.5rem 3rem;
  background: rgba(247, 240, 227, 0.96);
  border: 1px solid var(--cream-dark);
  border-top: 3px solid var(--gold);
  box-shadow: var(--shadow-heavy), 0 0 60px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.auth-logo {
  display: block;
  width: 80px;
  height: 80px;
  margin: 0 auto 1.25rem;
}

.auth-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--ink);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.auth-subtitle {
  text-align: center;
  font-family: var(--font-accent);
  font-style: italic;
  color: var(--bourbon);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0;
  color: var(--bourbon);
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid var(--bourbon);
  opacity: 0.4;
}

.auth-divider span {
  padding: 0 0.75rem;
}

/* ===== Flash Messages ===== */
.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  border-left: 3px solid;
  font-family: var(--font-accent);
  font-style: italic;
}

.flash-notice { background: #eef3ee; border-color: var(--green); color: var(--green); }
.flash-alert { background: #f8eeeb; border-color: var(--red); color: var(--red); }

/* ===== Cards — Nucky's Desk ===== */
.card {
  background: var(--ivory);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--cream-dark);
}

.card-header h2, .card-header h3 {
  margin-bottom: 0;
  font-style: italic;
}

/* ===== Section Headers ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 3px double var(--gold);
}

/* ===== Buttons — Brass Fixtures ===== */
.btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: var(--font-accent);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: var(--mahogany);
  border-color: var(--gold-dark);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
  color: var(--mahogany);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
  background: linear-gradient(180deg, var(--walnut) 0%, var(--mahogany-light) 100%);
  color: var(--cream);
  border-color: var(--mahogany);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.btn-secondary:hover {
  background: linear-gradient(180deg, var(--bourbon) 0%, var(--walnut) 100%);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover { background: var(--red); color: var(--cream); }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.75rem; }

/* ===== Tables — The Ledger ===== */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 0.7rem;
  font-family: var(--font-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bourbon);
  padding: 0.5rem 0.75rem;
  border-bottom: 2px solid var(--cream-dark);
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--cream-dark);
  font-size: 0.9rem;
}

tr:hover td { background: var(--cream); }

/* ===== Status Badges — Lapel Pins ===== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 1px;
  font-size: 0.7rem;
  font-family: var(--font-accent);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}

.badge-active { background: var(--green); color: var(--cream); border-color: var(--green-light); }
.badge-reauth { background: var(--red); color: var(--cream); animation: pulse 2s ease-in-out infinite; }

/* ===== Reauth Alert — Trouble at the Office ===== */
.reauth-alert {
  background: linear-gradient(135deg, #3a1008 0%, #5a1a0a 100%);
  color: var(--cream);
  padding: 0.85rem 1.1rem;
  margin: -1.5rem -1.5rem 1.25rem -1.5rem;
  border-bottom: 2px solid var(--red);
  font-family: var(--font-accent);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.reauth-alert strong {
  color: #f0a090;
}

.btn-reauth {
  background: var(--red);
  color: var(--cream);
  border-color: #a03010;
  margin-left: auto;
  white-space: nowrap;
}

.btn-reauth:hover {
  background: #a03010;
  color: #fff;
}
.badge-disabled { background: var(--smoke); color: var(--cream-dark); }
.badge-archive { background: var(--cream-dark); color: var(--walnut); border-color: var(--brass); }
.badge-fyi { background: var(--ocean); color: var(--cream); border-color: var(--ocean-light); }
.badge-action-required { background: var(--gold); color: var(--mahogany); border-color: var(--gold-dark); }
.badge-spam { background: var(--velvet); color: var(--cream); }
.badge-pending { background: var(--gold-light); color: var(--walnut); border-color: var(--gold); }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-family: var(--font-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bourbon);
  margin-bottom: 0.4rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--cream-dark);
  border-bottom: 2px solid var(--brass);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--ivory);
  color: var(--ink);
  box-shadow: inset 0 1px 4px rgba(28, 15, 8, 0.08);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  border-bottom-color: var(--gold);
  box-shadow: inset 0 1px 4px rgba(28, 15, 8, 0.08), 0 0 0 2px var(--gold-light);
}

.form-group input::placeholder {
  color: var(--cream-dark);
  font-style: italic;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.form-check label {
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.btn-full {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.9rem;
}

/* ===== Model Config Rows ===== */
.model-config-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--cream-dark);
}

.model-config-row:last-child { border-bottom: none; }

.model-config-purpose {
  min-width: 110px;
  font-family: var(--font-accent);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
}

.model-config-fields {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.model-config-fields select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--cream-dark);
  border-bottom: 2px solid var(--brass);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--ivory);
  color: var(--ink);
}

.model-config-fields select:first-child { flex: 1; }
.model-config-fields select:nth-child(2) { flex: 2; }

.autosave-status {
  font-size: 0.75rem;
  font-family: var(--font-accent);
  font-style: italic;
  min-width: 40px;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; }

  /* Nav stacks on mobile */
  .top-bar-inner {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .main-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }

  .user-menu { display: none; }

  /* Main content tighter on mobile */
  .main-content { padding: 0.5rem; }
  .section-header { flex-direction: column; gap: 0.5rem; }

  /* Chat takes more vertical space on mobile */
  #chat-messages { max-height: 60vh; }

  .chat-input-bar {
    position: sticky;
    bottom: 0;
    background: var(--ivory);
    z-index: 10;
  }

  /* Tables scroll horizontally on mobile */
  .card-full { overflow-x: auto; }
  table { min-width: 600px; }

  /* Hero compact on mobile */
  .hero-banner { padding: 1rem; }
  .hero-banner h1 { font-size: 1.3rem; }

  /* Briefing image smaller */
  .briefing-header-img { max-height: 120px; }

  /* Audit tabs scroll */
  .audit-tabs { overflow-x: auto; }
  .audit-filters { overflow-x: auto; flex-wrap: nowrap; }
}

.dashboard-grid .card-full { grid-column: 1 / -1; }

/* ===== Empty States ===== */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--bourbon);
  font-family: var(--font-accent);
  font-style: italic;
}

/* ===== Art Deco Dividers ===== */
.deco-divider {
  text-align: center;
  margin: 1.25rem 0;
  color: var(--gold);
  font-size: 0.85rem;
  font-family: var(--font-accent);
  letter-spacing: 0.3em;
}

.deco-divider::before,
.deco-divider::after {
  content: "";
  display: inline-block;
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  vertical-align: middle;
  margin: 0 0.75rem;
}

/* ===== Deco Diamond Pattern — used on section breaks ===== */
.deco-diamond {
  text-align: center;
  margin: 1.5rem 0;
  color: var(--gold);
  font-size: 0.6rem;
  letter-spacing: 0.5em;
}

.deco-diamond::before { content: "\25C6 \25C6 \25C6"; }

/* ===== Boardwalk Hero — login and dashboard header ===== */
.hero-banner {
  background: var(--mahogany);
  background-image: url(https://kessler-assets.s3.us-west-2.amazonaws.com/assets/pattern-19ba35e5a470477ce992340411c2183f1503c76912cdcbe362cae158564fc0f3.jpg);
  background-size: 200px;
  color: var(--cream);
  padding: 2.5rem 2rem;
  margin: -1.5rem -1.5rem 1.5rem -1.5rem;
  border-bottom: 3px solid var(--gold);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(28, 15, 8, 0.55) 0%, rgba(28, 15, 8, 0.7) 100%);
  pointer-events: none;
}

.hero-banner h1 {
  color: #fff;
  font-size: 1.6rem;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  margin-bottom: 0.25rem;
  position: relative;
  z-index: 1;
}

.hero-banner .subtitle {
  color: var(--gold-light);
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 0.95rem;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

.hero-banner .deco-diamond {
  position: relative;
  z-index: 1;
}

/* ===== Briefing Content ===== */
.briefing-header-img {
  width: 100%;
  max-height: 330px;
  object-fit: cover;
  object-position: center 40%;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.briefing-content {
  font-family: var(--font-accent);
  line-height: 1.7;
  color: var(--ink);
}

.briefing-content p { margin-bottom: 0.75rem; }

.briefing-content ul {
  margin: 0.5rem 0 1rem 1.5rem;
  padding: 0;
  list-style: disc;
}

.briefing-content li {
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

.briefing-section-header {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--gold-dark);
  margin: 1.25rem 0 0.4rem 0;
  letter-spacing: 0.02em;
}

.briefing-generating {
  text-align: center;
  padding: 2rem 1rem;
}

.generating-text {
  font-family: var(--font-accent);
  font-style: italic;
  color: var(--gold-dark);
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.generating-spinner {
  width: 20px;
  height: 20px;
  margin: 0 auto;
  border: 2px solid var(--gold-light);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ===== Code/Mono ===== */
code {
  font-size: 0.85em;
  background: var(--cream);
  padding: 0.15em 0.4em;
  border-radius: 2px;
  color: var(--bourbon);
}

/* ===== Triage Live Status ===== */
.triage-status-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: var(--mahogany);
  color: var(--gold-light);
  border-radius: var(--radius);
  border-left: 3px solid var(--gold);
  font-family: var(--font-accent);
  font-style: italic;
  font-size: 0.9rem;
}

.triage-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--gold-light);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.row-pulse {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.form-hint {
  display: block;
  margin-top: 0.25rem;
  color: var(--brass);
  font-style: italic;
}

/* ===== Sortable table headers ===== */
th a {
  color: var(--gold-dark);
  text-decoration: none;
}
th a:hover { color: var(--gold); }

/* ===== Card header with multiple actions ===== */
.card-header-actions {
  display: flex;
  gap: 0.4rem;
}

/* Keep button_to inline forms from adding height in table cells */
td.form-actions {
  display: table-cell;
  margin: 0;
  gap: 0.4rem;
  white-space: nowrap;
  vertical-align: middle;
}

td.form-actions form,
td.form-actions a {
  display: inline;
  margin: 0 0.2rem;
}

td.form-actions form button {
  vertical-align: middle;
}

/* Ensure button_to buttons match link_to btn sizing in headers and cells */
.card-header form button.btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

/* ===== Triage run summary ===== */
.triage-run-summary {
  padding: 1rem;
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.triage-run-stat {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* ===== Rationale rows ===== */
.rationale-row td {
  padding-top: 0;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--cream-dark);
}

.rationale-text {
  color: var(--brass);
  font-style: italic;
  line-height: 1.4;
}

/* ===== Audit Log ===== */
.audit-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--gold);
}

.audit-tab {
  padding: 0.6rem 1.25rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--brass);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.audit-tab:hover {
  color: var(--gold);
}

.audit-tab-active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  font-weight: bold;
}

.audit-filters {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.audit-metadata {
  font-size: 0.78rem;
  background: var(--cream);
  padding: 0.5rem;
  border-radius: var(--radius);
  max-width: 500px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 0.3rem;
}

details summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--brass);
}

/* ===== The Back Room (Chat) ===== */
#chat-messages {
  max-height: 450px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-message {
  display: flex;
}

.chat-user {
  justify-content: flex-end;
}

.chat-assistant, .chat-error {
  justify-content: flex-start;
}

.chat-bubble {
  max-width: 80%;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.chat-bubble p { margin: 0 0 0.4rem 0; }
.chat-bubble p:last-child { margin-bottom: 0; }

.chat-bubble-user {
  background: var(--gold);
  color: var(--ink);
  border-bottom-right-radius: 2px;
}

.chat-bubble-assistant {
  background: var(--mahogany-light);
  color: var(--cream);
  border-bottom-left-radius: 2px;
}

.chat-error .chat-bubble {
  background: var(--red);
  color: var(--cream);
}

.chat-confirmation-detail {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--cream);
  margin-bottom: 0.4rem;
}

.chat-body-preview {
  margin-top: 0.5rem;
  padding: 0.5rem;
  white-space: pre-wrap;
  font-style: normal;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--cream);
  border-top: 1px solid var(--walnut);
}

.chat-confirm-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--walnut);
}

.chat-input-bar {
  border-top: 2px solid var(--gold);
  padding: 0.75rem 1rem;
}

.chat-input-bar form {
  display: flex;
  gap: 0.5rem;
}

.chat-input-bar input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.92rem;
  background: var(--ivory);
  color: var(--ink);
}

.btn-mic {
  background: var(--smoke);
  color: var(--cream);
  border: 1px solid var(--walnut);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.btn-mic:hover { background: var(--smoke-light); }

.btn-stop {
  background: var(--red);
  color: var(--cream);
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-stop:hover { opacity: 0.8; }

.mic-recording {
  background: var(--red);
  color: var(--cream);
  animation: pulse 1s ease-in-out infinite;
}

.chat-input-bar input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-light);
}

.chat-typing span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--gold-light);
  border-radius: 50%;
  margin: 0 2px;
  animation: chatTyping 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatTyping {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ===== Calendar list (expandable rows) ===== */
.calendar-detail-row td {
  padding: 0;
  border-bottom: 1px solid var(--cream-dark);
}

.calendar-list {
  padding: 0.5rem 1rem 0.75rem 2rem;
  background: var(--cream);
}

.calendar-sub-table {
  width: 100%;
  margin: 0;
  border: none;
  background: transparent;
}

.calendar-sub-table thead th {
  font-size: 0.78rem;
  color: var(--brass);
  padding: 0.25rem 0.5rem;
  border-bottom: 1px solid var(--cream-dark);
}

.calendar-sub-table tbody td {
  padding: 0.3rem 0.5rem;
  font-size: 0.88rem;
  border-bottom: none;
}

.calendar-color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.calendar-role-select {
  padding: 0.2rem 0.4rem;
  font-size: 0.82rem;
  font-family: var(--font-body);
  background: var(--ivory);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
}

.calendar-role-select:focus {
  outline: none;
  border-color: var(--gold);
}

.calendar-actions {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--cream-dark);
}

.expand-arrow {
  color: var(--brass);
  font-size: 0.75rem;
  margin-left: 0.3rem;
}

/* ===== Scrollbar — keep it classy ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--cream-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brass); }
