:root {
  color-scheme: light;
  --bg: #f8f7f2;
  --surface: #ffffff;
  --surface-strong: #f0efe7;
  --ink: #24211b;
  --muted: #6f6a60;
  --line: #ded9cd;
  --accent: #1f6f5b;
  --accent-strong: #145846;
  --accent-soft: #e5f2ed;
  --warning: #a86612;
  --warning-soft: #fff3dd;
  --danger: #b13f35;
  --danger-soft: #fbe8e5;
  --info: #315f9c;
  --info-soft: #e8eef8;
  --shadow: 0 14px 40px rgb(36 33 27 / 0.10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

body {
  min-height: 100vh;
}

button {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 16px;
  line-height: 1.25;
}

.app-shell {
  width: min(1120px, 100%);
  max-width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr minmax(150px, 220px);
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.meeting-title,
.meeting-date {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  inline-size: 100%;
  max-inline-size: 100%;
  min-width: 0;
  min-inline-size: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(31 111 91 / 0.16);
}

.meeting-title input {
  font-size: 1.1rem;
  font-weight: 800;
}

.meeting-date input[type="date"] {
  display: block;
  width: 100%;
  max-width: 100%;
  inline-size: 100%;
  max-inline-size: 100%;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px;
}

.tab {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 14px rgb(36 33 27 / 0.08);
}

main {
  flex: 1;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.metric {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric strong {
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1;
}

.metric span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input {
  min-height: 50px;
  font-size: 1rem;
  font-weight: 650;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

.results,
.log-list,
.present-list,
.settings-list,
.export-grid,
.tool-panel {
  display: grid;
  gap: 10px;
}

.result-card,
.present-section,
.present-item,
.log-item,
.tool-panel,
.settings-list,
.empty-state,
.summary-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.result-card {
  padding: 12px;
  display: grid;
  gap: 12px;
}

.result-main {
  display: grid;
  gap: 4px;
}

.result-title {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.result-title h3 {
  margin: 0;
  font-size: 1rem;
}

.result-meta {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.owners-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.owner-pill,
.badge {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.owner-pill {
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.badge.present {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.badge.pending {
  color: var(--warning);
  background: var(--warning-soft);
}

.badge.proxy {
  color: var(--info);
  background: var(--info-soft);
}

.badge.correction {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.none {
  color: var(--muted);
  background: var(--surface-strong);
}

.card-actions,
.modal-actions,
.export-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 13px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 850;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.danger {
  border-color: rgb(177 63 53 / 0.45);
  color: var(--danger);
  background: var(--danger-soft);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.empty-state {
  padding: 26px 16px;
  display: grid;
  justify-items: start;
  gap: 10px;
}

.empty-state h2,
.section-heading h2,
.modal-panel h2 {
  margin: 0;
}

.empty-state p,
.section-heading p {
  margin: 0;
  color: var(--muted);
}

.section-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.section-heading.compact {
  grid-template-columns: 1fr minmax(130px, 180px);
  align-items: center;
}

.tool-panel,
.settings-list {
  padding: 12px;
}

.file-input {
  padding: 9px;
}

.summary-box {
  min-height: 74px;
  padding: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.summary-box:empty {
  display: none;
}

.summary-box strong {
  color: var(--ink);
}

.log-item {
  padding: 10px 12px;
  display: grid;
  gap: 3px;
}

.log-item strong {
  font-size: 0.92rem;
}

.log-item span {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.present-section {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.present-section h3 {
  margin: 0;
  font-size: 1rem;
}

.present-items {
  display: grid;
  gap: 8px;
}

.present-item {
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.present-item strong,
.present-item span,
.present-item small {
  display: block;
}

.present-item span,
.present-item small,
.empty-inline {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.present-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toggle-row {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink);
}

.toggle-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 650;
}

.toggle-row input {
  width: 24px;
  min-height: 24px;
}

.check-row {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 850;
}

.check-row input {
  width: 22px;
  min-height: 22px;
  flex: 0 0 22px;
}

.pin-form {
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.statusbar {
  min-height: 34px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.modal,
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgb(36 33 27 / 0.42);
  padding: 16px;
  align-items: center;
  justify-content: center;
}

.modal:not([aria-hidden="true"]),
.lock-screen:not([hidden]) {
  display: flex;
}

.modal[aria-hidden="true"],
.lock-screen[hidden] {
  display: none;
}

.modal-panel,
.lock-panel {
  width: min(520px, 100%);
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-body {
  color: var(--muted);
  line-height: 1.5;
}

.effect-text {
  margin: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 850;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
}

.segmented label {
  display: block;
  color: var(--ink);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  min-height: 40px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  padding: 8px;
  font-weight: 850;
}

.segmented input:checked + span {
  background: var(--surface);
  box-shadow: 0 4px 14px rgb(36 33 27 / 0.08);
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  width: min(520px, calc(100% - 32px));
  margin: 0 auto;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.75rem;
  font-weight: 900;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr;
  }

  .meeting-date input[type="date"] {
    width: -webkit-fill-available;
    max-width: -webkit-fill-available;
    inline-size: -webkit-fill-available;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .tabbar {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
    box-shadow: inset -28px 0 18px -20px rgb(36 33 27 / 0.42);
    padding-right: 22px;
  }

  .tab {
    flex: 0 0 92px;
    scroll-snap-align: start;
  }

  .dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-active .dashboard {
    display: none;
  }

  .search-active .search-row {
    position: sticky;
    top: 8px;
    z-index: 5;
    background: var(--bg);
    padding-bottom: 4px;
  }

  .card-actions .button,
  .export-grid .button,
  .present-item .button,
  .modal-actions .button {
    flex: 1 1 140px;
  }

  .present-item {
    grid-template-columns: 1fr;
  }

  .present-actions {
    justify-content: stretch;
  }

  .section-heading.compact {
    grid-template-columns: 1fr;
  }

  .pin-form {
    grid-template-columns: 1fr;
  }

  .modal,
  .lock-screen {
    align-items: flex-start;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .modal-panel,
  .lock-panel {
    max-height: calc(100dvh - 24px);
  }
}
