:root {
  color-scheme: light;
  --bg: #f4f5f2;
  --panel: #ffffff;
  --ink: #191919;
  --muted: #6a716d;
  --line: #cfd5d0;
  --accent: #b81824;
  --accent-strong: #8f1019;
  --soft: #edf1ee;
  --outside: #e7ece9;
  --shadow: 0 18px 50px rgba(20, 24, 22, .12);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: #242927;
}

button.ghost-button {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.danger {
  background: #151515;
}

.icon-button {
  width: 36px;
  padding: 0;
  background: #ecefed;
  color: var(--ink);
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login h1 {
  margin: 4px 0 22px;
  font-size: 34px;
  letter-spacing: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: #202421;
  color: #fff;
  padding: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.brand__mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent);
  font-size: 24px;
  font-weight: 900;
}

.brand small,
.project-button small {
  display: block;
  color: #c1c8c4;
  margin-top: 2px;
}

.project-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.project-button {
  width: 100%;
  text-align: left;
  min-height: auto;
  padding: 12px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}

.project-button.is-active {
  background: #fff;
  color: var(--ink);
}

.project-button.is-active small {
  color: var(--muted);
}

.sidebar .ghost-button {
  color: #fff;
  border-color: rgba(255,255,255,.28);
  width: 100%;
}

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  padding: 18px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__actions {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
}

.project-title {
  width: min(520px, 70vw);
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 30px;
  font-weight: 850;
  padding: 4px 0;
  letter-spacing: 0;
}

.project-title:focus {
  outline: 0;
  border-bottom-color: var(--accent);
}

label,
.compact-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

.settings-band {
  display: grid;
  grid-template-columns: 1.2fr .95fr .95fr;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: #fafbf9;
}

details {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

summary {
  cursor: pointer;
  font-weight: 850;
  margin-bottom: 10px;
}

.table-like,
.frequency-grid,
.target-grid {
  display: grid;
  gap: 8px;
}

.type-row,
.frequency-row,
.target-row {
  display: grid;
  gap: 8px;
  align-items: center;
}

.type-row {
  grid-template-columns: minmax(120px, 1fr) 74px 54px 34px;
}

.frequency-row {
  grid-template-columns: minmax(130px, 1fr) 94px 34px;
}

.target-row {
  grid-template-columns: minmax(110px, 1fr) 132px 132px 78px 34px;
}

input[type="color"] {
  padding: 3px;
}

.mini-remove {
  min-width: 34px;
  width: 34px;
  padding: 0;
  background: #e4e8e5;
  color: var(--ink);
}

.inline-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px 0;
}

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

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.calendar-stack {
  display: grid;
  gap: 18px;
  padding: 14px 22px 28px;
}

.month {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.month__title {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  margin: 0;
  padding: 10px 12px;
  text-align: center;
  font-size: 24px;
  letter-spacing: 0;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 12px;
}

.month__title:hover {
  background: #f6f7f5;
}

.month__title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.month.is-collapsed .month__title {
  justify-content: space-between;
  font-size: 18px;
  padding: 12px 14px;
}

.month.is-collapsed .weekdays,
.month.is-collapsed .month-grid {
  display: none;
}

.weekdays,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
}

.weekday {
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #f1f3f1;
  padding: 8px;
  text-align: center;
  font-weight: 850;
  font-size: 13px;
}

.day {
  min-height: 122px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 6px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 5px;
  cursor: pointer;
}

.day.is-outside {
  background: var(--outside);
}

.day.is-drop {
  outline: 3px solid rgba(184, 24, 36, .32);
  outline-offset: -3px;
}

.day__head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.day__holiday {
  color: #3b403d;
  font-size: 10px;
  font-weight: 750;
}

.day__items {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 5px;
}

.target-bar {
  height: 18px;
  border-radius: 4px;
  background: #111;
  color: #fff;
  font-size: 10px;
  line-height: 18px;
  padding: 0 5px;
  overflow: hidden;
  white-space: nowrap;
}

.target-bar.is-open {
  border-right: 4px solid #fff;
}

.post-card {
  min-height: 66px;
  flex: 1 1 82px;
  border-radius: 4px;
  color: #111;
  padding: 7px;
  display: grid;
  gap: 3px;
  cursor: grab;
  border: 1px solid rgba(0,0,0,.18);
  overflow: hidden;
}

.post-card:active {
  cursor: grabbing;
}

.post-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.post-card.has-media {
  min-height: 170px;
  flex: 1 1 148px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  color: var(--ink);
  text-shadow: none;
}

.post-card.has-video {
  background-image: linear-gradient(135deg, rgba(0,0,0,.18), rgba(0,0,0,.42));
}

.post-card__badge {
  min-height: 42px;
  padding: 6px 8px;
  display: grid;
  align-content: center;
  gap: 1px;
}

.post-card__badge span {
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  text-transform: uppercase;
}

.post-card__badge strong {
  font-size: 15px;
  line-height: 1.05;
  font-weight: 900;
}

.post-card__image {
  min-height: 118px;
  flex: 1;
  display: grid;
  place-items: center;
  background: #fff;
}

.post-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.post-card__caption {
  padding: 5px 7px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  line-height: 1.15;
}

.post-card__title {
  font-weight: 900;
  line-height: 1.1;
}

.post-card__sub {
  font-size: 11px;
  line-height: 1.2;
}

.editor {
  width: min(760px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.editor::backdrop {
  background: rgba(10, 12, 11, .5);
}

.editor form {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.dialog-head,
.dialog-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.dialog-head h2 {
  margin: 2px 0 0;
  font-size: 26px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.dialog-actions {
  grid-template-columns: auto 1fr auto auto;
  padding: 0;
  margin: 4px 0 0;
}

.media-preview {
  display: grid;
  gap: 8px;
}

.media-preview img,
.media-preview video {
  max-width: 100%;
  max-height: 260px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #000;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #191d1a;
  color: #fff;
  padding: 12px 14px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 40;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .project-list {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .settings-band {
    grid-template-columns: 1fr;
  }

  .weekdays,
  .month-grid {
    grid-template-columns: repeat(7, minmax(94px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    display: grid;
    align-items: start;
  }

  .project-title {
    width: 100%;
    font-size: 24px;
  }

  .calendar-stack {
    padding: 12px;
    overflow-x: auto;
  }

  .month {
    min-width: 720px;
  }

  .form-grid,
  .target-row {
    grid-template-columns: 1fr;
  }
}
