:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --panel: #fffdfa;
  --panel-soft: #f0eee9;
  --text: #20201d;
  --muted: #737168;
  --line: #dedbd2;
  --accent: #ff6b35;
  --accent-soft: #ffe1d4;
  --shadow: 0 24px 60px rgba(38, 35, 29, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(360px, 620px) minmax(420px, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: var(--text);
  color: white;
  font-weight: 700;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.compose-button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--text);
  color: white;
  font-weight: 650;
}

.source-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  margin-top: 18px;
  overflow: auto;
}

.source-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.source-item.is-active,
.source-item:hover {
  background: var(--panel-soft);
  color: var(--text);
}

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

.sidebar-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 12px;
}

.ghost-button,
.ghost-link {
  display: grid;
  min-height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.timeline {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.9);
  backdrop-filter: blur(18px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.view-controls {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
}

.segmented {
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segmented.is-active {
  background: var(--text);
  color: white;
}

.entry-list {
  padding: 8px;
}

.entry-card {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 14px;
  width: 100%;
  min-height: 126px;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.entry-card:hover,
.entry-card.is-active {
  background: var(--panel-soft);
}

.entry-card.compact {
  grid-template-columns: 1fr;
  min-height: 86px;
}

.entry-card.compact .entry-image {
  display: none;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.entry-title {
  margin-top: 7px;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.26;
}

.entry-excerpt {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.entry-image {
  width: 86px;
  height: 86px;
  align-self: center;
  border-radius: 11px;
  background: var(--accent-soft);
  object-fit: cover;
}

.reader {
  min-width: 0;
  padding: 34px;
  background: #fbfaf7;
}

.empty-reader {
  display: grid;
  height: calc(100vh - 68px);
  place-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-icon {
  margin: 0 auto 16px;
  color: var(--accent);
  font-size: 40px;
}

.reader-article {
  max-width: 740px;
  margin: 0 auto;
}

.reader-article .kicker {
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
}

.reader-article h2 {
  margin-top: 12px;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.reader-article .date {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.reader-article img {
  width: 100%;
  max-height: 360px;
  margin-top: 24px;
  border-radius: 14px;
  object-fit: cover;
}

.reader-article p {
  margin-top: 22px;
  color: #4b4942;
  font-size: 17px;
  line-height: 1.72;
}

.reader-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.reader-actions a {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--text);
  color: white;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.admin-dialog {
  width: min(760px, calc(100vw - 28px));
  border: 0;
  border-radius: 16px;
  padding: 0;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-dialog::backdrop {
  background: rgba(24, 23, 21, 0.28);
  backdrop-filter: blur(4px);
}

.admin-panel {
  padding: 20px;
}

.admin-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
}

.admin-panel header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 20px;
}

.login-panel,
.source-form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  background: white;
  color: var(--text);
}

.admin-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.source-admin-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
}

.source-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.source-row strong {
  display: block;
  font-size: 14px;
}

.source-row span {
  color: var(--muted);
  font-size: 12px;
}

.delete-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: #f3e2df;
  color: #9a2f20;
}

.form-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

.loading,
.error-state {
  padding: 34px;
  color: var(--muted);
}

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

  .reader {
    display: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .source-list {
    max-height: 210px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-content {
    grid-template-columns: 1fr;
  }
}
