:root {
  color-scheme: light;
  --ink: #12211f;
  --muted: #65716e;
  --line: #cbd8d1;
  --surface: #ffffff;
  --surface-soft: #eef5f0;
  --brand: #163c3a;
  --brand-2: #b85c38;
  --accent: #e2b044;
  --ok: #247a4d;
  --danger: #b83f3f;
  --shadow: 0 18px 45px rgba(12, 28, 27, 0.12);
}

* {
  box-sizing: border-box;
  min-width: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(22, 60, 58, 0.1), transparent 35%),
    linear-gradient(315deg, rgba(226, 176, 68, 0.18), transparent 28%),
    #f7faf7;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: calc(100% - 28px);
  max-width: 1180px;
  margin: 0 auto;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 0 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-lockup {
  width: 220px;
  min-height: 72px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 8px 10px;
  text-decoration: none;
}

.brand-lockup-light {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 30px rgba(7, 24, 22, 0.18);
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 650px;
  font-size: clamp(2rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.35rem;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--brand-2);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.status-pill,
.draft-state,
.record-count {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 8px 12px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.74);
}

.workspace {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 18px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(203, 216, 209, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand);
  font-size: 1.5rem;
  font-weight: 700;
}

.form-grid,
.controls-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.mode-option {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  text-transform: none;
  cursor: pointer;
}

.mode-option.active {
  border-color: var(--brand);
  background: #f4faf7;
  color: var(--ink);
}

.mode-option input {
  width: 18px;
  height: 18px;
}

.mode-option span {
  display: grid;
  gap: 3px;
  font-size: 0.82rem;
  line-height: 1.25;
}

.mode-option strong {
  color: var(--brand);
  font-size: 0.92rem;
}

.session-card {
  display: grid;
  gap: 11px;
  margin: 14px 0 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff9eb;
}

.session-card[hidden] {
  display: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 12px;
  text-transform: none;
}

textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(226, 176, 68, 0.45);
  outline-offset: 2px;
}

.record-card {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.record-button {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 1.05rem;
  font-weight: 900;
}

.record-button.recording {
  background: var(--danger);
}

#recordIcon {
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
}

#recordStatus {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.timer-row strong {
  color: var(--brand);
  font-size: 1.35rem;
  letter-spacing: 0;
}

.timer-row span {
  overflow-wrap: anywhere;
}

audio {
  width: 100%;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.file-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: 900;
  text-transform: none;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.small-button {
  min-height: 44px;
}

.transcription-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.4;
  padding: 11px 12px;
}

.transcription-box.working {
  border-color: var(--accent);
  color: var(--brand);
}

.transcription-box.error {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff7f7;
}

.job-progress {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px 12px;
}

.job-progress[hidden] {
  display: none;
}

.job-progress div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.job-progress strong,
.job-progress span {
  color: var(--brand);
  font-size: 0.86rem;
}

progress {
  width: 100%;
  height: 12px;
  accent-color: var(--brand);
}

.transcript-label {
  margin-top: 10px;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 900;
}

.primary-button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: white;
}

.ghost-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--brand);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.summary-strip div {
  min-height: 74px;
  border-radius: 8px;
  padding: 12px;
  background: #f8fbf9;
  border: 1px solid var(--line);
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-strip strong {
  display: block;
  margin-top: 8px;
  color: var(--brand);
  font-size: clamp(1rem, 3vw, 1.4rem);
  letter-spacing: 0;
}

.daily-fields {
  display: grid;
  gap: 11px;
}

.signature-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: none;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.records-panel {
  margin: 18px auto 34px;
}

.login-panel {
  margin-bottom: 18px;
}

body.authenticated .login-panel {
  display: none;
}

body:not(.authenticated) .workspace,
body:not(.authenticated) .records-panel,
body:not(.authenticated) .admin-grid {
  display: none;
}

.controls-row {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.monthly-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(0, 1.18fr);
  gap: 16px;
  margin-top: 16px;
}

.records-list {
  display: grid;
  gap: 10px;
  align-content: start;
}

.record-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
}

.record-item strong {
  display: block;
  margin-bottom: 4px;
}

.record-item p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.monthly-report {
  min-height: 340px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
}

.monthly-report h3 {
  margin: 0 0 14px;
  color: var(--brand);
  font-size: 1.35rem;
}

.monthly-report h4 {
  margin: 18px 0 8px;
  font-size: 0.9rem;
  color: var(--brand-2);
  text-transform: uppercase;
}

.monthly-report p,
.monthly-report li {
  color: var(--ink);
  line-height: 1.5;
}

.monthly-report ul {
  padding-left: 18px;
}

.empty-state {
  color: var(--muted);
}

.admin-body {
  background:
    linear-gradient(180deg, #163c3a 0, #163c3a 270px, transparent 270px),
    linear-gradient(135deg, rgba(226, 176, 68, 0.11), transparent 34%),
    #f4f6f3;
}

.admin-body .app-shell {
  max-width: 1240px;
}

.admin-header {
  align-items: center;
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.11), transparent 45%),
    #1b4946;
  box-shadow: 0 20px 50px rgba(7, 24, 22, 0.24);
  color: white;
}

.admin-title-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-product-mark {
  width: 62px;
  height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  color: #fff7dd;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}

.admin-header .eyebrow {
  color: #e2b044;
}

.admin-header h1 {
  color: white;
  max-width: 820px;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1.02;
}

.admin-subtitle {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.98rem;
  line-height: 1.45;
  margin-top: 7px;
}

.admin-header .status-pill,
.admin-header .ghost-button {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.admin-link {
  text-decoration: none;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 34px;
}

.admin-body .panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(186, 200, 191, 0.84);
  box-shadow: 0 10px 28px rgba(24, 45, 41, 0.08);
}

.admin-body .panel-heading {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(203, 216, 209, 0.82);
}

.admin-body .panel-heading h2 {
  font-size: 1.12rem;
}

.admin-panel-priority {
  border-top: 4px solid var(--accent) !important;
}

.admin-data-panel {
  border-top: 4px solid var(--brand) !important;
}

.setup-panel {
  grid-row: span 2;
}

.qr-layout {
  display: grid;
  grid-template-columns: minmax(210px, 260px) 1fr;
  gap: 18px;
  align-items: center;
}

.qr-box {
  min-height: 260px;
  border: 1px solid rgba(22, 60, 58, 0.15);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #ffffff, #f8fbf9);
  display: grid;
  place-items: center;
  padding: 14px;
  box-shadow: inset 0 0 0 6px #f3f7f4;
}

.qr-box svg {
  width: 100%;
  max-width: 240px;
  height: auto;
}

.link-stack {
  display: grid;
  gap: 12px;
}

.helper-text {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.admin-stats,
.checklist,
.host-profile,
.client-list,
.user-list {
  display: grid;
  gap: 10px;
}

.admin-stats,
.host-profile {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-stat,
.check-item,
.client-card,
.user-card {
  border: 1px solid rgba(203, 216, 209, 0.9);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 12px;
}

.admin-stat {
  min-height: 78px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-stat span,
.check-item span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-stat strong,
.check-item strong {
  color: var(--brand);
  overflow-wrap: anywhere;
}

.admin-stat strong {
  font-size: 1.02rem;
}

.check-item {
  display: grid;
  gap: 4px;
}

.check-item.ok {
  border-color: rgba(36, 122, 77, 0.4);
  background: #f3fbf6;
}

.check-item.todo {
  border-color: rgba(184, 92, 56, 0.45);
  background: #fff9eb;
}

.check-item p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin-top: 5px;
}

.check-item.warn {
  border-color: rgba(226, 176, 68, 0.65);
  background: #fffdf2;
}

.facility-panel,
.clients-panel,
.users-panel {
  grid-column: span 2;
}

.facility-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.72fr) auto;
  gap: 12px;
  align-items: end;
}

.client-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.client-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px auto;
  gap: 12px;
  align-items: end;
  border-left: 4px solid rgba(22, 60, 58, 0.22);
}

.user-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 150px minmax(120px, 0.7fr) auto;
  gap: 12px;
  align-items: end;
}

.user-card strong {
  color: var(--brand);
  display: block;
}

.user-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: capitalize;
}

.user-status {
  border: 1px solid rgba(36, 122, 77, 0.25);
  border-radius: 999px;
  padding: 5px 10px;
  background: #f0faf4;
}

@media (max-width: 860px) {
  .app-header {
    display: grid;
    align-items: start;
  }

  .workspace,
  .monthly-layout,
  .controls-row,
  .admin-grid,
  .qr-layout,
  .admin-stats,
  .host-profile,
  .facility-form,
  .client-create-form,
  .client-card,
  .user-create-form {
    grid-template-columns: 1fr;
  }

  .facility-panel,
  .clients-panel,
  .users-panel {
    grid-column: auto;
  }

  .controls-row .primary-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: calc(100% - 20px);
  }

  .app-header {
    padding-top: 18px;
  }

  .admin-header {
    padding: 16px;
  }

  .admin-title-block {
    display: grid;
  }

  .admin-product-mark {
    width: 54px;
    height: 54px;
  }

  .brand-lockup {
    width: min(220px, 100%);
    min-height: 66px;
    justify-self: start;
  }

  h1 {
    max-width: 330px;
    font-size: 1.76rem;
    line-height: 1.03;
  }

  .panel {
    padding: 14px;
  }

  .form-grid,
  .summary-strip,
  .mode-switch {
    grid-template-columns: 1fr;
  }

  .button-row {
    display: grid;
  }

  .upload-row {
    grid-template-columns: 1fr;
  }

  .timer-row {
    display: grid;
    justify-content: start;
  }

  .admin-header .status-pill,
  .panel-heading .draft-state {
    justify-self: start;
  }

  .panel-heading {
    display: grid;
    align-items: start;
    justify-content: stretch;
  }
}

@media print {
  body {
    background: white;
  }

  .app-header,
  .note-panel,
  .records-panel,
  .button-row {
    display: none !important;
  }

  .app-shell,
  .workspace {
    width: 100%;
    display: block;
  }

  .panel {
    box-shadow: none;
    border: 0;
  }
}
