:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #687471;
  --line: #d9dfdc;
  --panel: rgba(255, 255, 255, 0.84);
  --surface: #ffffff;
  --soft: #eef4f0;
  --soft-2: #f7f1e9;
  --accent: #216e62;
  --accent-strong: #18564c;
  --accent-soft: #dfece7;
  --accent-2: #c16b4b;
  --warm: #c16b4b;
  --success: #2f7d54;
  --danger: #a54432;
  --shadow: 0 18px 45px rgba(24, 33, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #f6f8f6 0%, #edf4f1 42%, #fbf2ea 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 72px;
  padding: 12px clamp(14px, 4vw, 42px);
  background: #17211f;
  color: #ffffff;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  color: #dbeaf0;
  letter-spacing: 2px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo:hover {
  color: #ffffff;
}

.logo-word {
  font-size: 26px;
  font-weight: 700;
}

.logo-script {
  position: relative;
  top: -1px;
  margin: 0 -1px 0 1px;
  color: #4a91b3;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 50px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

.tool-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-2);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.header-subtitle {
  max-width: 660px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.35;
}

.header-actions,
.section-heading,
.toolbar,
.field-grid,
.admin-actions,
.card-actions {
  display: flex;
  gap: 10px;
}

.header-actions {
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.section-heading {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.project-context {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 680px);
  gap: 18px;
  justify-content: center;
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 42px) 44px;
}

.capture-panel,
.review-panel,
.admin-panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: clamp(14px, 3vw, 22px);
}

.quick-capture-grid {
  display: grid;
  grid-template-columns: 0.78fr 1.22fr;
  gap: 10px;
}

.capture-icon-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  padding: 12px;
}

.capture-icon-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(33, 110, 98, 0.18);
}

.capture-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 26px;
}

.capture-card-title span:not(.capture-icon) {
  font-size: 0.95rem;
  font-weight: 850;
}

.capture-icon-card small,
.file-status {
  color: var(--muted);
  line-height: 1.25;
}

.capture-icon {
  display: none;
}

.capture-icon-card input[type="file"] {
  min-height: 42px;
  padding: 8px;
}

.note-card textarea {
  min-height: 66px;
  margin-top: 2px;
}

.intel-form,
.admin-form {
  display: grid;
  gap: 12px;
}

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

label,
fieldset {
  display: grid;
  gap: 7px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

fieldset {
  border: 0;
  padding: 0;
}

legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 760;
}

.optional {
  color: #8a9099;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  line-height: 1.4;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(33, 110, 98, 0.18);
  outline: none;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 164px;
  overflow: auto;
  padding-bottom: 2px;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #f8fbf8;
  color: var(--ink);
  padding: 7px 11px;
  font-size: 0.82rem;
  font-weight: 750;
}

.chip input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.chip input:focus-visible + span {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(33, 110, 98, 0.18);
}

.collapsible-options {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.collapsible-options summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  padding: 0 14px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 760;
  list-style: none;
}

.collapsible-options summary::-webkit-details-marker {
  display: none;
}

.collapsible-options summary::after {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 0;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 1rem;
  line-height: 1;
  flex: 0 0 auto;
}

.collapsible-options[open] summary::after {
  content: "-";
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.primary-button,
.secondary-button,
.small-button,
.icon-only-button,
.text-button,
.card-actions button {
  min-height: 44px;
  border-radius: 0;
  border: 1px solid transparent;
  font-weight: 850;
}

.primary-button {
  width: 100%;
  background: var(--accent);
  color: #ffffff;
  padding: 0 18px;
}

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

.secondary-button,
.small-button,
.icon-only-button,
.card-actions button {
  background: #ffffff;
  border-color: var(--line);
  color: var(--accent);
  padding: 0 13px;
}

.secondary-button:hover,
.small-button:hover,
.icon-only-button:hover,
.card-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tool-header .small-button {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.tool-header .small-button:hover {
  border-color: rgba(255, 255, 255, 0.42);
  color: #ffffff;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.auth-status {
  color: #dbeaf0;
  font-size: 0.82rem;
  font-weight: 800;
}

.sync-status {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #8a9099;
  box-shadow: 0 0 0 1px var(--line);
  flex: 0 0 auto;
}

.sync-status.synced {
  background: var(--success);
}

.sync-status.pending {
  background: #d99d2b;
}

.sync-status.offline {
  background: var(--danger);
}

.icon-only-button {
  width: 44px;
  padding: 0;
  font-size: 1.1rem;
}

.text-button {
  min-height: 36px;
  background: transparent;
  color: var(--danger);
  padding: 0 4px;
}

.count-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  border-radius: 0;
  background: #eef7f3;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 850;
  padding: 4px 10px;
  white-space: nowrap;
}

.status-badge.reviewed {
  background: #e6f3ec;
  color: var(--success);
}

.status-badge.duplicate,
.status-badge.archived {
  background: #f2ebe7;
  color: var(--warm);
}

.location-status,
.form-error,
.admin-help {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.form-error {
  min-height: 18px;
  color: var(--danger);
  font-weight: 760;
}

.toolbar {
  margin-bottom: 14px;
}

.toolbar input {
  flex: 1;
}

.toolbar select {
  max-width: 150px;
}

.entries {
  display: grid;
  gap: 12px;
}

.entry-card {
  border: 1px solid var(--line);
  border-radius: 0;
  background: #ffffff;
  padding: 15px;
}

.entry-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.entry-meta,
.entry-notes,
.empty-state,
.ai-details,
.entry-details {
  color: var(--muted);
  line-height: 1.45;
}

.entry-meta {
  margin-bottom: 12px;
  font-size: 0.84rem;
}

.entry-notes {
  margin-bottom: 10px;
  color: var(--ink);
}

.entry-details,
.ai-details dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 10px;
  margin: 0 0 10px;
  font-size: 0.84rem;
}

.entry-details dt,
.ai-details dt {
  color: var(--ink);
  font-weight: 850;
}

.entry-details dd,
.ai-details dd {
  margin: 0;
}

.media-preview {
  margin: 10px 0;
}

.media-attachment-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.media-preview img,
.media-preview video {
  display: block;
  width: 100%;
  max-height: min(70vh, 720px);
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #f8faf8;
}

.media-preview a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.file-preview {
  border: 1px dashed var(--line);
  border-radius: 0;
  padding: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.ai-details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 0.88rem;
}

.ai-details summary {
  margin-bottom: 8px;
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 850;
}

.card-actions,
.admin-actions {
  flex-wrap: wrap;
  padding-top: 4px;
}

.card-actions button {
  min-height: 38px;
  font-size: 0.82rem;
}

.empty-state,
.success-panel {
  margin: 0;
  border: 1px dashed var(--line);
  border-radius: 0;
  padding: 20px;
  text-align: center;
}

.success-panel p {
  color: var(--muted);
}

.admin-drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: stretch end;
  background: rgba(32, 33, 36, 0.38);
}

.admin-panel {
  width: min(900px, 100%);
  height: 100%;
  overflow: auto;
  border-radius: 0;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.admin-tab {
  min-height: 42px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-weight: 850;
}

.admin-tab.is-active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.admin-section {
  min-width: 0;
}

.admin-entries {
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding-right: 4px;
}

.admin-form textarea {
  min-height: 120px;
  font-family: inherit;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .section-heading,
  .toolbar,
  .compact-grid,
  .admin-actions {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .tool-header {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-height: 64px;
    padding: 10px 12px;
  }

  .brand-logo {
    overflow: hidden;
    letter-spacing: 1.4px;
  }

  .logo-word {
    font-size: clamp(18px, 5.8vw, 24px);
  }

  .logo-script {
    font-size: clamp(36px, 10vw, 46px);
  }

  .header-actions {
    display: flex;
    width: auto;
    gap: 8px;
  }

  .tool-header .small-button {
    min-height: 40px;
    padding: 0 12px;
  }

  .app-shell {
    padding: 12px 9px 32px;
  }

  .quick-capture-grid {
    grid-template-columns: 1fr;
  }

  .capture-icon-card {
    min-height: 88px;
  }

  .toolbar select,
  .admin-actions > * {
    width: 100%;
    max-width: none;
  }

  .capture-panel,
  .review-panel,
  .admin-panel {
    border-radius: 0;
  }

  .chip-grid {
    max-height: none;
    overflow: visible;
  }

  .admin-drawer {
    place-items: stretch;
  }

  .entry-card__header {
    flex-direction: column;
  }
}
