/**
 * Components shared between the signed-in app and the operator console.
 *
 * These started as a copy of the matching rules in public/app.html, made while
 * building the console so that stabilising app.html for iOS Safari and building
 * a new page could not collide. app.html now links this file instead of holding
 * its own copies, so this is the only definition of each rule again.
 *
 * Load after styles.css and before any page's own <style>. Both pages rely on
 * that order: each keeps its own overrides inline, and they only win because
 * they come later.
 */

/* Panels ------------------------------------------------------------------ */

.panel {
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  background: var(--paper-raised); box-shadow: var(--shadow-sm);
  overflow: hidden;
  /* styles.css sets `section { padding: 84px 0 }` for the marketing bands,
     and a panel is a <section>. Without this reset every panel carries 84px
     of dead space above its own header. */
  padding: 0;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--rule);
}
.panel__head h2 {
  margin: 0; font-family: var(--sans); font-size: 0.95rem; font-weight: 600;
  letter-spacing: 0; white-space: nowrap;
}
.panel__body { padding: 18px; }
.panel__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; border-top: 1px solid var(--rule);
  font-size: 0.85rem; color: var(--ink-muted);
}

/* Filters ----------------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input {
  padding: 7px 10px; border: 1px solid var(--rule-strong);
  border-radius: var(--radius); font: inherit; font-size: 0.88rem; background: var(--paper);
}

/* Fields ------------------------------------------------------------------ */

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.85rem; font-weight: 550; margin-bottom: 5px; }
/* Inputs and selects only — deliberately not textarea, which app.html styles
   with a bare element rule of its own (min-height, resize, a larger box). A
   `.field textarea` here would outrank that by specificity and quietly shrink
   the transcript box on the upload form, which is inside a .field. The first
   copy of this file included textarea by mistake; nothing used it. */
.field input, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--rule-strong);
  border-radius: var(--radius); font: inherit; font-size: 0.93rem; background: var(--paper);
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* Empty and loading states ------------------------------------------------ */

.empty { padding: 46px 24px; text-align: center; color: var(--ink-muted); }
.empty h3 {
  font-family: var(--sans); font-size: 1rem; font-weight: 600;
  color: var(--ink); margin-bottom: 6px;
}
.empty p { font-size: 0.92rem; margin: 0 auto; max-width: 44ch; }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--rule-strong); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast ------------------------------------------------------------------- */

.toast {
  position: fixed; bottom: 22px; left: 50%;
  /* Its own height plus the bottom offset, rather than the 120% app.html used
     to use. An idle toast is empty, so it is only 22px tall and 120% of that is
     26.4px — 4.4px short of the 22px it is held off the floor by, which left a
     sliver of dark tab visible at the bottom of every page. Measured at 17.6px
     of exposed toast on /app before this file existed. */
  transform: translateX(-50%) translateY(calc(100% + 22px));
  padding: 11px 18px; border-radius: var(--radius);
  background: var(--ink); color: var(--paper); font-size: 0.9rem;
  box-shadow: var(--shadow-lg); transition: transform 0.25s ease; z-index: 90;
}
.toast.is-visible { transform: translateX(-50%) translateY(0); }
.toast--error { background: var(--conflict); }

/* Modal ------------------------------------------------------------------- */

.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.modal__scrim { position: absolute; inset: 0; background: rgba(20, 22, 26, 0.45); }
.modal__card {
  position: relative; width: 100%; max-width: 520px; max-height: 88vh;
  display: flex; flex-direction: column;
  border-radius: var(--radius-lg); background: var(--paper-raised);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--rule);
}
.modal__head h2 {
  margin: 0; font-family: var(--sans); font-size: 1rem; font-weight: 600; letter-spacing: 0;
}
.modal__body { padding: 20px; overflow-y: auto; }

/* Narrow ------------------------------------------------------------------ */

@media (max-width: 860px) {
  .panel__head { flex-wrap: wrap; }
  .filters { width: 100%; }
  .filters input, .filters select { flex: 1 1 140px; min-width: 0; }
}

@media (max-width: 600px) {
  .panel__head { padding: 12px 14px; gap: 10px; }
  .panel__body { padding: 12px; }
  .panel__foot { padding: 10px 14px; }
  .filters { gap: 7px; }

  /* A bottom sheet rather than a centred dialog: a card floating in the
     middle of a phone screen wastes the space the keyboard is about to take. */
  .modal { padding: 0; place-items: end stretch; }
  .modal__card {
    max-width: none; max-height: 94dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  /* The sheet is flush to the bottom edge, so its last control lands on the
     home indicator without this. Same inset as the tab bar, same reason. */
  .modal__body { padding: 16px calc(16px + env(safe-area-inset-right, 0px))
                         calc(16px + env(safe-area-inset-bottom, 0px))
                         calc(16px + env(safe-area-inset-left, 0px)); }
}
