/* Milieu Meeting - Milieu branding (assets/palette.txt), mobile-first.
   Breakpoints: >=768px (tablet/desktop nav, two-column detail), >=1200px (centered max width). */

@font-face {
  font-family: 'Polymath';
  src: url('../font/Polymath-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Polymath';
  src: url('../font/Polymath-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Milieu palette (assets/palette.txt) */
  --c-grey: #bcbec0;
  --c-blue: #0f69f0;
  --c-green: #acff7d;
  --c-yellow: #ffe12d;
  --c-dark-grey: #6d6e71;
  --c-navy: #0a1d37;
  --c-snow: #f8f9fa;
  --c-cloud: #e9ecef;
  --c-red: #d90429;
  --c-orange: #e85d04;
  --c-forest: #0c3e26;
  --c-indigo: #3d348b;
  --c-teal: #00a896;
  --c-violet: #5e60ce;
  --c-steel: #4f5d75;

  --bg: var(--c-snow);
  --surface: #ffffff;
  --text: var(--c-navy);
  --muted: var(--c-dark-grey);
  --primary: var(--c-blue);
  --danger: var(--c-red);
  --radius: 12px;
  --shadow: 0 1px 3px rgba(10, 29, 55, 0.10);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Polymath', 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.45rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.muted { color: var(--muted); font-size: 0.88rem; }
.empty { color: var(--muted); padding: 2rem 1rem; text-align: center; }

/* Show/hide authenticated chrome */
body:not([data-authed="1"]) [data-auth] { display: none !important; }

/* Top navigation (>=768px) */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-navy);
  color: #fff;
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; }
.brand-logo { height: 34px; width: auto; }
.brand-name { font-weight: 700; letter-spacing: 0.02em; }
.topnav-links { display: none; align-items: center; gap: 1.1rem; }
.topnav-links a { color: var(--c-cloud); padding: 0.4rem 0.2rem; border-bottom: 2px solid transparent; }
.topnav-links a.active { color: #fff; border-bottom-color: var(--c-green); font-weight: 700; }

/* Bottom tab bar (mobile) */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--c-cloud);
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0.55rem 0 0.45rem;
  color: var(--c-dark-grey);
  font-size: 0.72rem;
  min-height: 48px;
}
.tabbar a.active { color: var(--primary); font-weight: 700; }
.tab-ico { font-size: 1.15rem; line-height: 1; }
body:not([data-authed="1"]) main { padding-bottom: 0; }
body[data-authed="1"] main { padding-bottom: 72px; }

/* Page layout */
.page { padding: 1rem; max-width: 100%; }
.page-narrow { max-width: 640px; margin: 0 auto; }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.page-head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--c-cloud);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 0.9rem;
}

/* Forms */
.form label { display: block; margin-bottom: 0.8rem; font-size: 0.9rem; font-weight: 700; }
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form select {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-weight: 400;
  border: 1px solid var(--c-grey);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 42px;
}
.form input:focus,
.form select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.form .check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.form .check input { width: 18px; height: 18px; }
.form-error { color: var(--danger); font-size: 0.88rem; margin: 0.2rem 0 0.6rem; }
.form-ok { color: var(--c-forest); font-size: 0.88rem; margin: 0.2rem 0 0.6rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  min-height: 42px;
  cursor: pointer;
  background: var(--c-cloud);
  color: var(--text);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #0c56c4; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--c-grey); color: inherit; }
.topnav .btn-ghost { color: var(--c-cloud); border-color: var(--c-steel); }
.btn-lg { width: 100%; min-height: 50px; font-size: 1.05rem; }
.btn-sm { min-height: 34px; padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: default; }

/* Record button dot */
.rec-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--danger);
  display: inline-block;
}
.rec-dot.live { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.25); }
}

/* Live recording panel */
.live-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; margin-left: auto; font-size: 1.1rem; }
.waveform { width: 100%; height: auto; border-radius: var(--radius); background: var(--c-navy); margin-bottom: 0.5rem; }
.countdown {
  font-size: 5rem; font-weight: 800; line-height: 1.2;
  text-align: center; color: var(--c-red);
  font-variant-numeric: tabular-nums;
}

/* Banners */
.banner {
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 0.9rem;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}
.banner-info { background: #e8f0fe; border: 1px solid #c3d7fb; }
.banner-error { background: #fdecee; border: 1px solid #f5b8c0; }
.banner-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--c-grey);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Meetings list */
.meeting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--c-cloud);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  color: var(--text);
}
.meeting-row-main { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.meeting-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Status badges */
.badge {
  flex: none;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  white-space: nowrap;
}
.badge-ready { background: #e7f4ff; color: var(--c-blue); }
.badge-processing { background: #fff2e3; color: var(--c-orange); }
.badge-error { background: #fdecee; color: var(--danger); }

/* Login */
.login-card { margin-top: 1.5rem; text-align: center; }
.login-card h1 { margin-bottom: 0.2rem; }
.login-card .form { text-align: left; margin-top: 1rem; }
.login-logo { height: 56px; width: auto; margin-bottom: 0.4rem; }
.login-toggle { margin-top: 0.9rem; }

/* Summary cards */
.cards { display: grid; grid-template-columns: 1fr; gap: 0.9rem; margin-bottom: 0.9rem; }
.cards .card { margin-bottom: 0; }
.card-list { margin: 0; padding-left: 1.2rem; }
.card-list li { margin-bottom: 0.35rem; }
.card-list.actions { list-style: none; padding-left: 0; }
.card-list.actions li { display: flex; align-items: flex-start; gap: 0.5rem; }
.check-box {
  flex: none;
  width: 16px; height: 16px;
  margin-top: 3px;
  border: 2px solid var(--c-steel);
  border-radius: 4px;
}

/* Meeting detail */
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 0.9rem; }
.audio-card audio { width: 100%; }
.transcript-card h3 { margin-bottom: 0.6rem; }
.segments { display: flex; flex-direction: column; gap: 0.45rem; }
.seg {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0.5rem;
  align-items: start;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
}
.seg.active { background: #e8f0fe; }
.seg-trans {
  grid-column: 3;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  border-left: 2px solid var(--c-cloud);
  padding-left: 0.5rem;
  overflow-wrap: anywhere;
}
/* Summary cards are not grids: translations sit on their own line. */
.card .seg-trans { display: block; margin-top: 0.15rem; }
.transcript-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.transcript-head h3 { margin: 0; }
.translate-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.translate-row select {
  font: inherit;
  min-height: 34px;
  border: 1px solid var(--c-cloud);
  border-radius: 6px;
  padding: 0 0.4rem;
  background: #fff;
}
.seg-time {
  font: inherit;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--c-cloud);
  border: none;
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
  cursor: pointer;
  min-height: 32px;
}
.chip {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  min-height: 32px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip.editing { padding: 0; }
.chip-input {
  font: inherit;
  font-size: 0.8rem;
  border: 1px solid var(--primary);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  min-height: 32px;
  width: 120px;
}
.spk-a { background: #e7f4ff; color: var(--c-blue); }
.spk-b { background: #e9fbff; color: var(--c-teal); }
.spk-c { background: #efeeff; color: var(--c-violet); }
.spk-d { background: #f0efff; color: var(--c-indigo); }
.spk-e { background: #e6f7f2; color: var(--c-forest); }
.spk-f { background: #fff8e1; color: #8a6d00; }
.seg-text {
  margin: 0;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  min-height: 32px;
  font-size: 0.95rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.seg-text:focus { outline: 2px solid var(--primary); background: #fff; }
.title-input {
  font: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  width: 100%;
  max-width: 480px;
}

/* Dropdown menu (export) */
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--c-cloud);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(10, 29, 55, 0.16);
  min-width: 190px;
  z-index: 30;
  padding: 0.3rem 0;
}
.menu-list a { display: block; padding: 0.5rem 0.9rem; color: var(--text); }
.menu-list a:hover { background: var(--c-cloud); }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 29, 55, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 30px rgba(10, 29, 55, 0.3);
}
.modal h3 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.9rem; }

/* Tablet and up */
@media (min-width: 768px) {
  .tabbar { display: none; }
  body[data-authed="1"] main { padding-bottom: 2rem; }
  .topnav-links { display: flex; }
  .page { padding: 1.5rem 2rem; }
  .cards { grid-template-columns: 1fr 1fr; }
  .cards .card:first-child { grid-column: 1 / -1; }
  .detail-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .detail-col { position: sticky; top: 76px; }
  h1 { font-size: 1.7rem; }
}

/* Desktop */
@media (min-width: 1200px) {
  .page { max-width: 1100px; margin: 0 auto; }
  .page-narrow { max-width: 640px; }
}

/* Audio transport controls under the native player. */
.audio-controls { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* Chat view (shared ChatGPT account). */
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.chat-head h1 { margin: 0; }
.chat-head-tools { display: flex; align-items: center; gap: 0.5rem; }
.chat-model-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--muted); }
.chat-model-label select { padding: 0.3rem 0.4rem; border: 1px solid var(--c-cloud); border-radius: 8px; background: var(--surface); color: var(--text); }
.chat-list { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.25rem 0 1rem; min-height: 30vh; }
.bubble { max-width: 85%; padding: 0.55rem 0.8rem; border-radius: var(--radius); box-shadow: var(--shadow); line-height: 1.45; overflow-wrap: anywhere; }
.bubble-user { align-self: flex-end; background: var(--c-navy); color: #fff; }
.bubble-assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--c-cloud); }
.bubble-error { border-color: var(--danger); color: var(--danger); }
.chat-thinking { color: var(--muted); font-style: italic; }
.chat-empty { text-align: center; margin-top: 2rem; }
.chat-composer { position: sticky; bottom: calc(60px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 0.5rem; padding: 0.6rem; }
.chat-composer textarea { width: 100%; resize: vertical; border: 1px solid var(--c-cloud); border-radius: 8px; padding: 0.5rem 0.6rem; font: inherit; color: var(--text); background: var(--surface); }
.chat-composer-row { display: flex; justify-content: space-between; align-items: center; }
.chat-file-btn { cursor: pointer; font-size: 1.2rem; padding: 0.1rem 0.5rem; color: var(--muted); }
.chat-attach { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.25rem 0 0.5rem; }
.chat-chip { display: inline-flex; align-items: center; gap: 0.35rem; background: var(--c-cloud); border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.8rem; }
.chat-chip button { border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--muted); }
.chat-chip-error { color: var(--danger); font-size: 0.85rem; }
.cx-warn { color: var(--danger); }
.cx-code { font-size: 1.7rem; letter-spacing: 0.15em; font-weight: 700; text-align: center; }
.form-check { font-weight: 400; font-size: 0.85rem; color: var(--muted); }

@media (min-width: 768px) {
  .chat-composer { bottom: 1rem; }
}
