:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #eee9df;
  --text: #1f2933;
  --muted: #61707c;
  --line: #d9d2c4;
  --teal: #2d6f70;
  --teal-dark: #194f52;
  --rust: #a75e45;
  --blue: #345b82;
  --green: #58785a;
  --shadow: 0 18px 50px rgba(36, 43, 48, 0.12);
  --radius: 8px;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  color: #f7faf9;
  background: #21313a;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: #f0d7a2;
  color: #24313a;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.76);
  text-decoration: none;
  border-radius: var(--radius);
}

.nav-list a:hover,
.nav-list a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.11);
}

.nav-list svg,
button svg,
.search-box svg,
.empty-state svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.mini-stat {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.07);
}

.mini-stat span,
.mini-stat small {
  display: block;
}

.mini-stat span {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.mini-stat small {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.68);
}

.main {
  min-width: 0;
  padding: 28px clamp(18px, 3vw, 42px) 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: #17232b;
  font-size: 34px;
  line-height: 1.08;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(560px, 48vw);
}

.search-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 220px;
}

.search-box svg {
  position: absolute;
  left: 12px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px 0 40px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.search-box input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45, 111, 112, 0.16);
}

.primary,
.secondary,
.chip,
.day-button,
.doc-button,
.copy-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
  font-weight: 750;
  text-decoration: none;
}

.primary {
  color: #fff;
  background: var(--teal-dark);
}

.primary:hover {
  background: #123e41;
}

.secondary,
.doc-button,
.day-button,
.chip {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
}

.secondary:hover,
.doc-button:hover,
.day-button:hover,
.chip:hover {
  border-color: #b9ad9a;
  background: #fbfaf7;
}

.full-width {
  width: 100%;
}

.visual-band {
  position: relative;
  margin: 26px 0;
  min-height: 184px;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.visual-band img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.visual-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 20px;
  background: linear-gradient(180deg, rgba(23, 35, 43, 0.05), rgba(23, 35, 43, 0.48));
}

.visual-overlay div {
  max-width: 780px;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.34);
}

.visual-overlay span,
.visual-overlay strong {
  display: block;
}

.visual-overlay span {
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

.visual-overlay strong {
  font-size: 24px;
  line-height: 1.2;
}

.view,
.search-results {
  display: grid;
  gap: 18px;
}

.panel,
.doc-panel,
.day-reader,
.overview-band,
.search-results {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(36, 43, 48, 0.06);
}

.panel,
.doc-panel,
.day-reader,
.search-results {
  padding: clamp(18px, 2.4vw, 28px);
}

.overview-band {
  padding: clamp(18px, 2.4vw, 28px);
}

.kpi-grid,
.doc-grid,
.week-grid,
.template-grid {
  display: grid;
  gap: 14px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpi strong {
  display: block;
  color: var(--teal-dark);
  font-size: 30px;
  line-height: 1;
}

.kpi span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.doc-grid,
.template-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.doc-button {
  justify-content: flex-start;
  min-height: 54px;
  padding: 12px 14px;
  text-align: left;
}

.daily-layout {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.day-list {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
}

.week-card {
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.week-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.day-button {
  min-width: 0;
  min-height: 36px;
  padding: 0;
  color: var(--muted);
}

.day-button.active {
  color: #fff;
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.day-button.done:not(.active) {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.day-toolbar,
.doc-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.day-toolbar .actions,
.doc-toolbar .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.content {
  color: #28343d;
  line-height: 1.66;
}

.content h1,
.content h2,
.content h3,
.content h4 {
  color: #17232b;
  line-height: 1.2;
}

.content h1 {
  font-size: 32px;
}

.content h2 {
  margin-top: 30px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 25px;
}

.content h3 {
  margin-top: 26px;
  font-size: 20px;
}

.content h4 {
  margin-top: 22px;
  font-size: 16px;
}

.content p,
.content li,
.content blockquote {
  font-size: 16px;
}

.content ul,
.content ol {
  padding-left: 23px;
}

.content li + li {
  margin-top: 4px;
}

.content blockquote {
  margin: 18px 0;
  padding: 14px 16px;
  color: #314650;
  background: #eef4ef;
  border-left: 4px solid var(--green);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.content code {
  padding: 2px 6px;
  background: #efe8dc;
  border-radius: 5px;
  font-size: 0.92em;
}

.code-wrap {
  position: relative;
  margin: 18px 0;
}

.content pre {
  margin: 0;
  padding: 18px;
  overflow: auto;
  color: #edf6f4;
  background: #17232b;
  border-radius: var(--radius);
}

.content pre code {
  padding: 0;
  color: inherit;
  background: transparent;
  border-radius: 0;
}

.copy-code {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 32px;
  padding: 0 10px;
  color: #17232b;
  background: #f0d7a2;
}

.search-results {
  margin-bottom: 20px;
}

.result-list {
  display: grid;
  gap: 10px;
}

.result-item {
  display: grid;
  gap: 5px;
  padding: 14px;
  color: inherit;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.result-item strong {
  color: var(--teal-dark);
}

.result-item small {
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}

.chip {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 64px 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 34px;
  height: 34px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  padding: 12px 14px;
  color: #fff;
  background: #17232b;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-list a {
    flex: 0 0 auto;
  }

  .sidebar-footer {
    display: none;
  }

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

  .topbar-actions {
    width: 100%;
    min-width: 0;
  }

  .daily-layout {
    grid-template-columns: 1fr;
  }

  .day-list {
    position: static;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px 14px 40px;
  }

  h1 {
    font-size: 28px;
  }

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

  .search-box {
    min-width: 0;
  }

  .primary,
  .secondary {
    width: 100%;
  }

  .visual-band img {
    height: 180px;
  }

  .visual-overlay strong {
    font-size: 18px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .week-days {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

