:root {
  --bg: #f3efe6;
  --bg-accent: radial-gradient(circle at top left, rgba(173, 107, 55, 0.18), transparent 30%),
    linear-gradient(135deg, #f7f3eb 0%, #eee3d2 100%);
  --panel: rgba(255, 252, 247, 0.92);
  --panel-border: rgba(98, 64, 37, 0.12);
  --text: #2d2118;
  --muted: #7e6957;
  --accent: #b55233;
  --accent-dark: #8f3f26;
  --shadow: 0 18px 42px rgba(87, 56, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Hiragino Sans", sans-serif;
  color: var(--text);
  background: var(--bg-accent);
}

a {
  color: inherit;
}

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 12px 28px;
}

.content,
.config-layout,
.form-stack,
.feed-list,
.subscription-list,
.calendar-grid,
.calendar-bars,
.calendar-legend {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 100%;
}

.feed-card-head,
.feed-footer,
.subscription-card,
.subscription-actions,
.topbar,
.nav,
.app-toolbar,
.toolbar-left,
.toolbar-right,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow,
.section-label,
.feed-source {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  color: var(--muted);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.topbar {
  margin-bottom: 16px;
}

.nav-link {
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
}

.nav-link.active {
  background: rgba(181, 82, 51, 0.12);
  color: var(--accent-dark);
}

.button,
input,
select {
  border-radius: 14px;
  border: 1px solid rgba(98, 64, 37, 0.12);
  font: inherit;
}

.button {
  cursor: pointer;
  padding: 11px 14px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.65);
}

.nav-mini {
  min-width: 42px;
  padding-inline: 0;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}

.compact-link {
  min-width: 74px;
  text-align: center;
}

.button.primary {
  color: #fff7f2;
  background: linear-gradient(135deg, var(--accent) 0%, #d27c43 100%);
  border: none;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.55);
}

.status-pill,
.tag,
.month-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
}

.status-pill,
.month-pill {
  background: rgba(181, 82, 51, 0.09);
  color: var(--accent-dark);
}

.month-pill {
  font-weight: 700;
  white-space: nowrap;
}

.feed-card,
.subscription-card {
  border: 1px solid rgba(98, 64, 37, 0.1);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 250, 244, 0.82);
}

.feed-content {
  margin: 14px 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag {
  background: rgba(181, 82, 51, 0.09);
  color: var(--accent-dark);
}

.feed-footer {
  margin-top: 14px;
  font-size: 14px;
  color: var(--muted);
}

.calendar-legend {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.legend-item,
.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.color-editor {
  display: inline-grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
}

.color-editor-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.color-editor input[type="color"] {
  width: 56px;
  min-width: 56px;
  height: 36px;
  padding: 4px;
  border-radius: 10px;
  cursor: pointer;
}

.color-hex-input {
  width: 104px;
  min-width: 104px;
  padding: 8px 10px;
  text-transform: lowercase;
}

.color-save {
  padding-block: 8px;
}

.color-status {
  font-size: 13px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex: 0 0 14px;
}

.calendar-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  border-radius: 18px;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.calendar-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  width: max-content;
  min-width: 700px;
}

.calendar-weekday {
  padding: 6px 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.calendar-cell {
  min-height: 112px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(98, 64, 37, 0.1);
  background: rgba(255, 250, 244, 0.86);
}

.calendar-cell-empty {
  background: transparent;
  border-style: dashed;
}

.calendar-day {
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 13px;
}

.calendar-bars {
  gap: 6px;
}

.calendar-bar {
  display: grid;
  gap: 2px;
  padding: 6px 7px;
  border-radius: 10px;
  color: var(--bar-text-color, #fffdf8);
  text-decoration: none;
  background: linear-gradient(
    135deg,
    var(--bar-color),
    color-mix(in srgb, var(--bar-color) 72%, black)
  );
}

.calendar-bar-name,
.calendar-bar-time {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-bar-name {
  font-size: 11px;
  font-weight: 700;
}

.calendar-bar-time {
  font-size: 10px;
  opacity: 0.92;
}

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

.empty-state {
  padding: 24px;
  text-align: center;
  border: 1px dashed rgba(98, 64, 37, 0.16);
  border-radius: 18px;
  color: var(--muted);
}

.form-stack label {
  display: grid;
  gap: 8px;
}

input,
select {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.76);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

@media (max-width: 768px) {
  .shell {
    padding: 8px 6px 18px;
  }

  .app-toolbar,
  .feed-card-head,
  .feed-footer,
  .subscription-card,
  .subscription-actions,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
    gap: 6px;
    justify-content: flex-start;
  }

  .toolbar-left {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
  }

  .toolbar-left .month-pill {
    grid-column: 1 / -1;
    justify-content: center;
    padding: 10px 14px;
    font-size: 16px;
  }

  .toolbar-right {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
  }

  .toolbar-right .button,
  .toolbar-right .status-pill,
  .toolbar-right .compact-link {
    width: 100%;
    justify-content: center;
  }

  .button,
  .status-pill,
  .month-pill {
    font-size: 14px;
  }

  .panel {
    padding: 10px;
    border-radius: 16px;
  }

  .content {
    gap: 10px;
  }

  .calendar-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 6px;
  }

  .legend-item {
    font-size: 12px;
  }

  .calendar-grid {
    width: 100%;
    min-width: 0;
    gap: 4px;
  }

  .calendar-cell {
    min-height: 19vw;
    padding: 4px;
    border-radius: 10px;
  }

  .calendar-bar {
    padding: 4px;
    border-radius: 7px;
    gap: 1px;
  }

  .calendar-bar-name {
    font-size: 8px;
    line-height: 1.15;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .calendar-bar-time {
    font-size: 8px;
    line-height: 1.1;
    white-space: normal;
  }

  .calendar-day {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .calendar-weekday {
    font-size: 9px;
    padding: 4px 2px;
    text-align: center;
  }

  .calendar-scroll {
    min-height: 0;
    overflow: visible;
    margin-inline: 0;
    padding-bottom: 0;
  }

  .feed-card {
    padding: 14px;
  }

  .color-editor-controls {
    align-items: stretch;
  }

  .color-save {
    min-width: 110px;
  }
}

@media (max-width: 480px) {
  .shell {
    padding: 6px 4px 14px;
  }

  .panel {
    padding: 8px;
    border-radius: 14px;
  }

  .content {
    gap: 8px;
  }

  .toolbar-left {
    grid-template-columns: 38px 1fr 38px;
    gap: 4px;
  }

  .toolbar-right {
    grid-template-columns: 1fr auto auto;
    gap: 4px;
  }

  .button,
  .status-pill,
  .month-pill {
    font-size: 12px;
    padding: 8px 10px;
  }

  .nav-mini {
    min-width: 38px;
    font-size: 18px;
  }

  .compact-link {
    min-width: 62px;
  }

  .toolbar-left .month-pill {
    font-size: 14px;
    padding: 8px 10px;
  }

  .calendar-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .legend-item {
    gap: 6px;
    font-size: 10px;
    min-width: 0;
  }

  .legend-item span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .legend-swatch {
    width: 10px;
    height: 10px;
    flex-basis: 10px;
  }

  .calendar-grid {
    gap: 3px;
  }

  .calendar-cell {
    min-height: 18vw;
    padding: 3px;
    border-radius: 8px;
  }

  .calendar-bars {
    gap: 3px;
  }

  .calendar-bar {
    padding: 3px;
    border-radius: 6px;
  }

  .calendar-bar-name {
    font-size: 7px;
  }

  .calendar-bar-time {
    font-size: 7px;
  }

  .calendar-day {
    font-size: 10px;
    margin-bottom: 3px;
  }

  .calendar-weekday {
    font-size: 8px;
    padding: 3px 1px;
  }
}
