:root { color-scheme: light; font: 16px system-ui, sans-serif; color: #202c41; background: #f2f5fa; }
* { box-sizing: border-box; }
body { margin: 0; }
header { background: #172748; color: white; padding: 14px max(16px, calc((100% - 1000px)/2)); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
header a { color: white; font-size: 1.15rem; font-weight: 700; text-decoration: none; }
main { max-width: 1032px; margin: auto; padding: 24px 16px; }
h1 { font-size: 1.65rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
p { line-height: 1.5; }
.panel, .task, .project, dialog { background: white; border: 1px solid #d8e0ed; border-radius: 12px; padding: 18px; }
.panel { margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.spread { justify-content: space-between; }
button, input, textarea, select, .button { font: inherit; border: 1px solid #b8c6db; border-radius: 8px; padding: 10px 12px; min-height: 44px; }
button, .button { background: white; color: #20395f; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.primary, [aria-current="page"] { background: #244b92; border-color: #244b92; color: white; }
button:disabled { opacity: .55; cursor: wait; }
label { display: grid; gap: 5px; margin: 12px 0; }
textarea { width: 100%; min-height: 100px; }
input, select { min-width: 0; width: 100%; background: white; }
dialog { width: min(540px, calc(100% - 24px)); }
dialog::backdrop { background: #10203b88; }
#status { position: fixed; bottom: 12px; left: max(12px, calc((100% - 1000px)/2)); max-width: calc(100% - 24px); margin: 0; padding: 10px 14px; background: #172748; color: white; border-radius: 8px; z-index: 2; }
#status:empty { display: none; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.muted { color: #4e6079; }
.overdue { color: #9a302b; font-weight: 650; }
.date-range { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(175px, 100%), 1fr)); gap: 0 12px; }

.workspace { display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: 100vh; }
.workspace-main { grid-column: 2; min-width: 0; }
#sidebar:not([hidden]) { width: 250px; padding: 26px 16px; border-right: 1px solid #e1e7f0; background: #fff; }
.workspace header { background: #fff; color: #35445e; border-bottom: 1px solid #e1e7f0; min-height: 70px; padding: 13px clamp(18px, 4vw, 44px); }
.workspace header a { color: #465678; font-size: .96rem; }
.workspace main { margin: 0 auto; max-width: 1320px; padding: 32px clamp(16px, 4vw, 44px); }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 8px 30px; font-size: 1.18rem; font-weight: 750; }
.brand > span { display: grid; place-items: center; background: #3d5de8; color: #fff; border-radius: 10px; width: 34px; height: 34px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; color: #62708a; margin: 22px 8px 6px; font-size: .83rem; }
.sidebar-heading button { padding: 6px 10px; }
.sidebar-link { width: 100%; border-color: transparent; margin: 2px 0; text-align: left; gap: 9px; justify-content: flex-start; }
.sidebar-link.selected { background: #edf1ff; color: #2845b0; }
.sidebar-link > span { flex: 1; overflow-wrap: anywhere; }
.sidebar-link small { color: #566582; }
.project-dot { width: 8px; height: 8px; border-radius: 50%; background: #7188ec; flex: none; }
.tone-1 { background: #35a77e; }
.tone-2 { background: #dc943c; }
.project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 20px 0 24px; }
.project-card { display: grid; justify-content: start; align-content: start; text-align: left; gap: 7px; min-height: 94px; overflow-wrap: anywhere; }
.project-card strong { font-size: 1.06rem; color: #182237; }
.project-card span { color: #50607a; }
.primary { background: #3d5de8; border-color: #3d5de8; }
.calendar-panel { margin-top: 18px; }
.calendar-toolbar { margin: 0 0 12px; }
.calendar-toolbar h2 { margin-bottom: 4px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekday { text-align: center; padding: 7px 0; font-size: .85rem; color: #53627a; }
.calendar-day, .calendar-empty { min-height: 85px; padding: 7px; border: 1px solid #e3e9f1; border-radius: 7px; }
.calendar-day { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 3px; text-align: left; overflow: hidden; }
.calendar-day.today .day-number { font-weight: 800; color: #2447cf; }
.calendar-day[aria-pressed="true"] { background: #eef2ff; border-color: #526eef; }

.scheduled-header { margin-top: 18px; }
.scheduled-header h2, .scheduled-task p { margin: 0; }
.scheduled-task { border-top: 1px solid #e3e9f1; padding: 9px 0; }
@media (max-width: 1000px) {
  #sidebar:not([hidden]) { width: 196px; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .workspace { display: block; }
  #sidebar:not([hidden]) { display: none; }
  .workspace main { padding: 18px 12px; }
  .calendar-panel { padding: 10px; }
  .calendar-grid { gap: 3px; }
  .calendar-day, .calendar-empty { min-height: 52px; padding: 4px 2px; }
  .calendar-day { align-items: center; }
}

.calendar-week {
  position: relative;
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  --bar-row: 13px;
}
.calendar-week > .calendar-day, .calendar-week > .calendar-empty {
  min-height: max(68px, calc(34px + var(--lanes) * var(--bar-row)));
}
.calendar-bars {
  position: absolute;
  top: 28px;
  inset-inline: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: var(--bar-row);
  column-gap: 4px;
  pointer-events: none;
}
.calendar-bar {
  align-self: start;
  margin: 0 3px;
  min-height: calc(var(--bar-row) - 3px);
  padding: 0 5px;
  border-radius: 4px;
  font-size: 9px;
  line-height: calc(var(--bar-row) - 3px);
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #dce7ff;
  color: #233e7e;
}
.calendar-bar.bar-tone-1 { background: #dfebfd; color: #244887; }
.calendar-bar.bar-tone-2 { background: #ffe8cd; color: #713d16; }
.calendar-bar.complete { background: #deefe6; color: #225943; }
.calendar-bar.continued-start { border-start-start-radius: 0; border-end-start-radius: 0; }
.calendar-bar.continued-end { border-start-end-radius: 0; border-end-end-radius: 0; }
@media (max-width: 700px) {
  .calendar-week, .calendar-bars { gap: 3px; }
  .calendar-week { --bar-row: 11px; }
  .calendar-bars { top: 25px; row-gap: 0; }
  .calendar-week > .calendar-day, .calendar-week > .calendar-empty {
    min-height: max(46px, calc(31px + var(--lanes) * var(--bar-row)));
  }
  .calendar-bar { font-size: 0; padding-inline: 2px; }
}
button.danger { color: #9c2936; border-color: #e6b7bd; }
button.danger:hover { background: #fff1f2; }

.scroll-list {
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}
.project-search-row { margin: 12px 0 0; }
.list-search { width: min(290px, 100%); }
.project-grid {
  --project-row: 94px;
  grid-auto-rows: var(--project-row);
  max-height: calc(2 * var(--project-row) + 12px);
  margin-top: 12px;
}
.project-card { min-width: 0; overflow: hidden; }
.project-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.project-card { grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
.schedule-list { --schedule-row: 72px; max-height: calc(3 * var(--schedule-row)); }
.scheduled-task {
  height: var(--schedule-row);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-inline-end: 6px;
}
.scheduled-task[hidden], .project-card[hidden] { display: none; }
.scheduled-text { flex: 1; min-width: 0; }
.scheduled-text strong, .scheduled-text p { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.scheduled-task button { flex: none; }
.scheduled-actions { justify-content: flex-end; }

.header-start { display: flex; align-items: center; gap: 12px; }
#menu-toggle { display: none; }
.sidebar-actions { display: grid; }
.sidebar-link.sidebar-danger { color: #9c2936; }
.sidebar-projects { max-height: 440px; }
.sidebar-projects > .sidebar-link { height: 44px; margin: 0; }
.sidebar-projects > .sidebar-link > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-more { color: #2845b0; }
@media (max-width: 700px) {
  .workspace { display: flex; flex-direction: column; }
  .workspace-main { display: contents; }
  .workspace header { order: 0; }
  #menu-toggle:not([hidden]) { display: inline-flex; }
  #sidebar:not([hidden]).mobile-open { order: 1; display: block; width: 100%; border-bottom: 1px solid #e1e7f0; padding: 12px 16px; }
  #sidebar .brand { display: none; }
  .workspace main { order: 2; width: 100%; }
}
