:root {
  --brand-primary: #254a4f;
  --brand-light: #f3f8f7;
  --text-main: #254a4f;
  --border-soft: #c4d4d8;
  --card-bg: #ffffff;
  --danger: #b3261e;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);
  background-color: var(--brand-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background-color: var(--brand-primary);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  height: 40px;
  object-fit: contain;
}

.header-text h1 {
  font-size: 1.4rem;
  font-weight: 600;
}

.header-subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
}

.header-right {
  display: flex;
  align-items: center;
}

.pdf-button {
  background-color: #ffffff;
  color: var(--brand-primary);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.08s ease;
}

.pdf-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  background-color: var(--brand-light);
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.sidebar {
  border-right: 1px solid var(--border-soft);
  background-color: #ffffff;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.sidebar-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  color: #6c7c80;
}

.chapter-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background-color 0.08s ease, color 0.08s ease;
}

.chapter-item span:first-child {
  white-space: normal;
}

.chapter-item .badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background-color: var(--brand-light);
  color: var(--brand-primary);
}

.chapter-item:hover {
  background-color: var(--brand-light);
}

.chapter-item.active {
  background-color: var(--brand-primary);
  color: #ffffff;
}

.content {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.content-area {
  padding: 1.25rem 1.25rem 4.5rem;
  overflow-y: auto;
}

.content-card {
  background-color: var(--card-bg);
  border-radius: 1rem;
  padding: 1.25rem 1.25rem 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border-soft);
}

.pill {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--brand-light);
  color: var(--brand-primary);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}

.content-card h1 {
  font-size: 1.4rem;
  margin-bottom: 0.35rem;
}

.content-subtitle {
  font-size: 0.9rem;
  color: #5c6b6f;
  margin-bottom: 0.9rem;
}

.content-body p {
  margin-bottom: 0.55rem;
  line-height: 1.45;
}

.section-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.section-pill {
  font-size: 0.78rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  cursor: pointer;
  background-color: #ffffff;
  white-space: nowrap;
  max-width: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
}

.section-pill.active {
  background-color: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.section-heading {
  font-size: 1rem;
  margin: 0.75rem 0 0.4rem;
}

.procedure-steps {
  margin-left: 1.25rem;
  margin-bottom: 0.75rem;
}

.procedure-steps li {
  margin-bottom: 0.35rem;
}

.callout {
  border-radius: 0.6rem;
  padding: 0.55rem 0.65rem;
  font-size: 0.87rem;
  margin: 0.4rem 0;
}

.callout.warning {
  border: 1px solid var(--danger);
  background-color: #fdeaea;
  color: #5c1b17;
}

.callout.info {
  border: 1px solid var(--border-soft);
  background-color: var(--brand-light);
}

.meta {
  font-size: 0.8rem;
  color: #6c7c80;
  margin-top: 0.6rem;
}

.pdf-link {
  color: var(--brand-primary);
  font-weight: 600;
  text-decoration: none;
}

.pdf-link:hover {
  text-decoration: underline;
}

.search-bar {
  border-top: 1px solid var(--border-soft);
  background-color: #ffffff;
  padding: 0.5rem 1.25rem;
}

.search-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#searchInput {
  flex: 1;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

.icon-button {
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  padding: 0.4rem 0.8rem;
  background-color: var(--brand-light);
  cursor: pointer;
  font-size: 1rem;
}

.icon-button.listening {
  background-color: var(--brand-primary);
  color: #ffffff;
}

.search-result {
  padding: 0.4rem 0;
}

.search-result-title {
  font-weight: 600;
  cursor: pointer;
}

.search-result-title:hover {
  text-decoration: underline;
}

hr {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 0.4rem 0;
}

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

  .sidebar {
    grid-row: 2;
    border-right: none;
    border-top: 1px solid var(--border-soft);
  }

  .content-area {
    padding-bottom: 4.5rem;
  }
}
