:root {
  --ink: #20233a;
  --muted: #747782;
  --paper: #ffffff;
  --soft: #f7f4ef;
  --line: #e9e4da;
  --sky: #ddecf6;
  --gold: #c7a05a;
  --bronze: #9c6b43;
  --red: #cf0910;
  --green: #2f7d5a;
  --shadow: 0 24px 74px rgba(32, 35, 58, 0.1);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Montserrat", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  background:
    radial-gradient(circle at 8% 8%, rgba(221, 236, 246, 0.95), transparent 28%),
    radial-gradient(circle at 92% 2%, rgba(199, 160, 90, 0.26), transparent 28%),
    linear-gradient(135deg, #fff 0%, #f7f4ef 100%);
}

button, input { font: inherit; }
button { color: inherit; }

.hero {
  padding: 34px 22px 78px;
  border-bottom: 1px solid rgba(233, 228, 218, 0.78);
  background:
    radial-gradient(circle at 12% 8%, rgba(221, 236, 246, 0.78), transparent 30%),
    radial-gradient(circle at 88% 0%, rgba(199, 160, 90, 0.18), transparent 28%),
    linear-gradient(135deg, #fff 0%, #faf8f4 56%, #f5f8fb 100%);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: end;
  max-width: 1680px;
  margin: 0 auto;
}

.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 30px; }
.brand__mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(156, 107, 67, 0.18);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 40px rgba(32, 35, 58, 0.06);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -2px;
}
.brand__copy { color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.5; letter-spacing: 0.13em; text-transform: uppercase; }
.eyebrow { margin: 0 0 8px; color: var(--bronze); font-size: 10px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
h1 { max-width: 900px; margin: 0; font-size: clamp(36px, 5vw, 64px); font-weight: 800; line-height: 0.98; letter-spacing: -0.06em; }
.hero__subtitle { max-width: 760px; margin: 18px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }

.today-card {
  min-width: 285px;
  padding: 20px 22px;
  border: 1px solid rgba(156, 107, 67, 0.18);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 18px 52px rgba(32, 35, 58, 0.07);
}
.today-card span, .today-card em { display: block; color: var(--muted); font-size: 11px; font-style: normal; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.today-card strong { display: block; margin: 7px 0 4px; font-size: 25px; letter-spacing: -0.04em; }

.shell { position: relative; z-index: 2; max-width: 1680px; margin: -34px auto 64px; padding: 0 16px; }
.deadline-panel, .calendar-card {
  border: 1px solid rgba(233, 228, 218, 0.9);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.deadline-panel { padding: 24px; }
.deadline-panel__head { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 16px; }
.deadline-panel h2, .calendar-card h2 { margin: 0; font-size: 24px; letter-spacing: -0.04em; }
.deadline-panel__count { padding: 8px 12px; border-radius: 999px; background: var(--soft); color: var(--bronze); font-size: 11px; font-weight: 800; }
.deadline-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.deadline-item { min-height: 96px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, #fff, rgba(247, 244, 239, 0.58)); }
.deadline-item--empty { display: grid; grid-column: 1 / -1; min-height: 72px; place-items: center; color: var(--muted); font-size: 12px; }
.deadline-item__date { display: flex; justify-content: space-between; gap: 8px; color: var(--bronze); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.deadline-item__date b { color: var(--red); }
.deadline-item h3 { margin: 10px 0 6px; font-size: 13px; line-height: 1.35; }
.deadline-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }

.calendar-card { margin-top: 18px; overflow: hidden; }
.calendar-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); background: rgba(247, 244, 239, 0.55); }
.month-navigation { display: flex; gap: 10px; align-items: center; }
.month-navigation strong { min-width: 46px; text-align: center; }
.icon-button, .tool-button, .secondary-button, .primary-button, .text-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.icon-button { width: 40px; }
button:hover, .text-button--label:hover { transform: translateY(-1px); border-color: rgba(156, 107, 67, 0.42); box-shadow: 0 8px 20px rgba(32, 35, 58, 0.07); }
.month-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin; }
.month-tab { flex: 0 0 auto; min-height: 36px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.month-tab.active { background: var(--ink); color: #fff; }
.save-area { display: flex; gap: 12px; align-items: center; }
.save-status { max-width: 150px; color: var(--green); font-size: 9px; font-weight: 700; line-height: 1.35; text-align: right; }
.save-status.dirty { color: var(--red); }
.primary-button { padding: 0 18px; border-color: var(--ink); background: var(--ink); color: #fff; font-size: 11px; }
.primary-button:disabled { cursor: wait; opacity: 0.58; transform: none; box-shadow: none; }

.calendar-title-row { display: flex; justify-content: space-between; gap: 20px; align-items: end; padding: 24px 24px 12px; }
.legend, .color-palette { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.legend__label { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.color-swatch { width: 30px; height: 30px; border: 2px solid transparent; border-radius: 50%; cursor: pointer; }
.color-swatch.active { border-color: var(--ink); box-shadow: 0 0 0 3px #fff inset; }
.tool-button { min-height: 34px; padding: 0 12px; font-size: 10px; }
.tool-button.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.tool-button--clear.active { border-color: var(--red); background: var(--red); }
.usage-hint { margin: 0; padding: 0 24px 18px; color: var(--muted); font-size: 10px; line-height: 1.55; }

.table-scroll { max-width: 100%; overflow: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.activity-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 10px; }
.activity-table th, .activity-table td { height: 28px; padding: 0; border-right: 1px dashed rgba(116, 119, 130, 0.42); border-bottom: 1px dashed rgba(116, 119, 130, 0.42); }
.activity-table thead th { position: sticky; top: 0; z-index: 4; background: var(--soft); color: var(--muted); font-size: 8px; font-weight: 800; text-align: center; text-transform: uppercase; }
.activity-table .sticky { position: sticky; z-index: 3; background: #fff; }
.activity-table thead .sticky { z-index: 6; background: var(--soft); }
.activity-table .team-col { left: 0; width: 68px; min-width: 68px; }
.activity-table .direction-col { left: 68px; width: 108px; min-width: 108px; }
.activity-table .task-col { left: 176px; width: 248px; min-width: 248px; }
.activity-table .delete-col { left: 424px; width: 74px; min-width: 74px; border-right: 1px solid var(--line); }
.activity-table .day-head, .activity-table .day-cell { width: 24px; min-width: 24px; }
.activity-table .weekend { background-image: linear-gradient(rgba(221, 236, 246, 0.42), rgba(221, 236, 246, 0.42)); }
.activity-table .today { box-shadow: inset 2px 0 var(--gold), inset -2px 0 var(--gold); }
.editable { min-height: 28px; padding: 6px 7px; box-sizing: border-box; outline: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editable:focus { box-shadow: inset 0 0 0 2px var(--gold); background: #fffdf8; }
.team-cell .editable { font-weight: 800; text-align: center; }
.activity-table .direction-cell { background: color-mix(in srgb, var(--direction-color) 17%, white); border-left: 5px solid var(--direction-color); }
.activity-table .task-cell { box-shadow: inset 3px 0 var(--direction-color); }
.direction-cell .editable { color: var(--direction-color); font-weight: 800; }
.day-cell { position: relative; cursor: crosshair; user-select: none; }
.day-cell::after { content: attr(data-label); position: absolute; inset: 0; display: grid; place-items: center; font-size: 8px; font-weight: 900; }
.day-cell.is-deadline::after { content: "ДЛ"; }
.row-actions { display: flex; height: 100%; align-items: stretch; }
.row-actions button { width: 25px; min-width: 25px; height: 100%; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; }
.move-task { color: var(--ink); font-size: 15px; }
.move-task:hover:not(:disabled) { background: var(--soft); }
.move-task:disabled { color: #c8c9cf; cursor: default; }
.delete-task { color: #a4a6ae; font-size: 16px; }
.delete-task:hover { color: var(--red); box-shadow: none; transform: none; }
.empty-row td { height: 110px; color: var(--muted); text-align: center; }

.calendar-footer { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 18px 22px; }
.calendar-footer__primary { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.secondary-button { padding: 0 17px; color: var(--bronze); font-size: 11px; }
.secondary-button--copy { color: var(--ink); }
.footer-actions { display: flex; gap: 8px; }
.text-button { min-height: 36px; padding: 0 13px; color: var(--muted); font-size: 10px; }
.text-button--label { display: inline-grid; place-items: center; }
.storage-note { margin: 16px 8px 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 340px; padding: 14px 18px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: 11px; font-weight: 700; opacity: 0; pointer-events: none; transform: translateY(10px); transition: 0.2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1040px) {
  .deadline-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calendar-toolbar { grid-template-columns: 1fr auto; }
  .month-tabs { grid-column: 1 / -1; grid-row: 2; }
  .save-area { grid-column: 2; grid-row: 1; }
}

@media (max-width: 720px) {
  .hero { padding: 24px 14px 68px; }
  .hero__inner { grid-template-columns: 1fr; }
  .brand { margin-bottom: 22px; }
  .today-card { min-width: 0; }
  .shell { margin-top: -34px; padding: 0 10px; }
  .deadline-panel, .calendar-card { border-radius: 22px; }
  .deadline-list { grid-template-columns: 1fr; }
  .calendar-toolbar { grid-template-columns: 1fr; }
  .month-tabs, .save-area { grid-column: 1; grid-row: auto; }
  .save-area { justify-content: space-between; }
  .calendar-title-row { align-items: flex-start; flex-direction: column; }
  .activity-table .team-col { width: 74px; min-width: 74px; }
  .activity-table .direction-col { left: 74px; width: 108px; min-width: 108px; }
  .activity-table .task-col { left: 182px; width: 220px; min-width: 220px; }
  .activity-table .delete-col { left: 402px; }
  .activity-table .day-head, .activity-table .day-cell { width: 23px; min-width: 23px; }
  .calendar-footer { align-items: flex-start; flex-direction: column; }
}
