:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --text: #17202a;
  --muted: #65727f;
  --line: #d9e0e7;
  --blue: #1769aa;
  --green: #197b4f;
  --red: #ba3b46;
  --amber: #a76815;
  --shadow: 0 12px 30px rgba(30, 41, 59, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
}

.button-link {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  text-decoration: none;
}

button[type="submit"],
#newEntryButton {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

button.danger {
  border-color: #f1b5bb;
  color: var(--red);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
  min-height: 140px;
}

label {
  display: grid;
  gap: 7px;
  color: #384553;
  font-size: 13px;
  font-weight: 650;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.auth-screen,
.password-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 24px;
  padding: 24px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 520px;
}

.brand-lockup h1 {
  margin: 0 0 6px;
  font-size: 34px;
  letter-spacing: 0;
}

.brand-lockup p {
  margin: 0;
  color: var(--muted);
}

.brand-mark {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
}

.auth-panel {
  width: min(440px, calc(100vw - 32px));
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel h2 {
  margin: 0;
}

.form-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.form-message.error {
  color: var(--red);
}

.form-message.success {
  color: var(--green);
}

.workspace {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mini strong,
.brand-mini span {
  display: block;
}

.brand-mini span {
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.calendar-band {
  padding: 18px 20px 10px;
}

.month-toolbar {
  max-width: 1260px;
  margin: 0 auto 12px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.month-toolbar h2 {
  margin: 0;
  text-align: center;
  font-size: 24px;
  letter-spacing: 0;
}

.month-toolbar button {
  min-height: 44px;
  font-size: 26px;
  line-height: 1;
}

.calendar-grid {
  max-width: 1260px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
  gap: 1px;
}

.weekday,
.day-cell {
  background: var(--surface);
}

.weekday {
  min-height: 34px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.day-cell {
  min-height: 116px;
  padding: 8px;
  display: grid;
  grid-template-rows: 22px 1fr;
  gap: 6px;
  text-align: left;
}

.day-cell.outside {
  background: #f1f4f7;
  color: #9aa5b1;
}

.day-cell.selected {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.day-cell.today .date-number {
  background: var(--blue);
  color: #fff;
}

.date-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 750;
}

.day-items {
  display: grid;
  align-content: start;
  gap: 4px;
  overflow: hidden;
}

.day-pill {
  min-width: 0;
  border-radius: 5px;
  padding: 4px 6px;
  background: var(--surface-2);
  color: #1d3447;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-pill.done {
  background: #e5f4ed;
  color: var(--green);
}

.day-pill.blocked {
  background: #fae8ea;
  color: var(--red);
}

.work-surface {
  max-width: 1260px;
  margin: 0 auto;
  padding: 10px 20px 28px;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
  gap: 18px;
}

.day-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.day-panel {
  min-height: 460px;
  overflow: hidden;
}

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

.panel-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.counter {
  min-width: 34px;
  min-height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.entry-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.entry-card {
  display: grid;
  gap: 7px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px;
  text-align: left;
}

.entry-card.active {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.entry-card strong {
  overflow-wrap: anywhere;
}

.entry-meta,
.empty-state {
  color: var(--muted);
  font-size: 12px;
}

.status-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  border-radius: 999px;
  background: var(--surface-2);
  color: #34495e;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.badge.high {
  background: #fff2d8;
  color: var(--amber);
}

.badge.done {
  background: #e5f4ed;
  color: var(--green);
}

.badge.blocked {
  background: #fae8ea;
  color: var(--red);
}

.detail-panel {
  padding: 16px;
  display: grid;
  gap: 18px;
  align-content: start;
}

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

.form-row.split,
.people-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

select[multiple] {
  min-height: 92px;
}

.button-row,
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-form input {
  flex: 1 1 220px;
}

.inline-form select {
  flex: 0 1 210px;
}

.inline-form button {
  flex: 0 0 auto;
}

.subsection {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.subsection-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.subsection h3 {
  margin: 0;
  font-size: 17px;
}

.subsection-head span {
  color: var(--muted);
  font-size: 12px;
}

.task-list,
.attachment-list {
  display: grid;
  gap: 8px;
}

.task-item,
.attachment-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}

.task-item.done .task-text {
  color: var(--muted);
  text-decoration: line-through;
}

.task-toggle {
  min-width: 38px;
  padding: 0;
}

.task-text,
.attachment-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.attachment-actions {
  display: flex;
  gap: 6px;
}

.admin-dialog {
  width: min(1040px, calc(100vw - 26px));
  max-height: calc(100vh - 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

.admin-dialog::backdrop {
  background: rgba(23, 32, 42, 0.34);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 0;
}

.dialog-head button {
  min-width: 40px;
  padding: 0;
  font-size: 24px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px;
}

.admin-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.admin-card.wide {
  grid-column: 1 / -1;
}

.admin-card h3 {
  margin: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.summary-item {
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px;
}

.summary-item strong {
  display: block;
  font-size: 24px;
}

.summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.admin-users {
  display: grid;
  gap: 8px;
}

.reminder-list {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.reminder-item {
  width: 100%;
  min-height: 64px;
  display: grid;
  gap: 5px;
  text-align: left;
  padding: 11px;
}

.reminder-item strong,
.reminder-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.reminder-item span {
  color: var(--muted);
  font-size: 12px;
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 120px;
  gap: 8px;
  align-items: center;
}

.admin-user-row strong,
.admin-user-row span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-user-row span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .topbar,
  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: stretch;
  }

  .top-actions button {
    flex: 1 1 120px;
  }

  .calendar-band {
    padding: 12px 10px 6px;
  }

  .day-cell {
    min-height: 82px;
    padding: 5px;
  }

  .day-pill {
    font-size: 11px;
    padding: 3px 4px;
  }

  .work-surface,
  .form-row.split,
  .people-row,
  .admin-layout,
  .admin-user-row {
    grid-template-columns: 1fr;
  }

  .work-surface {
    padding: 8px 10px 20px;
  }

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