* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--catalog-shell-text);
  background: var(--catalog-shell-bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.law-news-shell {
  --catalog-shell-bg: #f6f1ea;
  --catalog-shell-panel: #fffdf9;
  --catalog-shell-border: #decfc4;
  --catalog-shell-text: #211c18;
  --catalog-shell-muted: #786d64;
  --catalog-shell-accent: #2a4e45;
  --catalog-shell-accent-weak: #e2eee9;
}

.law-news-search-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.law-news-shell .side-title-row h1 {
  font-size: 20px;
  line-height: 1.25;
}

.field-label {
  color: var(--catalog-shell-muted);
  font-size: 12px;
  font-weight: 700;
}

.law-news-query-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.law-news-query-box {
  position: relative;
  min-width: 0;
}

.law-news-query-box input {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--catalog-shell-border);
  border-radius: 6px;
  padding: 0 10px;
  background: #fffdf9;
  color: var(--catalog-shell-text);
}

.law-news-query-suggestions {
  position: absolute;
  z-index: 22;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 4px;
  padding: 6px;
  background: #fffdf9;
  border: 1px solid var(--catalog-shell-border);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(31, 45, 43, 0.14);
}

.law-news-query-suggestions[hidden] {
  display: none;
}

.law-news-query-suggestion {
  width: 100%;
  min-height: 32px;
  text-align: left;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--catalog-shell-text);
}

.law-news-query-suggestion:hover,
.law-news-query-suggestion:focus-visible {
  background: var(--catalog-shell-accent-weak);
  border-color: #8db6aa;
  outline: none;
}

.law-news-source-section {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.law-news-source-dropdown {
  position: relative;
}

.law-news-source-select {
  width: 100%;
  height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 0 10px;
  background: #fffdf9;
  border: 1px solid var(--catalog-shell-border);
  border-radius: 6px;
  color: var(--catalog-shell-text);
}

.law-news-query-box input:focus-visible,
.law-news-source-select:focus-visible,
.law-news-source-button:focus-visible {
  outline: 2px solid #8db6aa;
  outline-offset: 2px;
}

.source-caret {
  color: var(--catalog-shell-muted);
  font-size: 14px;
  transition: transform 160ms ease;
}

.law-news-source-dropdown.open .source-caret {
  transform: rotate(180deg);
}

.law-news-source-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  background: #fffdf9;
  border: 1px solid var(--catalog-shell-border);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(31, 45, 43, 0.14);
}

.law-news-source-list[hidden] {
  display: none;
}

.law-news-source-button {
  width: 100%;
  min-height: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 6px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
}

.law-news-source-button.active {
  background: var(--catalog-shell-accent-weak);
  border-color: #8db6aa;
}

.source-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-count {
  color: var(--catalog-shell-muted);
  font-size: 12px;
}

.law-news-results {
  overflow: auto;
  min-height: 0;
  padding: 10px 10px 14px;
}

.law-news-result-row {
  width: 100%;
  text-align: left;
  border: 1px solid var(--catalog-shell-border);
  border-radius: 6px;
  background: #fffdf9;
  padding: 10px;
  white-space: normal;
}

.law-news-result-row:hover,
.law-news-result-row.selected {
  border-color: #8db6aa;
  background: #eef6f2;
}

.law-news-result-title {
  font-size: 14px;
  font-weight: 760;
  line-height: 1.35;
}

.law-news-result-meta {
  margin-top: 5px;
  color: var(--catalog-shell-muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.law-news-result-snippet {
  margin-top: 7px;
  color: #4f433b;
  font-size: 12px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--catalog-shell-border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--catalog-shell-text);
  text-decoration: none;
  background: #fffdf9;
  white-space: nowrap;
  transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.source-link:hover {
  border-color: #8db6aa;
  background: #f3f8f5;
  transform: translateY(-1px);
}

.law-news-content {
  background:
    linear-gradient(90deg, rgba(42, 78, 69, .045) 1px, transparent 1px),
    linear-gradient(rgba(42, 78, 69, .045) 1px, transparent 1px),
    #fffdf9;
  background-size: 54px 54px;
}

.law-news-pane {
  display: none;
  max-width: 1080px;
  line-height: 1.72;
  font-size: 16px;
}

.law-news-pane.active {
  display: block;
}

.law-news-generated {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.law-news-original {
  margin: 0;
  max-width: 1080px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #211c18;
  font: 14px/1.72 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.more-button {
  margin-top: 18px;
}

.inline-status {
  color: var(--catalog-shell-muted);
}

.inline-error {
  color: #9f2f2f;
}

@media (max-width: 900px) and (orientation: portrait) {
  .law-news-shell .topbar {
    gap: 8px;
    padding: 10px 12px 8px;
  }

  .law-news-shell .topbar-left {
    gap: 8px;
    max-height: 94px;
    overflow: hidden;
  }

  .law-news-shell .topbar-title {
    max-height: 82px;
    overflow: hidden;
  }

  .law-news-shell .title {
    display: -webkit-box;
    overflow: hidden;
    font-size: 18px;
    line-height: 1.25;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .law-news-shell .meta {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .law-news-shell .actions {
    max-width: 112px;
  }

  .law-news-shell .source-link {
    min-height: 34px;
    padding: 7px 10px;
  }

  .law-news-query-row {
    grid-template-columns: 1fr;
  }

  .law-news-query-row button {
    width: 100%;
  }

  .law-news-source-list {
    max-height: 220px;
  }
}
