:root {
  --bg: #f8fafc;
  --sidebar: #ffffff;
  --card: #ffffff;
  --text: #202332;
  --muted: #7b8298;
  --soft: #eef1f7;
  --line: #dde2ec;
  --accent: #5b63f6;
  --accent-2: #a855f7;
  --accent-soft: #eef0ff;
  --danger: #ef4444;
  --green: #45c96b;
  --yellow: #f6bd58;
  --blue: #5f9cff;
  --shadow: 0 16px 42px rgba(24, 34, 66, 0.07);
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

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

button { cursor: pointer; }

.hidden { display: none !important; }

.app {
  display: grid;
  grid-template-columns: 292px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  backdrop-filter: blur(14px);
}

.command-mode {
  background: #0b0e15;
}

.command-mode .app {
  background: #0b0e15;
}

.command-mode .sidebar {
  background: #0b0e15;
  border-right-color: #22283a;
  color: #f7f8fb;
}

.command-mode .brand-text h1,
.command-mode .user-meta strong,
.command-mode .pi-name {
  color: #f7f8fb;
}

.command-mode .brand-text span,
.command-mode .user-meta span,
.command-mode .side-label {
  color: #8f99ad;
}

.command-mode .inbox-btn,
.command-mode .btn-new {
  border-color: #30374c;
  background: #111620;
  color: #f7f8fb;
  box-shadow: none;
}

.command-mode .inbox-btn:hover,
.command-mode .inbox-btn.active {
  border-color: #e9cf6a;
  background: #1b1d25;
}

.command-mode .btn-new {
  color: #f8df7c;
  border-style: solid;
}

.command-mode .project-item:hover,
.command-mode .project-item.active {
  border-color: #30374c;
  background: #111620;
  box-shadow: none;
}

.command-mode .pi-badge {
  color: #c4cbda;
  background: #242b3c;
}

.command-mode .pi-badge.zero {
  color: #63d98a;
  background: rgba(69, 201, 107, 0.14);
}

.command-mode .pi-bar {
  background: #242b3c;
}

.command-mode .sidebar-foot {
  border-top-color: #22283a;
}

.command-mode .icon-btn.ghostly {
  color: #9ea7bd;
}

.command-mode .main {
  background: #0b0e15;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 4px 24px;
}

.brand-mark,
.ph-dot,
.user-avatar {
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 28px rgba(91, 99, 246, 0.24);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  font-size: 16px;
}

.brand-text h1 {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-text span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.inbox-btn,
.btn-new,
.project-item {
  width: 100%;
  border-radius: var(--radius);
}

.inbox-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(29, 36, 58, 0.03);
}

.inbox-btn:hover,
.inbox-btn.active { border-color: #cfd6e6; background: #fbfcff; }

.calendar-btn {
  margin-top: 10px;
}

#inboxBtn {
  margin-top: 10px;
}

.ib-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ib-icon { color: #f05a3c; font-size: 12px; }

.today-icon { color: var(--accent); }

.calendar-icon { color: #1f9d53; }

.ib-badge,
.pi-badge,
.pill {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.ib-badge { color: #fff; background: var(--danger); }

.btn-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 42px;
  margin: 12px 0 26px;
  border: 1px dashed #cfd6e6;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.btn-new span { font-size: 22px; line-height: 0; }

.btn-new:hover {
  background: var(--accent-soft);
  border-color: #b8bdf8;
}

.side-label {
  margin: 0 2px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.project-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding: 0 0 16px;
}

.project-item {
  position: relative;
  padding: 11px 12px 12px;
  border: 1px solid transparent;
  background: transparent;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.project-item:hover,
.project-item.active {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line);
  box-shadow: 0 8px 24px rgba(22, 32, 58, 0.06);
}

.project-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--pcolor, var(--accent));
}

.pi-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pi-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 4px rgba(91, 99, 246, 0.08);
}

.pi-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pi-badge {
  color: var(--muted);
  background: #edf0f6;
}

.pi-badge.zero {
  color: #1f9d53;
  background: #e8f8ee;
}

.pi-bar {
  height: 4px;
  margin: 10px 2px 0 22px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}

.pi-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--pcolor, var(--accent));
  transition: width .25s ease;
}

.sidebar-foot {
  display: grid;
  grid-template-columns: 42px 1fr 18px;
  align-items: center;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}

.user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-meta strong {
  color: var(--text);
  font-size: 13px;
}

.user-meta span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chevron { color: var(--muted); font-size: 20px; }

/* Main */
.main {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 32px 40px;
}

.project-view {
  width: min(100%, 1320px);
  margin: 0 auto;
}

.today-view {
  width: min(100%, 1440px);
  margin: 0 auto;
}

.command-shell {
  min-height: calc(100vh - 62px);
  padding: 18px;
  border: 1px solid #22283a;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0)),
    #10131d;
  color: #f7f8fb;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.20);
}

.command-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.command-top .today-date {
  color: #9ea7bd;
}

.command-top h2 {
  color: #fff;
  font-size: 38px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
}

.command-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.command-status span {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid #30374c;
  border-radius: var(--radius);
  background: #171c28;
  color: #c4cbda;
  font-size: 13px;
  font-weight: 850;
}

.command-capture {
  display: grid;
  grid-template-columns: auto minmax(150px, 220px) minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 16px;
  padding: 8px;
  border: 1px solid #30374c;
  border-radius: 12px;
  background: #171c28;
}

.capture-mode {
  display: flex;
  gap: 6px;
}

.capture-chip,
.capture-project,
.command-capture input,
.capture-submit {
  min-height: 42px;
  border-radius: var(--radius);
  font-weight: 850;
}

.capture-chip {
  padding: 0 12px;
  border: 1px solid #30374c;
  background: #10131d;
  color: #c4cbda;
}

.capture-chip.active {
  border-color: #e9cf6a;
  background: #2d2714;
  color: #f8df7c;
}

.capture-project,
.command-capture input {
  min-width: 0;
  border: 1px solid #30374c;
  outline: 0;
  background: #0b0e15;
  color: #fff;
}

.capture-project {
  padding: 0 12px;
}

.command-capture input {
  padding: 0 14px;
}

.command-capture input::placeholder {
  color: #7f899e;
}

.capture-submit {
  padding: 0 18px;
  border: 0;
  background: #f8df7c;
  color: #1e1b10;
}

.command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  grid-template-areas:
    "focus orbit"
    "tasks agenda"
    "tasks inbox";
  gap: 14px;
}

.focus-stage {
  grid-area: focus;
  min-height: 296px;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 18px;
  padding: 20px;
  border: 1px solid #30374c;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(248, 223, 124, 0.14), transparent 38%),
    #171c28;
}

.stage-copy span {
  display: block;
  margin-bottom: 12px;
  color: #f8df7c;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.stage-copy h3 {
  max-width: 780px;
  color: #fff;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0;
}

.stage-copy p {
  margin-top: 12px;
  color: #aeb7c9;
  font-size: 15px;
  font-weight: 750;
}

.focus-actions,
.signal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.focus-actions .filter-btn,
.focus-actions .btn-add,
.command-status .filter-btn {
  border-color: #30374c;
  background: #10131d;
  color: #f7f8fb;
  box-shadow: none;
}

.focus-actions .btn-add {
  background: #f8df7c;
  color: #1e1b10;
}

.signal-strip .metric {
  flex: 1 1 130px;
  min-height: 70px;
  border-color: #30374c;
  background: #10131d;
  box-shadow: none;
}

.signal-strip .metric strong {
  color: #fff;
}

.signal-strip .metric span {
  color: #9ea7bd;
}

.orbit-panel,
.signal-panel {
  min-width: 0;
  border: 1px solid #30374c;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text);
  overflow: hidden;
}

.orbit-panel { grid-area: orbit; }
.task-stream { grid-area: tasks; }
.agenda-panel { grid-area: agenda; }
.inbox-panel { grid-area: inbox; }

.project-orbit {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  background:
    linear-gradient(#e4e8f2 1px, transparent 1px),
    linear-gradient(90deg, #e4e8f2 1px, transparent 1px),
    #f8fafc;
  background-size: 42px 42px;
}

.project-orbit::before,
.project-orbit::after {
  content: "";
  position: absolute;
  inset: 42px;
  border: 1px dashed #c8d0de;
  border-radius: 50%;
}

.project-orbit::after {
  inset: 92px;
}

.orbit-node {
  position: absolute;
  width: var(--node-size);
  height: var(--node-size);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--node-color);
  border-radius: 50%;
  background: #fff;
  color: var(--text);
  box-shadow: 0 18px 38px rgba(24, 34, 66, 0.16);
}

.orbit-node strong {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orbit-node span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.orbit-node::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--node-color);
}

.today-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.today-date {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.today-header h2 {
  color: var(--text);
  font-size: 34px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.today-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 78px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
  box-shadow: 0 10px 28px rgba(29, 36, 58, 0.04);
}

.metric:hover {
  border-color: #cbd2e3;
  background: #fff;
}

.metric strong {
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  font-weight: 850;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
}

.today-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 28px rgba(29, 36, 58, 0.04);
}

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

.panel-head h3 {
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
  letter-spacing: 0;
}

.link-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 850;
}

.link-btn:hover {
  border-color: #cfd6e6;
  background: var(--accent-soft);
}

.today-task-list,
.today-project-list {
  list-style: none;
  padding: 0;
}

.today-task {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.today-task:last-child,
.today-project:last-child { border-bottom: 0; }

.today-task .check {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid #cfd6e6;
  border-radius: 6px;
  background: #fff;
}

.today-task .check:hover {
  border-color: var(--accent);
}

.today-task .check svg {
  width: 13px;
  height: 13px;
  opacity: 0;
}

.today-task-main,
.today-project-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.today-task-title,
.today-project-name {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-task-project,
.today-project-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.today-project {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.today-project-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tiny-progress {
  width: 72px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}

.tiny-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.calendar-list.compact,
.msg-list.compact {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.calendar-list.compact .calendar-event {
  grid-template-columns: 96px minmax(0, 1fr);
  min-height: 56px;
  padding: 10px 14px;
}

.calendar-list.compact .calendar-event a {
  display: none;
}

.msg-list.compact .msg {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 58px;
}

.calendar-warnings.compact {
  border-top: 0;
}

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}

.ph-left {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.ph-dot {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 10px;
  font-size: 20px;
}

.inbox-dot { background: linear-gradient(145deg, #5b63f6, #4f8cff); }

.calendar-dot { background: linear-gradient(145deg, #1f9d53, #5f9cff); }

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

#phName {
  color: var(--text);
  font-size: 30px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: 0;
}

.ph-desc {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
}

.ph-actions {
  display: flex;
  gap: 10px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.75);
  color: #6f778d;
  font-size: 20px;
  box-shadow: 0 8px 18px rgba(30, 37, 58, 0.04);
}

.icon-btn:hover {
  border-color: #cbd2e3;
  color: var(--text);
}

.icon-btn.danger:hover {
  color: var(--danger);
  border-color: #f4c4c4;
  background: #fff7f7;
}

.progress-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.progress-copy,
.progress-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9ecf3;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .35s ease;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

.search-field {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-field input::placeholder { color: #8d95a9; }

.filter-btn {
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.filter-btn span { color: var(--accent); font-weight: 700; }

.btn-add {
  min-height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #7462ff);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(91, 99, 246, 0.22);
}

.btn-add:hover { filter: brightness(1.04); }

.add-step {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 50px;
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 10px 28px rgba(29, 36, 58, 0.04);
}

.add-step::before {
  content: "+";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.add-step input {
  min-width: 0;
  margin-left: 50px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.add-step .btn-add {
  grid-column: 2;
  min-height: auto;
  height: 48px;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

.steps-section { padding-bottom: 22px; }

.section-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 14px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
}

.section-title::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(246, 189, 88, 0.14);
}

.done-title::before {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(69, 201, 107, 0.16);
}

.pill {
  color: #7d8599;
  background: #edf0f6;
}

.pill.ghost {
  color: #8c94a8;
  background: #edf0f6;
}

.step-list,
.msg-list {
  overflow: hidden;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
}

.step,
.msg {
  min-height: 54px;
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.step:last-child,
.msg:last-child { border-bottom: 0; }

.step {
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
}

.step:hover,
.msg:hover { background: rgba(255, 255, 255, 0.86); }

.step .check {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: none;
  border: 2px solid #cfd6e6;
  border-radius: 6px;
  background: #fff;
}

.step .check:hover { border-color: var(--accent); }

.step.is-done .check {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), #7462ff);
}

.step .check svg {
  width: 13px;
  height: 13px;
  opacity: 0;
}

.step.is-done .check svg { opacity: 1; }

.step .text {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.step.is-done .text {
  color: #8d94a7;
  text-decoration: line-through;
}

.step-date {
  color: #657089;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

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

.step .del,
.step .schedule-step {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #758097;
  font-size: 22px;
  line-height: 1;
}

.step .del:hover {
  color: var(--danger);
  background: #fff1f1;
}

.step .schedule-step:hover {
  color: var(--green);
  background: #f2fbf5;
}

.step-list.done .step {
  background: rgba(255, 255, 255, 0.62);
}

.inline-add {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  text-align: left;
}

.mini-empty {
  min-height: 76px;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 18px;
  border: 1px dashed #cfd6e6;
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.38);
  text-align: center;
  font-size: 14px;
}

.mini-empty strong {
  color: #6f778d;
  font-size: 14px;
}

.mini-empty small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

/* Inbox */
.add-msg {
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 28px rgba(29, 36, 58, 0.04);
}

.add-msg textarea {
  width: 100%;
  min-height: 94px;
  padding: 14px 16px;
  border: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.add-msg-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.msg-project {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
}

.msg {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  padding: 14px 14px 14px 18px;
}

.msg-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.msg-tag {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.msg-tag.general {
  color: var(--muted);
  background: #edf0f6;
}

.msg-text {
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.msg-date { color: var(--muted); font-size: 12px; font-weight: 600; }

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

.msg-actions button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}

.msg-done:hover,
.msg-reopen:hover {
  color: var(--green);
  border-color: #bce8ca;
  background: #f2fbf5;
}

.msg-del:hover {
  color: var(--danger);
  border-color: #f4c4c4;
  background: #fff5f5;
}

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

/* Calendar */
.calendar-panel {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 28px rgba(29, 36, 58, 0.04);
}

.calendar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.calendar-warnings {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(246, 189, 88, 0.45);
  background: rgba(246, 189, 88, 0.12);
  color: #77520d;
  font-size: 13px;
  font-weight: 700;
}

.calendar-list {
  display: flex;
  flex-direction: column;
  list-style: none;
  padding: 0;
}

.calendar-groups {
  display: grid;
  gap: 18px;
  padding: 16px 14px 6px;
}

.calendar-group {
  min-width: 0;
}

@media (min-width: 1100px) {
  .calendar-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

.calendar-event {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 64px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.calendar-event:last-child { border-bottom: 0; }

.calendar-event.is-task {
  background: rgba(239, 68, 68, 0.06);
}

.calendar-time {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.task-flag {
  color: var(--danger);
  font-size: 16px;
  line-height: 1;
}

.calendar-event-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-event-body strong {
  color: var(--text);
  font-size: 14px;
}

.calendar-event-body span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.calendar-empty {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  padding: 28px;
  border: 1px dashed #cfd6e6;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
}

.calendar-empty h3 {
  color: var(--text);
  font-size: 22px;
}

.calendar-empty p {
  max-width: 430px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

/* Empty */
.empty-screen {
  height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-illustration { margin-bottom: 16px; font-size: 54px; }

.empty-screen h2 {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 24px;
}

.empty-screen p {
  max-width: 390px;
  font-size: 14px;
  line-height: 1.55;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.42);
  backdrop-filter: blur(4px);
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 32px));
}

.toast {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid #cfd6e6;
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
  animation: toast-in .16s ease-out;
}

.toast.leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal {
  width: 420px;
  max-width: 100%;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.modal h3 {
  margin-bottom: 18px;
  color: var(--text);
  font-size: 20px;
}

.modal label {
  display: block;
  margin-bottom: 14px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.modal label .opt {
  color: var(--muted);
  font-weight: 600;
}

.modal input,
.modal textarea,
.modal select {
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  resize: none;
  color: var(--text);
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus,
.msg-project:focus {
  border-color: #b9bef9;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.schedule-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 14px;
}

.date-chip {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.date-chip.active {
  border-color: #b9bef9;
  background: var(--accent-soft);
  color: var(--accent);
}

.schedule-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 10px;
}

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 6px 0 22px;
}

.swatch {
  width: 28px;
  height: 28px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
}

.swatch.sel { box-shadow: 0 0 0 3px rgba(91, 99, 246, 0.26); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-ghost,
.btn-primary {
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
}

.btn-ghost {
  background: #edf0f6;
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.token-hint {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* Mobile chrome */
.only-mobile { display: none; }

.menu-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 30;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.icon-btn.ghostly {
  margin-left: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
}

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d3d9e6; border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #bfc7d8; }

@media (max-width: 1080px) {
  .main { padding: 26px 26px 42px; }
  .toolbar { grid-template-columns: 1fr; }
  .today-grid { grid-template-columns: 1fr; }
  .command-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "focus"
      "orbit"
      "tasks"
      "agenda"
      "inbox";
  }

  .command-capture {
    grid-template-columns: 1fr;
  }

  .capture-mode {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app { display: block; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(86vw, 320px);
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  }

  .sidebar.open { transform: translateX(0); }

  .main {
    height: auto;
    min-height: 100vh;
    padding: 74px 16px 28px;
  }

  .only-mobile,
  .menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .project-header {
    align-items: flex-start;
    margin-bottom: 22px;
  }

  .today-header {
    flex-direction: column;
    margin-bottom: 16px;
  }

  .command-shell {
    min-height: auto;
    padding: 12px;
    border-radius: 10px;
  }

  .command-top {
    flex-direction: column;
  }

  .command-top h2 {
    font-size: 30px;
  }

  .command-status {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .command-status span,
  .command-status .filter-btn {
    width: 100%;
  }

  .stage-copy h3 {
    font-size: 30px;
  }

  .project-orbit {
    min-height: 300px;
  }

  .project-orbit::before {
    inset: 32px;
  }

  .project-orbit::after {
    inset: 78px;
  }

  .today-header h2 {
    font-size: 30px;
  }

  .quick-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
  }

  .quick-actions .btn-add,
  .quick-actions .filter-btn {
    width: 100%;
    padding: 0 10px;
  }

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

  .metric {
    min-height: 68px;
  }

  .metric strong {
    font-size: 24px;
  }

  .ph-dot {
    width: 46px;
    height: 46px;
  }

  #phName { font-size: 24px; }
  .ph-desc { font-size: 14px; }

  .progress-wrap {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .progress-track { grid-column: 1 / -1; order: 3; }

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

  .filter-btn,
  .task-cta { width: 100%; }

  .add-step {
    grid-template-columns: 1fr;
    padding: 0 0 10px;
  }

  .add-step::before {
    top: 14px;
    transform: none;
  }

  .add-step input {
    margin: 0 14px 0 50px;
    min-height: 48px;
  }

  .add-step .btn-add {
    width: calc(100% - 24px);
    margin: 0 12px;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
  }

  .step {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    padding: 10px 10px 10px 14px;
  }

  .step-date {
    grid-column: 2;
    justify-self: start;
    font-size: 12px;
  }

  .add-msg-row { grid-template-columns: 1fr; }

  .calendar-panel {
    min-height: 0;
  }

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

  .calendar-event {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .calendar-list.compact .calendar-event {
    grid-template-columns: 1fr;
  }

  .calendar-empty {
    min-height: 300px;
    padding: 22px;
  }

  .schedule-grid,
  .schedule-presets {
    grid-template-columns: 1fr;
  }

  #scheduleModal .modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* ---- Marca / logo ---- */
.brand-mark {
  background: none !important;
  box-shadow: none !important;
  overflow: hidden;
  padding: 0;
}
.brand-mark img { width: 100%; height: 100%; display: block; }

/* ---- Logout en el pie ---- */
.sidebar-foot { grid-template-columns: 42px 1fr auto; }
#logoutBtn { width: 34px; height: 34px; font-size: 16px; }

/* ---- Login ---- */
.login-modal { text-align: center; }
.login-modal label { text-align: left; }
.login-logo {
  width: 56px; height: 56px;
  margin: 2px auto 16px;
  border-radius: 14px;
  overflow: hidden;
}
.login-logo img { width: 100%; height: 100%; display: block; }
.login-error {
  margin: 4px 0 12px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}
