:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #09090b;
  --muted: #71717a;
  --border: #e4e4e7;
  --card: #ffffff;
  --accent: #f4f4f5;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --ring: #d4d4d8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  height: 100%;
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  display: flex;
  flex-direction: column;
  width: min(1180px, calc(100% - 32px));
  height: 100vh;
  margin: 0 auto;
  padding: 14px 0;
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.brand-line {
  display: flex;
  align-items: baseline;
  min-width: 0;
  gap: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1.1;
}

h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.muted {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.meta-line {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-filter {
  margin-top: 10px;
  min-height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fafafa;
  color: #27272a;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.toolbar,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar {
  align-items: center;
  flex-wrap: nowrap;
}

.top-search {
  width: 210px;
}

.button,
.input {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--background);
  color: var(--foreground);
  padding: 8px 12px;
  font-size: 14px;
  line-height: 20px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
}

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

.button.secondary:hover,
.input:focus {
  border-color: var(--ring);
  background: #fafafa;
  outline: none;
}

.filter-panel {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.filter-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  align-items: start;
}

.category-select {
  width: min(100%, 360px);
}

.date-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.date-sort {
  width: 150px;
}

.date-input {
  width: 150px;
}

.filter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  padding-top: 6px;
}

.filter-toggle {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding-left: 0;
  text-align: left;
}

.filter-toggle:hover {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 70px;
  overflow: hidden;
}

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

.chip {
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: #3f3f46;
  cursor: pointer;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 650;
}

.chip:hover,
.chip.active {
  border-color: #18181b;
  background: #18181b;
  color: #ffffff;
}

.card {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 12px;
  margin-top: 12px;
}

.grid-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
  margin-bottom: 10px;
}

.grid-status .muted {
  margin-top: 0;
}

.data-grid-wrap {
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}

.data-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.data-grid th,
.data-grid td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
  line-height: 1.35;
}

.data-grid th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafafa;
  color: #52525b;
  font-weight: 750;
}

.data-grid tr:last-child td {
  border-bottom: 0;
}

.data-grid th:first-child,
.date-cell {
  width: 96px;
}

.data-grid th:nth-child(2),
.category-cell {
  width: 158px;
}

.data-grid th:nth-child(3),
.tag-cell {
  width: 190px;
}

.date-cell {
  color: #52525b;
  white-space: nowrap;
}

.category-cell {
  white-space: nowrap;
}

.tag-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-button,
.tag-button {
  max-width: 144px;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: #3f3f46;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-button {
  max-width: 176px;
  color: #52525b;
  font-weight: 600;
}

.category-button:hover,
.tag-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.summary-cell {
  color: #18181b;
}

.summary-link {
  display: -webkit-box;
  overflow: hidden;
  color: inherit;
  font-size: 10pt;
  line-height: 1.25;
  text-decoration: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.summary-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.grid-link {
  color: var(--foreground);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.muted-link {
  color: var(--muted);
}

.empty {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 26px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 28px, 1180px);
    padding-top: 12px;
  }

  .topbar,
  .grid-status {
    align-items: stretch;
    display: flex;
    flex-direction: column;
  }

  .top-search {
    width: 100%;
  }

  .brand-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .filter-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .data-grid {
    min-width: 760px;
  }

  .input {
    width: 100%;
  }
}
