:root {
  --bg: #0f1117;
  --surface: #181b23;
  --surface-soft: #20242e;
  --ink: #f4f1e8;
  --muted: #a9a395;
  --line: #303541;
  --side: #0a0c11;
  --side-soft: #1b2029;
  --sage: #6c8f7b;
  --rust: #d07b55;
  --gold: #d7b45f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(215, 180, 95, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(108, 143, 123, 0.06) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
input {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 248px;
  padding: 24px 18px;
  color: #f7f4ed;
  background: var(--side);
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin-bottom: 32px;
  font-weight: 700;
}

.brand img {
  width: 42px;
  height: 42px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 8px 10px;
  border-radius: 8px;
  color: rgba(247, 244, 237, 0.78);
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: var(--side-soft);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 700;
}

.content {
  min-height: 100vh;
  margin-left: 248px;
  padding: 36px;
  overflow-x: hidden;
}

.panel {
  display: none;
  min-height: calc(100vh - 72px);
  padding: clamp(28px, 5vw, 64px);
  background: rgba(24, 27, 35, 0.86);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel.active {
  display: block;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 38px;
  align-items: center;
  min-height: calc(100vh - 200px);
}

.intro-copy,
.portrait,
.card,
.table-shell,
.calendar,
.note,
.note-form,
.bi-board article {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--rust);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 740px;
  margin-bottom: 20px;
  font-size: clamp(2.4rem, 8vw, 5.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.intro-copy p:not(.eyebrow) {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button,
.table-title button,
.calendar-header button,
.note-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  color: #fff;
  border: 0;
  background: var(--sage);
  border-radius: 8px;
  cursor: pointer;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.button-light {
  color: var(--ink) !important;
  border: 1px solid var(--line) !important;
  background: var(--surface-soft) !important;
}

.save-status {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.button.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.portrait {
  display: grid;
  gap: 18px;
  justify-items: start;
  padding: 28px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #1c2029, #11141b);
  border-radius: 8px;
}

.portrait img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
}

.portrait strong,
.portrait span {
  display: block;
}

.portrait span {
  margin-top: 6px;
  color: var(--muted);
}

.section-heading {
  margin-bottom: 28px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.card,
.table-shell,
.calendar,
.note,
.note-form {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}

.card {
  display: grid;
  gap: 10px;
  min-height: 142px;
  padding: 20px;
}

.card span,
.card small,
.agenda-list span,
.note span,
.note p {
  color: var(--muted);
}

.card strong {
  font-size: clamp(1.5rem, 3vw, 2.3rem);
}

.table-shell {
  overflow: hidden;
}

.table-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.table-title h3 {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

th,
td {
  padding: 16px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 0.85rem;
}

.money-field {
  display: inline-grid;
  grid-template-columns: auto minmax(120px, 1fr);
  align-items: center;
  width: min(100%, 280px);
  min-height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #10131a;
  border-radius: 8px;
}

.money-field span {
  display: grid;
  place-items: center;
  align-self: stretch;
  min-width: 46px;
  color: var(--muted);
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  font-weight: 700;
}

.money-field input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
}

.money-field:focus-within {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(99, 119, 106, 0.16);
}

.schedule-config {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
  max-width: 860px;
  margin-bottom: 18px;
}

.schedule-config label {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  font-weight: 700;
}

.schedule-config input {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #10131a;
  border-radius: 8px;
}

.calendar {
  max-width: 980px;
  padding: 20px;
  margin-bottom: 22px;
  overflow-x: auto;
}

.calendar-header,
.days {
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  gap: 8px;
}

.calendar-header {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  margin-bottom: 20px;
}

.calendar-header strong {
  text-align: center;
  font-size: 1.25rem;
}

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

.days {
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(74px, 1fr));
  gap: 8px;
  min-width: 560px;
}

.calendar-day {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 92px;
  padding: 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #141821;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.calendar-day:hover {
  transform: translateY(-1px);
  border-color: var(--rust);
}

.calendar-day.today {
  border-color: var(--sage);
  box-shadow: inset 0 0 0 2px rgba(99, 119, 106, 0.25);
}

.calendar-day.outside-month {
  opacity: 0.42;
}

.calendar-day.day-shift {
  color: #241c0b;
  background: #cdbf7a;
  border-color: #e2d487;
}

.calendar-day.night-shift {
  color: #fff;
  background: #162744;
  border-color: #27466e;
}

.calendar-day strong {
  font-size: 1rem;
}

.calendar-day span {
  font-size: 0.78rem;
  color: var(--muted);
}

.calendar-day.day-shift span {
  color: rgba(36, 28, 11, 0.72);
}

.calendar-day.night-shift span {
  color: rgba(255, 255, 255, 0.78);
}

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

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--muted);
}

.legend i {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.legend-day {
  background: #cdbf7a;
}

.legend-night {
  background: #162744;
}

.legend-off {
  background: #141821;
}

.legend-reminder {
  background: var(--rust);
}

.reminder-dot {
  width: 9px;
  height: 9px;
  margin-top: auto;
  background: var(--rust);
  border-radius: 999px;
}

.notes-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.notes-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.note,
.note-form {
  padding: 20px;
}

.note h3 {
  margin: 8px 0 10px;
}

.note footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.note button {
  padding: 0;
  color: var(--rust);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.note-form {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

.note-form label {
  font-weight: 700;
}

textarea {
  width: 100%;
  resize: vertical;
  padding: 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #10131a;
  border-radius: 8px;
}

.bi-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.bi-board article {
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}

.bi-board p {
  color: var(--muted);
  line-height: 1.6;
}

.reminder-dialog {
  width: min(520px, calc(100vw - 32px));
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.reminder-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.reminder-dialog form {
  display: grid;
  gap: 14px;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading span {
  display: block;
  margin-bottom: 4px;
  color: var(--rust);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.dialog-heading strong {
  display: block;
  font-size: 1.15rem;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 8px;
  cursor: pointer;
}

@media (max-width: 860px) {
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    padding: 12px;
  }

  .brand {
    margin-bottom: 10px;
  }

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

  .nav-link {
    justify-content: center;
    min-height: 44px;
    padding: 8px 6px;
  }

  .nav-link span:last-child {
    display: none;
  }

  .content {
    margin-left: 0;
    padding: 14px;
  }

  .panel {
    min-height: calc(100vh - 140px);
    padding: 24px;
  }

  .intro-grid,
  .dashboard-grid,
  .notes-layout,
  .bi-board {
    grid-template-columns: 1fr;
  }

  .schedule-config,
  .notes-list {
    grid-template-columns: 1fr;
  }

  .calendar-header {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .calendar-day {
    min-height: 64px;
    padding: 8px;
  }

  .calendar-day span {
    display: none;
  }

  .table-shell {
    overflow-x: auto;
  }
}

@media (max-width: 620px) {
  .sidebar {
    padding: 10px;
  }

  .brand {
    min-height: 38px;
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .nav {
    gap: 6px;
  }

  .nav-icon {
    width: 30px;
    height: 30px;
  }

  .content {
    padding: 10px;
  }

  .panel {
    min-height: calc(100vh - 118px);
    padding: 18px;
  }

  h1 {
    font-size: clamp(2rem, 14vw, 3.4rem);
    line-height: 1;
  }

  h2 {
    font-size: clamp(1.8rem, 11vw, 2.6rem);
  }

  .quick-actions,
  .button-row,
  .legend {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .table-title button,
  .calendar-header button,
  .note-form button,
  .button-light {
    width: 100%;
  }

  .table-title {
    align-items: stretch;
    flex-direction: column;
  }

  .card {
    min-height: 120px;
  }

  .calendar {
    padding: 12px;
  }

  .calendar-header {
    grid-template-columns: 1fr;
  }

  .calendar-header strong {
    order: -1;
  }

  .days,
  .month-grid {
    min-width: 490px;
  }

  .month-grid {
    grid-template-columns: repeat(7, 64px);
  }

  .calendar-day {
    min-height: 58px;
  }

  .reminder-dialog {
    width: calc(100vw - 20px);
    padding: 14px;
  }

  .dialog-heading {
    align-items: flex-start;
  }
}
