:root {
  --bg: #F5F3EF;
  --surface: #ffffff;
  --surface-2: #edf3f5;
  --border: #dde4e7;
  --border-strong: #b8c9d0;
  --text: #1a1a1a;
  --muted: #4a6270;
  --soft: #777777;
  --navy: #1C4963;
  --navy-dark: #011A27;
  --gold: #C8913A;
  --green: #1e8e3e;
  --green-soft: #e6f4ea;
  --red: #d93025;
  --red-soft: #fce8e6;
  --shadow: 0 10px 28px rgb(15 23 42 / 8%);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
a {
  color: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 1540px;
  margin: 0 auto;
  padding: 0 20px 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.brand-dot {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: white;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}

.brand-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: currentColor;
}

.view-tabs {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 8px;
}

.pill,
.icon-button,
.primary-button,
.ghost-button,
.danger-button {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.pill.is-active,
.primary-button {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.primary-button.as-link {
  width: 100%;
  margin-top: 16px;
}

.ghost-button {
  background: var(--surface-2);
  color: var(--muted);
}

.danger-button {
  background: var(--red-soft);
  color: var(--red);
  border-color: #f5c6c2;
}

.icon-button {
  width: 36px;
  padding: 0;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.workspace {
  min-height: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: 310px minmax(520px, 1fr) 330px;
}

.workspace.left-collapsed {
  grid-template-columns: 46px minmax(520px, 1fr) 330px;
}

.workspace.right-collapsed {
  grid-template-columns: 310px minmax(520px, 1fr) 46px;
}

.workspace.left-collapsed.right-collapsed {
  grid-template-columns: 46px minmax(520px, 1fr) 46px;
}

.panel {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.panel-scroll {
  overflow: auto;
}

.panel-head,
.calendar-head,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head {
  padding: 15px 16px;
}

.panel-head h1,
.panel-head h2,
.section-head h2 {
  margin: 0;
  font-size: 16px;
}

.project-list,
.right-column {
  height: calc(100vh - 130px);
  overflow: auto;
  padding: 0 16px 16px;
}

.project-group {
  border-top: 1px solid var(--border);
  padding: 10px 0;
}

.project-title-row,
.task-row,
.backlog-item,
.project-row {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.project-title-row {
  padding: 8px 4px;
}

.project-title {
  min-width: 0;
  flex: 1;
  font-size: 14px;
  font-weight: 800;
}

.drag-handle {
  color: var(--soft);
  cursor: grab;
}

.dot {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.tone-1 {
  color: var(--red);
  background: var(--red-soft);
}

.tone-2 {
  color: var(--green);
  background: var(--green-soft);
}

.tone-3 {
  color: var(--navy);
  background: #e5f0f5;
}

.tone-4 {
  color: var(--gold);
  background: #fdf0e0;
}

.chip {
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  background: var(--surface-2);
  color: var(--muted);
}

.meta,
.muted,
.small-note {
  color: var(--soft);
}

.small-note {
  font-size: 13px;
  line-height: 1.55;
}

.project-details {
  margin: 4px 0 8px 36px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.project-details p {
  margin: 0 0 6px;
}

.project-tasks {
  display: grid;
  gap: 4px;
  margin-left: 32px;
}

.task-row {
  border-radius: 8px;
  padding: 7px 6px;
  font-size: 13px;
}

.task-row:hover,
.project-title-row:hover,
.project-row:hover {
  background: var(--surface-2);
}

.task-row.is-done .task-title {
  color: var(--soft);
  text-decoration: line-through;
}

.check {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: white;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.check.is-done {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.task-title {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-panel {
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
}

.calendar-head {
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}

.calendar-controls,
.segmented {
  display: flex;
  align-items: center;
  gap: 7px;
}

.segmented {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.segmented button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--soft);
}

.segmented button.is-active {
  background: white;
  color: var(--navy);
  box-shadow: var(--shadow);
}

.calendar-body {
  overflow: auto;
  height: calc(100vh - 130px);
}

.day-grid {
  display: grid;
  grid-template-columns: 56px minmax(440px, 1fr);
  min-width: 560px;
}

.week-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(150px, 1fr));
  min-width: 1120px;
}

.time-column {
  border-right: 1px solid var(--border);
}

.time-label,
.day-label {
  height: 48px;
  border-bottom: 1px dashed var(--border);
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  padding: 8px;
}

.day-label {
  text-align: center;
  border-bottom-style: solid;
}

.slot {
  min-height: 48px;
  border-bottom: 1px dashed var(--border);
  padding: 5px;
}

.slot:hover {
  background: #f9faf7;
}

.block {
  position: relative;
  border: 1px solid;
  border-radius: 9px;
  padding: 9px;
  min-height: 40px;
  margin-bottom: 4px;
  font-size: 13px;
}

.block .block-title {
  font-weight: 800;
}

.block.tone-1 {
  border-color: #f5c6c2;
}

.block.tone-2 {
  border-color: #b7dfc2;
}

.block.tone-3 {
  border-color: #b8c9d0;
}

.block.tone-4 {
  border-color: #ead2a8;
}

.block-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.mini-button {
  border: 0;
  border-radius: 7px;
  background: rgb(255 255 255 / 75%);
  min-width: 28px;
  height: 26px;
  font-weight: 800;
}

.right-section {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.right-section:last-child {
  border-bottom: 0;
}

.timer-display {
  text-align: center;
  margin: 20px 0;
}

.timer-display strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.action-row {
  display: flex;
  gap: 8px;
}

.backlog-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.backlog-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.backlog-item {
  border: 1px solid #f5c6c2;
  border-radius: 9px;
  background: var(--red-soft);
  padding: 9px;
  cursor: grab;
}

.notes-input {
  min-height: 170px;
}

.screen {
  min-height: 0;
}

.project-planner {
  height: calc(100vh - 78px);
  overflow: hidden;
  padding: 20px;
}

.planner-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  height: 100%;
}

.project-list-card,
.project-detail-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  box-shadow: var(--shadow);
  overflow: auto;
}

.project-list-card {
  padding: 16px;
}

.project-detail-card {
  padding: 20px;
}

.project-row {
  border-bottom: 1px solid var(--border);
  padding: 12px 6px;
}

.project-row.is-active {
  background: #e5f0f5;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

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

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

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--soft);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: white;
  color: var(--text);
  border-radius: 10px;
  min-height: 40px;
  padding: 9px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgb(200 145 58 / 22%);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  background: rgb(0 0 0 / 28%);
  padding: 18px;
}

.modal.is-open {
  display: grid;
}

.modal-card {
  width: min(620px, 100%);
  max-height: min(820px, calc(100vh - 32px));
  overflow: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 18px 52px rgb(0 0 0 / 25%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h2,
.auth-card h1 {
  margin: 0;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(460px, 100%);
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.alert,
.success {
  border-radius: 10px;
  padding: 11px 12px;
  margin: 14px 0;
  font-weight: 700;
  font-size: 14px;
}

.alert {
  background: var(--red-soft);
  color: var(--red);
}

.success {
  background: var(--green-soft);
  color: var(--green);
}

.hidden {
  display: none !important;
}

.dark-mode {
  --bg: #0f1923;
  --surface: #1a2530;
  --surface-2: #1e2d3a;
  --border: #2a3a4a;
  --border-strong: #405165;
  --text: #e8edf2;
  --muted: #a8b0bd;
  --soft: #8899aa;
  --navy: #FFDE59;
  --gold: #FFDE59;
  color-scheme: dark;
}

.dark-mode input,
.dark-mode textarea,
.dark-mode select,
.dark-mode .segmented button.is-active,
.dark-mode .project-list-card,
.dark-mode .project-detail-card,
.dark-mode .modal-card,
.dark-mode .auth-card {
  background: #111c27;
  color: var(--text);
}

.dark-mode .pill.is-active,
.dark-mode .primary-button {
  color: #011A27;
}

@media (max-width: 1040px) {
  .workspace,
  .workspace.left-collapsed,
  .workspace.right-collapsed,
  .workspace.left-collapsed.right-collapsed,
  .planner-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 0 12px 12px;
  }

  .topbar {
    min-height: 92px;
    align-items: flex-start;
    padding-top: 14px;
  }

  .view-tabs {
    top: 58px;
  }

  .project-list,
  .right-column,
  .calendar-body,
  .project-planner {
    height: auto;
    max-height: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

