:root {
  --ink: #092653;
  --ink-soft: #1b375f;
  --line: #cfd7e3;
  --paper: #fbfcff;
  --navy: #082b58;
  --navy-deep: #05234d;
  --muted: #6d7b8f;
  --shadow: 0 14px 38px rgba(9, 38, 83, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef2f6;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

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

button {
  cursor: pointer;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 36rem),
    linear-gradient(135deg, #eef3f9 0%, #ffffff 52%, #f1f5f9 100%);
}

.sheet {
  width: min(1440px, 100%);
  min-height: calc(100vh - 36px);
  margin: 0 auto;
  padding: 26px 30px 24px;
  background: var(--paper);
  border: 1px solid #d6dee8;
  box-shadow: var(--shadow);
}

.plan-header {
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(330px, 1fr) minmax(245px, 0.72fr);
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}

.title-block h1 {
  margin: 0 0 11px;
  color: var(--navy);
  font-size: clamp(2.15rem, 3vw, 3.5rem);
  font-weight: 760;
  letter-spacing: 0;
  line-height: 0.95;
  white-space: nowrap;
}

.title-block p,
.purpose-block p,
.frequency-block p {
  margin: 0;
  font-size: clamp(0.98rem, 1.1vw, 1.22rem);
  line-height: 1.38;
}

.title-block p + p {
  margin-top: 9px;
}

.month-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  font-size: clamp(0.98rem, 1.1vw, 1.22rem);
}

.month-nav {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c9d3df;
  border-radius: 8px;
}

.month-nav svg {
  width: 18px;
  height: 18px;
}

.month-picker {
  width: 138px;
  min-height: 32px;
  padding: 5px 8px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c9d3df;
  border-radius: 8px;
}

.linkedin-mark {
  display: inline-grid;
  width: 40px;
  height: 40px;
  margin-left: 8px;
  place-items: center;
  color: white;
  background: #0a66c2;
  border-radius: 7px;
  font-size: 26px;
  font-weight: 750;
  line-height: 1;
  vertical-align: middle;
}

.purpose-block,
.frequency-block {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.purpose-block {
  padding-left: 28px;
  border-left: 1px solid #bfc8d5;
}

.purpose-block h2,
.frequency-block h2,
.notes h2,
.legend h2 {
  margin: 0 0 7px;
  font-size: 0.88rem;
  font-weight: 720;
  letter-spacing: 0.02em;
}

.round-icon,
.check-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  color: white;
  background: var(--navy);
  border-radius: 50%;
}

.round-icon svg {
  width: 29px;
  height: 29px;
}

.line-icon {
  width: 50px;
  height: 50px;
  color: var(--navy);
}

.line-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 1.8;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: -2px 0 10px;
}

.icon-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c9d3df;
  border-radius: 8px;
  font-weight: 700;
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

.icon-button.primary {
  color: white;
  background: var(--navy);
  border-color: var(--navy);
}

.icon-button[aria-pressed="true"] {
  color: white;
  background: #17416f;
  border-color: #17416f;
}

.calendar-wrap {
  overflow-x: auto;
  border: 1px solid #c9d3df;
  border-radius: 12px;
}

.calendar {
  width: 100%;
  min-width: 1040px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.calendar.weekend-mode {
  min-width: 1260px;
}

.calendar th {
  height: 42px;
  color: white;
  background: linear-gradient(180deg, var(--navy-deep), #082e5f);
  border-right: 1px solid rgba(255, 255, 255, 0.45);
  font-size: 0.98rem;
  font-weight: 720;
  letter-spacing: 0.02em;
}

.calendar th:first-child {
  width: 160px;
}

.calendar th:last-child {
  border-right: 0;
}

.calendar td {
  height: 160px;
  vertical-align: top;
  padding: 14px 12px;
  background: rgba(255, 255, 255, 0.72);
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.calendar tr:first-child td {
  border-top: 0;
}

.calendar td:last-child {
  border-right: 0;
}

.week-cell {
  display: grid;
  height: 100%;
  align-content: center;
  gap: 18px;
  text-align: center;
}

.week-cell strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 720;
}

.week-cell span {
  display: block;
  font-size: 1rem;
}

.day-cell {
  position: relative;
}

.post-card {
  width: 100%;
  min-height: 116px;
  margin-bottom: 8px;
  padding: 11px 12px 10px;
  color: var(--ink);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--cat-color), white 85%), #ffffff 65%),
    #fff;
  border: 1px solid color-mix(in srgb, var(--cat-color), white 50%);
  border-radius: var(--radius);
  text-align: left;
  box-shadow: 0 6px 14px rgba(9, 38, 83, 0.05);
}

.post-card:hover {
  border-color: color-mix(in srgb, var(--cat-color), #092653 12%);
  box-shadow: 0 10px 20px rgba(9, 38, 83, 0.1);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-bottom: 8px;
}

.post-card .linkedin-mini {
  display: inline-grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  color: white;
  background: #0a66c2;
  border-radius: 5px;
  font-size: 19px;
  font-weight: 750;
  line-height: 1;
}

.category-pill {
  display: inline-flex;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 24px;
  align-items: center;
  padding: 3px 9px;
  overflow: hidden;
  color: color-mix(in srgb, var(--cat-color), #061f46 58%);
  background: color-mix(in srgb, var(--cat-color), white 83%);
  border: 1px solid color-mix(in srgb, var(--cat-color), white 40%);
  border-radius: 6px;
  font-size: clamp(0.6rem, 0.58vw, 0.7rem);
  font-weight: 720;
  letter-spacing: 0.03em;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.post-card h3 {
  margin: 0 0 8px;
  font-size: 1.03rem;
  line-height: 1.2;
}

.post-card p {
  margin: 0 0 10px;
  font-size: 0.86rem;
  line-height: 1.32;
}

.post-format {
  font-size: 0.82rem;
}

.plan-footer {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(520px, 1.15fr);
  gap: 28px;
  margin-top: 16px;
}

.notes {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
}

.check-icon {
  width: 34px;
  height: 34px;
}

.check-icon svg {
  width: 22px;
  height: 22px;
}

.notes ul {
  margin: 0;
  padding-left: 18px;
}

.notes li {
  margin-bottom: 5px;
}

.legend {
  padding-left: 26px;
  border-left: 1px solid #bfc8d5;
}

.legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 34px;
  align-items: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

.legend-dot {
  width: 16px;
  height: 16px;
  background: var(--cat-color);
  border-radius: 50%;
  opacity: 0.35;
}

.modal {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: transparent;
  overflow: visible;
}

.modal::backdrop {
  background: rgba(5, 22, 48, 0.42);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: 100%;
  max-height: calc(100vh - 32px);
  padding: 20px;
  overflow: auto;
  background: #fff;
  border: 1px solid #d4dce7;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.modal-card.wide {
  width: 100%;
}

.modal-card header,
.modal-card footer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.modal-card footer {
  grid-template-columns: auto 1fr auto auto;
  margin-top: 18px;
}

.modal-card h2 {
  margin: 0;
  font-size: 1.35rem;
}

.bare-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.bare-button:hover {
  background: #edf2f7;
}

.bare-button svg {
  width: 21px;
  height: 21px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 700;
}

label.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--ink);
  background: #f9fbfe;
  border: 1px solid #c9d3df;
  border-radius: 8px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #0a66c2;
  box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.14);
}

.save-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 700;
}

.save-button {
  color: white;
  background: var(--navy);
  border: 1px solid var(--navy);
}

.ghost-button {
  color: var(--ink);
  background: #fff;
  border: 1px solid #c9d3df;
}

.danger-button {
  color: #9b1731;
  background: #fff0f3;
  border: 1px solid #ffc0cc;
}

.category-editor {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.category-row,
.add-category-row {
  display: grid;
  grid-template-columns: 1fr 64px auto auto;
  gap: 10px;
  align-items: center;
}

.add-category-row {
  grid-template-columns: 1fr 64px auto;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #d6dee8;
}

.category-row input[type="color"],
.add-category-row input[type="color"] {
  height: 42px;
  padding: 4px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 12px 14px;
  color: white;
  background: var(--navy);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .plan-header,
  .plan-footer {
    grid-template-columns: 1fr;
  }

  .purpose-block,
  .legend {
    padding-left: 0;
    border-left: 0;
  }

  .title-block h1 {
    white-space: normal;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 10px;
  }

  .sheet {
    min-height: calc(100vh - 20px);
    padding: 20px 14px;
  }

  .plan-header {
    gap: 18px;
  }

  .title-block h1 {
    font-size: 2.35rem;
  }

  .title-block p,
  .purpose-block p,
  .frequency-block p {
    font-size: 1rem;
  }

  .toolbar {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .icon-button span {
    display: none;
  }

  .calendar th:first-child {
    width: 140px;
  }

  .calendar td {
    height: 186px;
  }

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

  .modal-card footer {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 6mm;
  }

  html,
  body {
    width: auto;
    height: auto;
    overflow: visible;
  }

  body,
  .app-shell {
    background: #fff;
  }

  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .app-shell {
    padding: 0;
    min-height: 0;
  }

  .sheet {
    width: 100%;
    height: 198mm;
    max-height: none;
    min-height: 0;
    padding: 3mm;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 0;
    box-shadow: none;
  }

  .plan-header {
    grid-template-columns: 1.25fr 1fr 0.7fr;
    gap: 5mm;
    margin-bottom: 2mm;
  }

  .title-block h1 {
    margin-bottom: 2mm;
    font-size: 18pt;
    line-height: 1;
  }

  .title-block p,
  .purpose-block p,
  .frequency-block p,
  .month-row {
    font-size: 7.5pt;
    line-height: 1.25;
  }

  .linkedin-mark {
    width: 7mm;
    height: 7mm;
    font-size: 13pt;
    border-radius: 1.2mm;
  }

  .purpose-block {
    padding-left: 5mm;
  }

  .purpose-block h2,
  .frequency-block h2,
  .notes h2,
  .legend h2 {
    margin-bottom: 1mm;
    font-size: 7pt;
  }

  .round-icon,
  .line-icon {
    width: 8.5mm;
    height: 8.5mm;
  }

  .round-icon svg,
  .line-icon svg {
    width: 6mm;
    height: 6mm;
  }

  .no-print,
  .modal,
  .toast {
    display: none !important;
  }

  .calendar-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    border-radius: 2mm;
  }

  .calendar {
    width: 100%;
    height: 100%;
    min-width: 0;
    font-size: 7pt;
  }

  .calendar th {
    height: 6mm;
    font-size: 6.5pt;
  }

  .calendar th:first-child {
    width: 24mm;
  }

  .calendar td {
    height: auto;
    padding: 1.2mm;
  }

  .week-cell {
    gap: 2mm;
  }

  .week-cell strong {
    font-size: 8pt;
  }

  .week-cell span {
    font-size: 7pt;
  }

  .post-card {
    min-height: 0;
    max-height: 13.5mm;
    margin-bottom: 1mm;
    padding: 1.1mm;
    overflow: hidden;
    box-shadow: none;
  }

  .post-meta {
    gap: 1mm;
    margin-bottom: 1mm;
  }

  .post-card .linkedin-mini {
    width: 4.2mm;
    height: 4.2mm;
    font-size: 8.5pt;
    border-radius: 1mm;
  }

  .category-pill {
    min-height: 4.2mm;
    padding: 0.5mm 1.2mm;
    font-size: 5pt;
    border-radius: 1mm;
  }

  .post-card h3 {
    margin-bottom: 1mm;
    font-size: 6.8pt;
    line-height: 1.12;
  }

  .post-card p {
    display: -webkit-box;
    margin-bottom: 0.7mm;
    overflow: hidden;
    font-size: 5.8pt;
    line-height: 1.12;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .post-format {
    font-size: 5.7pt;
  }

  .plan-footer {
    flex: 0 0 auto;
    grid-template-columns: 1fr 1fr;
    gap: 6mm;
    margin-top: 2mm;
    font-size: 6.2pt;
  }

  .check-icon {
    width: 7mm;
    height: 7mm;
  }

  .check-icon svg {
    width: 5mm;
    height: 5mm;
  }

  .legend-list {
    gap: 2mm 6mm;
  }

  .legend-dot {
    width: 3.5mm;
    height: 3.5mm;
  }
}
