/* ==========================================================================
   MinitMan Transcribe — shared styles
   Built on Bootstrap 5.3 (grid + JS components); this file supplies the look.
   ========================================================================== */

/* ---------- Design tokens ----------
   Palette shared with fw.myrecordings.co.uk: black background, graphite cards,
   purple→pink action gradient, blue→purple→pink brand gradient. Always dark. */
:root, [data-bs-theme="dark"] {
  --mm-grad: linear-gradient(135deg, #7b2ff7, #f107a3);           /* buttons, active tabs */
  --mm-grad-brand: linear-gradient(90deg, #38bdf8, #9b6bff, #f107a3); /* wordmark, tagline */
  --mm-purple: #7b2ff7;
  --mm-pink: #f107a3;
  --mm-accent: #b07cff;          /* text-level accent on dark */
  --mm-accent-hover: #c9a4ff;
  --mm-accent-soft: rgba(123, 47, 247, .16);
  --mm-link: #9db4ff;

  --mm-bg: #000000;
  --mm-surface: #1c1f27;
  --mm-surface-2: #161922;
  --mm-input: #0e0f13;
  --mm-border: #2b3040;
  --mm-border-strong: #303544;
  --mm-text: #e7e9ee;
  --mm-text-2: #cdd2dd;
  --mm-text-3: #8b91a1;
  --mm-label: #aeb4c2;

  --mm-success: #7ee0b0;
  --mm-success-soft: rgba(70, 209, 138, .12);
  --mm-warning: #ffc98a;
  --mm-warning-soft: rgba(245, 166, 35, .1);
  --mm-danger: #ff8aa6;
  --mm-danger-soft: rgba(255, 90, 120, .12);
  --mm-neutral-soft: #262a36;

  --mm-radius: 14px;
  --mm-radius-sm: 10px;
  --mm-shadow: 0 2px 12px rgba(0, 0, 0, .3);
  --mm-shadow-lg: 0 16px 40px rgba(0, 0, 0, .6);
  --mm-bar-h: 60px;

  /* Bootstrap overrides */
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-size: .9375rem;
  --bs-body-color: var(--mm-text);
  --bs-body-bg: var(--mm-bg);
  --bs-emphasis-color: #ffffff;
  --bs-secondary-color: var(--mm-text-3);
  --bs-tertiary-bg: var(--mm-surface-2);
  --bs-border-color: var(--mm-border);
  --bs-border-radius: var(--mm-radius-sm);
  --bs-link-color: var(--mm-link);
  --bs-link-color-rgb: 157, 180, 255;
  --bs-link-hover-color: #c2d0ff;
  --bs-link-hover-color-rgb: 194, 208, 255;
  --bs-primary: var(--mm-purple);
  --bs-primary-rgb: 123, 47, 247;
  --bs-focus-ring-color: rgba(123, 47, 247, .35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--mm-bg);
  color: var(--mm-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6 { color: var(--mm-text); font-weight: 600; letter-spacing: -.011em; }
.text-secondary, .text-muted { color: var(--mm-text-3) !important; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .875em; letter-spacing: .02em; }
.small-caps { font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mm-text-3); }
:focus-visible { outline: 2px solid var(--mm-purple); outline-offset: 2px; }
a { color: var(--mm-link); }
.gradient-text { background: var(--mm-grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Buttons ---------- */
.btn {
  --bs-btn-font-weight: 500;
  --bs-btn-font-size: .9375rem;
  --bs-btn-padding-y: .55rem;
  --bs-btn-padding-x: 1rem;
  --bs-btn-border-radius: var(--mm-radius-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 42px;
  touch-action: manipulation;
}
.btn-sm { --bs-btn-padding-y: .35rem; --bs-btn-padding-x: .7rem; --bs-btn-font-size: .8125rem; min-height: 34px; }
.btn-lg { --bs-btn-padding-y: .7rem; --bs-btn-font-size: 1rem; min-height: 48px; }
.btn-primary {
  --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; --bs-btn-disabled-color: #fff;
  --bs-btn-bg: var(--mm-purple); --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--mm-purple); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--mm-purple); --bs-btn-active-border-color: transparent;
  --bs-btn-disabled-bg: var(--mm-purple); --bs-btn-disabled-border-color: transparent;
  background-image: var(--mm-grad); font-weight: 600; border: 0;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); filter: brightness(.95); }
.btn-secondary, .btn-light {
  --bs-btn-bg: var(--mm-surface); --bs-btn-border-color: var(--mm-border-strong); --bs-btn-color: var(--mm-text);
  --bs-btn-hover-bg: var(--mm-surface-2); --bs-btn-hover-border-color: var(--mm-border-strong); --bs-btn-hover-color: var(--mm-text);
  --bs-btn-active-bg: var(--mm-neutral-soft); --bs-btn-active-border-color: var(--mm-border-strong); --bs-btn-active-color: var(--mm-text);
  --bs-btn-disabled-bg: var(--mm-surface); --bs-btn-disabled-border-color: var(--mm-border); --bs-btn-disabled-color: var(--mm-text-3);
}
.btn-ghost {
  --bs-btn-bg: transparent; --bs-btn-border-color: transparent; --bs-btn-color: var(--mm-text-2);
  --bs-btn-hover-bg: var(--mm-neutral-soft); --bs-btn-hover-border-color: transparent; --bs-btn-hover-color: var(--mm-text);
  --bs-btn-active-bg: var(--mm-neutral-soft); --bs-btn-active-border-color: transparent; --bs-btn-active-color: var(--mm-text);
}
.btn-danger-ghost {
  --bs-btn-bg: transparent; --bs-btn-border-color: transparent; --bs-btn-color: var(--mm-danger);
  --bs-btn-hover-bg: var(--mm-danger-soft); --bs-btn-hover-border-color: transparent; --bs-btn-hover-color: var(--mm-danger);
  --bs-btn-active-bg: var(--mm-danger-soft); --bs-btn-active-border-color: transparent; --bs-btn-active-color: var(--mm-danger);
}
.btn-icon { width: 38px; min-width: 38px; padding: 0; min-height: 38px; }
.btn-link { --bs-btn-color: var(--mm-accent); --bs-btn-hover-color: var(--mm-accent-hover); text-decoration: none; min-height: 0; padding: 0; }
.btn .spinner-border { width: 1rem; height: 1rem; border-width: .15em; }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: .875rem; color: var(--mm-label); margin-bottom: .4rem; }
.form-text { color: var(--mm-text-3); font-size: .8125rem; }
.form-control, .form-select {
  font-size: 1rem; /* 16px stops iOS zooming on focus */
  min-height: 44px;
  border-radius: var(--mm-radius-sm);
  border-color: var(--mm-border-strong);
  background-color: var(--mm-input);
  color: var(--mm-text);
}
.form-control::placeholder { color: var(--mm-text-3); opacity: .8; }
.form-control:focus, .form-select:focus { background-color: var(--mm-input); color: var(--mm-text); border-color: var(--mm-purple); box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.form-control-sm, .form-select-sm { min-height: 34px; font-size: .875rem; }
.form-check-input { border-color: var(--mm-border-strong); }
.form-check-input { background-color: var(--mm-input); }
.form-check-input:checked { background-color: var(--mm-pink); border-color: var(--mm-pink); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--bs-focus-ring-color); border-color: var(--mm-purple); }
.form-switch .form-check-input { width: 2.4em; height: 1.35em; margin-top: .05em; cursor: pointer; }
.input-group .btn { min-height: 44px; }
.input-reveal { position: relative; }
.input-reveal .form-control { padding-right: 3rem; }
.input-reveal .reveal-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--mm-text-3);
  width: 38px; height: 38px; border-radius: 6px; display: grid; place-items: center;
}
.input-reveal .reveal-btn:hover { color: var(--mm-text); background: var(--mm-neutral-soft); }
.field-hint { font-size: .8125rem; margin-top: .35rem; min-height: 1.2em; }
.field-hint.ok { color: var(--mm-success); }
.field-hint.bad { color: var(--mm-danger); }

/* ---------- App bar ---------- */
.app-bar {
  position: sticky; top: 0; z-index: 1030;
  height: var(--mm-bar-h);
  background: #000;
  color: #fff;
  border-bottom: 1px solid var(--mm-border);
}
.app-bar .inner { height: 100%; display: flex; align-items: center; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; min-width: 0; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 34px; height: 34px; flex: none; display: inline-block;
  background: var(--mm-grad-brand);
  -webkit-mask: url(/mark-mask.png) center / contain no-repeat; mask: url(/mark-mask.png) center / contain no-repeat;
  filter: drop-shadow(0 0 6px rgba(130, 90, 255, .45));
}
.brand-name { font-weight: 800; letter-spacing: .08em; font-size: 1.05rem; line-height: 1; background: var(--mm-grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-weight: 500; font-size: .8125rem; color: rgba(255, 255, 255, .6); line-height: 1; padding-left: .65rem; border-left: 1px solid rgba(255, 255, 255, .2); margin-left: .05rem; }
.app-bar .spacer { flex: 1; }
.bar-link {
  color: rgba(255, 255, 255, .75); text-decoration: none; font-weight: 500; font-size: .9rem;
  padding: .45rem .75rem; border-radius: 8px; display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
}
.bar-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.bar-link.active { color: #fff; background: rgba(255, 255, 255, .12); }
.user-chip {
  display: inline-flex; align-items: center; gap: .55rem; color: #fff; background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; padding: .25rem .75rem .25rem .3rem; font-weight: 500; font-size: .875rem;
  min-height: 38px; max-width: 220px;
}
.user-chip:hover, .user-chip[aria-expanded="true"] { background: rgba(255, 255, 255, .14); color: #fff; }
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--mm-grad); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: .8rem; text-transform: uppercase; flex: none;
}
.user-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-menu {
  --bs-dropdown-bg: var(--mm-surface); --bs-dropdown-border-color: var(--mm-border);
  --bs-dropdown-link-color: var(--mm-text); --bs-dropdown-link-hover-bg: var(--mm-surface-2);
  --bs-dropdown-link-active-bg: var(--mm-accent-soft); --bs-dropdown-link-active-color: var(--mm-text);
  --bs-dropdown-divider-bg: var(--mm-border); --bs-dropdown-header-color: var(--mm-text-3);
  border-radius: var(--mm-radius); box-shadow: var(--mm-shadow-lg); padding: .4rem; min-width: 240px;
}
.dropdown-item { border-radius: 6px; padding: .55rem .7rem; display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.dropdown-item i { color: var(--mm-text-3); width: 1.1rem; text-align: center; }
.dropdown-item.text-danger i { color: inherit; }

/* Admin secondary nav: scrolls sideways on narrow screens */
.sub-nav { background: #000; border-bottom: 1px solid var(--mm-border); }
.sub-nav .inner { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.sub-nav .inner::-webkit-scrollbar { display: none; }
.sub-nav a {
  color: var(--mm-text-2); text-decoration: none; font-weight: 500; font-size: .9rem; white-space: nowrap;
  padding: .85rem .9rem; border-bottom: 2px solid transparent; display: inline-flex; align-items: center; gap: .45rem;
}
.sub-nav a:hover { color: var(--mm-text); }
.sub-nav a.active { color: #fff; border-image: var(--mm-grad) 1; border-bottom-width: 2px; }

/* ---------- Page scaffolding ---------- */
.page { padding-top: 1.75rem; padding-bottom: 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head p { margin: .3rem 0 0; color: var(--mm-text-3); }
.container-narrow { max-width: 760px; }

.panel {
  background: var(--mm-surface); border: 1px solid var(--mm-border); border-radius: var(--mm-radius);
  box-shadow: var(--mm-shadow);
}
.panel + .panel { margin-top: 1.25rem; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--mm-border);
}
.panel-head h2 { font-size: 1rem; margin: 0; }
.panel-head .sub { color: var(--mm-text-3); font-size: .8125rem; margin: .15rem 0 0; }
.panel-body { padding: 1.25rem; }
.panel-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--mm-border); background: var(--mm-surface-2); border-radius: 0 0 var(--mm-radius) var(--mm-radius); }
.section-title { font-size: .95rem; font-weight: 600; margin: 0 0 .25rem; }
.section-desc { color: var(--mm-text-3); font-size: .8125rem; margin: 0 0 1rem; }
.divider { border: 0; border-top: 1px solid var(--mm-border); margin: 1.5rem 0; opacity: 1; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--mm-surface); border: 1px solid var(--mm-border); border-radius: var(--mm-radius); padding: 1rem 1.15rem; box-shadow: var(--mm-shadow); }
.stat .label { font-size: .8125rem; color: var(--mm-text-3); font-weight: 500; }
.stat .value { font-size: 1.6rem; font-weight: 650; letter-spacing: -.02em; margin-top: .2rem; line-height: 1.2; text-transform: capitalize; }
@media (max-width: 767.98px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; } .stat .value { font-size: 1.35rem; } }

/* ---------- Status pills & tags ---------- */
.pill {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 600;
  padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; line-height: 1.4;
  background: var(--mm-neutral-soft); color: var(--mm-text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-success { background: var(--mm-success-soft); color: var(--mm-success); }
.pill-warning { background: var(--mm-warning-soft); color: var(--mm-warning); }
.pill-danger { background: var(--mm-danger-soft); color: var(--mm-danger); }
.pill-accent { background: var(--mm-accent-soft); color: var(--mm-accent); }
.pill-processing::before { animation: mm-pulse 1.4s ease-in-out infinite; }
@keyframes mm-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--mm-text-3); white-space: nowrap; }
.tag + .tag::before { content: "·"; margin: 0 .05rem 0 .4rem; color: var(--mm-text-3); opacity: .6; }

/* ---------- Usage meter ---------- */
.meter { height: 8px; border-radius: 999px; background: var(--mm-neutral-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--mm-grad); transition: width .4s ease; }
.meter.warn > span { background: var(--mm-warning); }
.meter.over > span { background: var(--mm-danger); }
.meter-sm { height: 6px; }

/* ---------- Notices ---------- */
.notice {
  display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--mm-radius-sm);
  border: 1px solid var(--mm-border); background: var(--mm-surface); font-size: .9rem; margin-bottom: 1rem;
}
.notice > i { font-size: 1.1rem; line-height: 1.3; flex: none; }
.notice .notice-body { flex: 1; min-width: 0; }
.notice .notice-title { font-weight: 600; margin-bottom: .15rem; }
.notice .btn-close { flex: none; margin-left: auto; transform: scale(.8); }
.notice-info { background: var(--mm-accent-soft); border-color: transparent; }
.notice-info > i { color: var(--mm-accent); }
.notice-success { background: var(--mm-success-soft); border-color: transparent; }
.notice-success > i { color: var(--mm-success); }
.notice-warning { background: var(--mm-warning-soft); border-color: transparent; }
.notice-warning > i { color: var(--mm-warning); }
.notice-danger { background: var(--mm-danger-soft); border-color: transparent; }
.notice-danger > i { color: var(--mm-danger); }

/* Toasts */
.toast-stack { position: fixed; z-index: 1090; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.mm-toast {
  display: flex; gap: .65rem; align-items: flex-start; background: var(--mm-surface); color: var(--mm-text); border: 1px solid var(--mm-border);
  padding: .8rem 1rem; border-radius: 10px; box-shadow: var(--mm-shadow-lg); font-size: .9rem;
  animation: mm-toast-in .2s ease-out;
}
.mm-toast i { font-size: 1.05rem; line-height: 1.3; }
.mm-toast.success i { color: #4ade80; }
.mm-toast.error i { color: #f87171; }
@keyframes mm-toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 575.98px) { .toast-stack { left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); max-width: none; } }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 2.5rem 1.25rem; color: var(--mm-text-3); }
.empty .empty-icon {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto .9rem; display: grid; place-items: center;
  background: var(--mm-neutral-soft); color: var(--mm-text-2); font-size: 1.4rem;
}
.empty h3 { font-size: 1rem; margin-bottom: .3rem; }
.empty p { max-width: 360px; margin: 0 auto 1rem; font-size: .9rem; }

/* ---------- File browser ---------- */
.browser-toolbar { display: flex; align-items: center; gap: .5rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--mm-border); }
.crumbs { display: flex; align-items: center; gap: .15rem; min-width: 0; flex: 1; overflow-x: auto; scrollbar-width: none; font-size: .875rem; }
.crumbs::-webkit-scrollbar { display: none; }
.crumbs button {
  border: 0; background: transparent; color: var(--mm-text-2); padding: .3rem .45rem; border-radius: 6px; white-space: nowrap; font-weight: 500;
}
.crumbs button:hover { background: var(--mm-neutral-soft); color: var(--mm-text); }
.crumbs button[aria-current="page"] { color: var(--mm-text); font-weight: 600; }
.crumbs .sep { color: var(--mm-border-strong); font-size: .75rem; }
.file-list { list-style: none; margin: 0; padding: 0; }
.file-row {
  display: flex; align-items: center; gap: .85rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--mm-border);
  min-height: 60px;
}
.file-row:last-child { border-bottom: 0; }
.file-row.is-folder { cursor: pointer; }
.file-row.is-folder:hover, .file-row.is-folder:focus-visible { background: var(--mm-surface-2); }
.file-icon {
  width: 38px; height: 38px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 1.1rem;
  background: var(--mm-neutral-soft); color: var(--mm-text-2);
}
.file-icon.audio { background: var(--mm-accent-soft); color: var(--mm-accent); }
.file-icon.folder { background: var(--mm-warning-soft); color: var(--mm-warning); }
.file-main { flex: 1; min-width: 0; }
.file-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: .8125rem; color: var(--mm-text-3); display: flex; flex-wrap: wrap; gap: 0 .75rem; }
.file-row .chev { color: var(--mm-text-3); }
.browser-scroll { max-height: min(65vh, 640px); overflow-y: auto; }
.skeleton-row { display: flex; align-items: center; gap: .85rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--mm-border); }
.skeleton { background: linear-gradient(90deg, var(--mm-neutral-soft) 25%, var(--mm-surface-2) 37%, var(--mm-neutral-soft) 63%); background-size: 400% 100%; animation: mm-shimmer 1.3s ease infinite; border-radius: 6px; }
@keyframes mm-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Transcription job list ---------- */
.job-list { list-style: none; margin: 0; padding: 0; }
.job {
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--mm-border);
}
.job:last-child { border-bottom: 0; }
.job-top { display: flex; align-items: flex-start; gap: .75rem; }
.job-name { font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { display: flex; flex-wrap: wrap; gap: .1rem 0; margin-top: .25rem; }
.job-meta .tag.wrap { white-space: normal; }
.quota-card { flex: 0 1 280px; padding: .75rem 1rem; }
@media (max-width: 575.98px) { .quota-card { flex-basis: 100%; } }
.job-preview {
  margin-top: .5rem; font-size: .875rem; color: var(--mm-text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.job-error { margin-top: .5rem; font-size: .8125rem; color: var(--mm-danger); }
.job-actions { display: flex; gap: .4rem; margin-top: .6rem; flex-wrap: wrap; }
.jobs-scroll { max-height: min(70vh, 760px); overflow-y: auto; }

/* ---------- Transcript viewer ---------- */
.transcript {
  white-space: pre-wrap; word-break: break-word; font-size: .95rem; line-height: 1.65; color: var(--mm-text);
  background: var(--mm-surface-2); border: 1px solid var(--mm-border); border-radius: var(--mm-radius-sm);
  padding: 1rem 1.1rem; margin: 0; font-family: inherit;
}

/* ---------- Modals ---------- */
.modal { --bs-modal-bg: var(--mm-surface); --bs-modal-border-color: var(--mm-border); --bs-modal-border-radius: 14px; --bs-modal-header-border-color: var(--mm-border); --bs-modal-footer-border-color: var(--mm-border); }
.modal-content { box-shadow: var(--mm-shadow-lg); }
/* A <form> wrapping header/body/footer must keep the modal's flex layout (footer pinned, body scrolls) */
.modal-content > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal-header { padding: 1rem 1.25rem; }
.modal-title { font-size: 1.05rem; font-weight: 600; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: .85rem 1.25rem; gap: .5rem; }
.modal-footer > * { margin: 0; }
.option-group { padding: 1rem 0; border-top: 1px solid var(--mm-border); }
.option-group:first-child { border-top: 0; padding-top: 0; }
.option-group > .small-caps { margin-bottom: .6rem; display: block; }
.option {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .55rem 0;
}
.option .option-text { flex: 1; min-width: 0; }
.option .option-title { font-weight: 500; font-size: .9rem; }
.option .option-desc { font-size: .8125rem; color: var(--mm-text-3); }
.option .form-check { margin: 0; padding: 0; min-height: 0; flex: none; }
.option .form-check .form-check-input { margin: 0; float: none; }
.option.disabled .option-title, .option.disabled .option-desc { opacity: .55; }
.option .unsupported { font-size: .75rem; color: var(--mm-warning); font-weight: 500; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; background: var(--mm-neutral-soft); padding: .3rem; border-radius: 10px; }
.seg.seg-2 { grid-template-columns: repeat(2, 1fr); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  text-align: center; padding: .5rem .4rem; border-radius: 7px; font-size: .85rem; font-weight: 500; color: var(--mm-text-2);
  cursor: pointer; min-height: 38px; display: grid; place-items: center; line-height: 1.2;
}
.seg input:checked + label { background: var(--mm-grad); color: #fff; box-shadow: var(--mm-shadow); }
.seg input:focus-visible + label { outline: 2px solid var(--mm-accent); outline-offset: 1px; }
.collapse-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: transparent; padding: .9rem 0 0; color: var(--mm-text); font-weight: 600; font-size: .9rem; border-top: 1px solid var(--mm-border); }
.collapse-toggle i { transition: transform .2s ease; color: var(--mm-text-3); }
.collapse-toggle[aria-expanded="true"] i { transform: rotate(180deg); }

/* ---------- Tables (stack into cards on small screens) ---------- */
.table-wrap { overflow-x: auto; }
.mm-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.mm-table th {
  text-align: left; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--mm-text-3);
  padding: .7rem 1rem; background: var(--mm-surface-2); border-bottom: 1px solid var(--mm-border); white-space: nowrap;
}
.mm-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--mm-border); vertical-align: middle; color: var(--mm-text); }
.mm-table tr:last-child td { border-bottom: 0; }
.mm-table tbody tr:hover td { background: var(--mm-surface-2); }
.mm-table .cell-sub { display: block; font-size: .8rem; color: var(--mm-text-3); }
.mm-table .actions { text-align: right; white-space: nowrap; }
.mm-table .actions > * { vertical-align: middle; }
@media (max-width: 767.98px) {
  .mm-table.stack thead { display: none; }
  .mm-table.stack, .mm-table.stack tbody, .mm-table.stack tr, .mm-table.stack td { display: block; width: 100%; }
  .mm-table.stack tr { padding: .75rem 1rem; border-bottom: 1px solid var(--mm-border); }
  .mm-table.stack tr:last-child { border-bottom: 0; }
  .mm-table.stack tbody tr:hover td { background: transparent; }
  .mm-table.stack td { border: 0; padding: .3rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-align: right; }
  .mm-table.stack td::before { content: attr(data-label); font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--mm-text-3); text-align: left; flex: none; }
  .mm-table.stack td.primary { font-size: .95rem; padding-bottom: .5rem; }
  .mm-table.stack td.primary::before { display: none; }
  .mm-table.stack td.primary { justify-content: flex-start; text-align: left; }
  .mm-table.stack td.actions { justify-content: flex-end; padding-top: .6rem; }
  .mm-table.stack td.actions::before { display: none; }
}

/* ---------- Tabs ---------- */
.mm-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--mm-border); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.mm-tabs::-webkit-scrollbar { display: none; }
.mm-tabs .nav-link {
  border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--mm-text-2); font-weight: 500; font-size: .9rem;
  padding: .7rem .9rem; border-radius: 0; white-space: nowrap; display: inline-flex; align-items: center; gap: .45rem;
}
.mm-tabs .nav-link:hover { color: var(--mm-text); }
.mm-tabs .nav-link.active { color: #fff; border-image: var(--mm-grad) 1; background: transparent; }
.mm-tabs .count { font-size: .75rem; background: var(--mm-neutral-soft); color: var(--mm-text-2); border-radius: 999px; padding: .05rem .5rem; font-weight: 600; }

/* ---------- Auth (login) layout ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); }
.auth-brand {
  background: radial-gradient(900px 500px at 0% 0%, rgba(123, 47, 247, .22) 0%, transparent 60%), radial-gradient(700px 500px at 100% 100%, rgba(241, 7, 163, .12) 0%, transparent 60%), #07080b;
  color: #fff; padding: 2.5rem; display: none; flex-direction: column;
}
.brand-lockup { display: flex; flex-direction: column; align-items: flex-start; margin: auto 0 1.75rem; }
.brand-lockup .brand-mark { width: 96px; height: 96px; margin-bottom: 1rem; filter: drop-shadow(0 0 16px rgba(130, 90, 255, .55)); }
.brand-lockup .word { font-size: 2.6rem; font-weight: 800; letter-spacing: .12em; line-height: 1; background: var(--mm-grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-lockup .tag { margin-top: .6rem; font-size: .72rem; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; background: var(--mm-grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-brand h2 { color: #fff; font-size: 1.75rem; line-height: 1.25; max-width: 420px; }
.auth-brand p { color: rgba(255, 255, 255, .7); max-width: 420px; margin-bottom: 2rem; }
.steps { list-style: none; padding: 0; margin: 0 0 auto; display: grid; gap: .9rem; max-width: 420px; counter-reset: step; }
.steps li { display: flex; gap: .85rem; align-items: flex-start; color: rgba(255, 255, 255, .85); font-size: .9rem; counter-increment: step; }
.steps li::before {
  content: counter(step); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: .75rem; font-weight: 600; background: rgba(255, 255, 255, .1); color: #fff; border: 1px solid rgba(255, 255, 255, .15);
}
.auth-brand .foot { color: rgba(255, 255, 255, .45); font-size: .8rem; margin-top: 2rem; }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-compact-brand { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.75rem; }
.auth-compact-brand .brand-mark { width: 40px; height: 40px; }
.auth-compact-brand .name { font-weight: 800; letter-spacing: .08em; font-size: 1.1rem; line-height: 1.1; background: var(--mm-grad-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-compact-brand .sub { color: var(--mm-text-3); font-size: .8125rem; }
.auth-card h1 { font-size: 1.5rem; margin-bottom: .3rem; }
.auth-card .lead-text { color: var(--mm-text-3); margin-bottom: 1.5rem; }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; background: var(--mm-neutral-soft); padding: .3rem; border-radius: 10px; margin-bottom: 1.5rem; }
.auth-switch button { border: 0; background: transparent; padding: .55rem; border-radius: 7px; font-weight: 500; font-size: .9rem; color: var(--mm-text-2); min-height: 40px; }
.auth-switch button[aria-selected="true"] { background: var(--mm-grad); color: #fff; box-shadow: var(--mm-shadow); }
.auth-help { margin-top: 1.75rem; font-size: .8125rem; color: var(--mm-text-3); text-align: center; }
/* Desktop: one centred two-panel card, so wide monitors don't pull the halves apart */
@media (min-width: 992px) {
  body.auth-page { background: radial-gradient(1000px 600px at 20% 0%, rgba(123, 47, 247, .18) 0%, transparent 65%), #000; }
  .auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 2.5rem 1.5rem; }
  .auth {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; max-width: 1040px;
    min-height: 600px; border-radius: 20px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px var(--mm-border);
  }
  .auth-brand { display: flex; padding: 3rem; }
  .auth-main { background: var(--mm-surface); padding: 3rem 2.5rem; }
  .auth-main .auth-compact-brand { display: none; }
}
/* Admin sign-in: single centred card on navy */
.auth-solo { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem; background: radial-gradient(900px 500px at 50% -10%, rgba(123, 47, 247, .22) 0%, transparent 70%), #000; }
.auth-solo .panel { width: 100%; max-width: 400px; padding: 2rem; }
.auth-solo .auth-compact-brand { justify-content: center; }

/* ---------- Recording filters ---------- */
.filter-btn { position: relative; }
.filter-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: .7rem; font-weight: 700; line-height: 18px;
  background: var(--mm-grad); color: #fff; text-align: center;
}
.filter-panel {
  display: grid; gap: .75rem; padding: .9rem 1.25rem 1rem; border-bottom: 1px solid var(--mm-border); background: var(--mm-surface-2);
}
.filter-panel[hidden] { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 500; padding: .35rem .75rem; min-height: 32px;
  border-radius: 999px; border: 1px solid var(--mm-border); background: var(--mm-surface); color: var(--mm-text-2); cursor: pointer;
}
.chip:hover { border-color: var(--mm-border-strong); color: var(--mm-text); }
.chip.on { background: var(--mm-grad); border-color: transparent; color: #fff; }
.chip-count { font-size: .72rem; opacity: .75; font-variant-numeric: tabular-nums; }
/* Recording type tags (same colours as the recorder portal) */
.rec-tag { font-size: .7rem; font-weight: 600; padding: .05rem .45rem; border-radius: 6px; background: #262a36; color: #cdd2dd; }
.rec-tag.in { background: #1d3d5a; color: #a9d3ff; }
.rec-tag.out { background: #3d2e1d; color: #ffd9a9; }
.rec-tag.siren { background: #5a1d1d; color: #ffb3b3; }
.rec-done { color: var(--mm-success); font-weight: 500; }
.file-icon.audio.type-in { background: rgba(29, 61, 90, .7); color: #a9d3ff; }
.file-icon.audio.type-out { background: rgba(61, 46, 29, .7); color: #ffd9a9; }
.file-icon.audio.type-siren { background: rgba(90, 29, 29, .7); color: #ffb3b3; }
@media (max-width: 575.98px) { .filter-panel { padding-left: 1rem; padding-right: 1rem; } }

/* ---------- Misc ---------- */
.min-w-0 { min-width: 0; }
.flex-none { flex: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; font-size: .9rem; margin: 0; }
.kv dt { color: var(--mm-text-3); font-weight: 500; }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 5; margin-top: 1.25rem; padding: .85rem 0 calc(.85rem + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--mm-bg) 70%, transparent);
  display: flex; justify-content: flex-end; gap: .5rem;
}
.app-foot { color: var(--mm-text-3); font-size: .8rem; text-align: center; padding: 1.5rem 0 2rem; }

/* ---------- Small screens & landscape phones ---------- */
@media (max-width: 575.98px) {
  .page { padding-top: 1.25rem; }
  .page-head h1 { font-size: 1.3rem; }
  .panel-head, .panel-body, .browser-toolbar, .file-row, .job { padding-left: 1rem; padding-right: 1rem; }
  .brand-sub { display: none; }
  .page-head .btn { flex: 1; }
  .sticky-actions .btn { flex: 1; }
}
/* Short viewports (phones held sideways): reclaim vertical space */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --mm-bar-h: 50px; }
  .app-bar { position: static; }
  .page { padding-top: 1rem; }
  .page-head { margin-bottom: 1rem; }
  .auth-main { justify-content: flex-start; padding-top: 1.25rem; }
  .auth-compact-brand { margin-bottom: 1rem; }
  .browser-scroll, .jobs-scroll { max-height: none; }
  .auth-solo { place-items: start center; }
}
