:root {
  --bg: #f3eadb;
  --surface: #fffaf2;
  --surface-soft: #f8f0e2;
  --ink: #071f3d;
  --muted: #6f675d;
  --line: #dfcfb3;
  --accent: #071f3d;
  --accent-2: #12365f;
  --accent-soft: #e5edf5;
  --accent-wash: #f0f5fa;
  --olive: #5d6654;
  --gold: #c8a45d;
  --gold-deep: #9c7735;
  --gold-soft: #f0dfb8;
  --teal: #466a72;
  --shadow: 0 18px 44px rgba(7, 31, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Noto Sans TC",
    "Microsoft JhengHei",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid rgba(200, 164, 93, 0.28);
  background: linear-gradient(180deg, #071f3d 0%, #0b294f 100%);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--gold);
  display: grid;
  place-items: center;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 700;
  background: rgba(255, 250, 242, 0.08);
}

.brand-title {
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fffaf2;
}

.brand-subtitle,
.sync-note,
.page-subtitle,
.metric-card span,
.section-title-row p,
.date-block span {
  color: var(--muted);
}

.brand-subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255, 250, 242, 0.74);
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 250, 242, 0.82);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 250, 242, 0.08);
}

.nav-item.active {
  background: rgba(200, 164, 93, 0.16);
  color: #fffaf2;
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: currentColor;
  flex: 0 0 auto;
}

.nav-divider {
  height: 1px;
  background: rgba(200, 164, 93, 0.2);
}

.sync-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(200, 164, 93, 0.3);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.08);
}

.sync-label {
  color: rgba(255, 250, 242, 0.68);
  font-size: 12px;
}

.sync-time {
  margin-top: 6px;
  font-weight: 700;
  color: #fffaf2;
}

.sync-note {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 250, 242, 0.68);
}

.main-panel {
  padding: 34px 42px 56px;
  max-width: 1240px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-deep);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2,
p,
.item-title,
.project-focus,
.timeline-body p,
.assistant-strip p {
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.12;
  font-weight: 800;
}

.page-subtitle {
  margin-top: 10px;
  font-size: 15px;
}

.date-block {
  min-width: 190px;
  text-align: right;
  color: #5d554d;
}

.date-block div {
  font-weight: 700;
}

.date-block span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
}

.assistant-strip {
  margin-top: 28px;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid rgba(200, 164, 93, 0.36);
  background: linear-gradient(90deg, #071f3d, #12365f);
  display: flex;
  gap: 12px;
  align-items: center;
}

.assistant-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(198, 164, 92, 0.2);
  flex: 0 0 auto;
}

.assistant-strip p {
  line-height: 1.65;
  color: #fffaf2;
}

.metric-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

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

.metric-card {
  min-height: 150px;
  padding: 22px;
}

.metric-card p {
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 24px;
  font-size: 40px;
  line-height: 1;
}

.metric-card span {
  display: block;
  margin-top: 12px;
}

.progress-card strong {
  font-size: 31px;
}

.progress-card {
  background: linear-gradient(160deg, #071f3d 0%, #12365f 100%);
  border-color: rgba(200, 164, 93, 0.42);
  color: #fffaf2;
}

.progress-card p,
.progress-card span {
  color: rgba(255, 250, 242, 0.78);
}

.progress-card strong {
  color: #fffaf2;
}

.progress-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.project-select-label {
  display: grid;
  gap: 6px;
  min-width: 136px;
  color: rgba(255, 250, 242, 0.74);
  font-size: 12px;
  font-weight: 700;
}

.project-select-label select {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(200, 164, 93, 0.62);
  border-radius: 8px;
  background: #fffaf2;
  color: var(--accent);
  padding: 7px 10px;
  font-weight: 700;
  cursor: pointer;
}

.progress-track {
  margin-top: 18px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.22);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), #f4d993);
}

.content-grid {
  margin-top: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(340px, 0.68fr);
  gap: 18px;
}

.change-alert-panel {
  margin-top: 26px;
}

.panel {
  padding: 22px;
}

.section-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-title-row h2 {
  font-size: 20px;
  line-height: 1.25;
}

.section-title-row p {
  margin-top: 6px;
  font-size: 13px;
}

.pill {
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  white-space: nowrap;
}

.follow-list,
.project-list,
.change-alert-list,
.cost-board {
  display: grid;
}

.follow-item,
.change-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.follow-item:first-child,
.project-item:first-child,
.change-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.priority {
  width: 34px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.priority.high {
  background: #f4d9d5;
  color: #9d3c31;
}

.priority.medium {
  background: var(--gold-soft);
  color: var(--gold-deep);
}

.priority.low {
  background: #dfeae4;
  color: var(--olive);
}

.item-kicker {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 5px;
}

.item-title {
  font-weight: 700;
  line-height: 1.55;
}

.project-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  border-radius: 8px;
}

.project-item:hover {
  background: var(--surface-soft);
  padding-left: 12px;
  padding-right: 12px;
}

.project-item.selected {
  background: #f4ebd8;
  padding-left: 12px;
  padding-right: 12px;
  box-shadow: inset 3px 0 0 var(--gold);
}

.project-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.project-name {
  font-weight: 800;
}

.project-stage {
  color: var(--gold-deep);
  font-size: 12px;
  font-weight: 800;
}

.project-focus {
  margin-top: 10px;
  color: #524d48;
  line-height: 1.6;
}

.project-communication {
  margin-top: 8px;
  color: var(--accent-2);
  line-height: 1.55;
  font-size: 13px;
}

.project-change-note {
  margin-top: 8px;
  color: var(--gold-deep);
  line-height: 1.55;
  font-size: 13px;
  font-weight: 800;
}

.change-body {
  min-width: 0;
}

.change-meta {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.change-meta span {
  color: var(--accent);
  background: #f4ead9;
  border: 1px solid rgba(200, 164, 93, 0.28);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.project-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-meta span {
  color: var(--muted);
  background: #f4ead9;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
}

.timeline-panel {
  margin-top: 28px;
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 0;
  padding-left: 26px;
}

.timeline-list::before {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 8px;
  left: 7px;
  width: 1px;
  background: #d7c7ac;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 23px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px #d7c7ac;
}

.timeline-date {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.timeline-body strong {
  display: block;
  margin-bottom: 5px;
}

.timeline-body p {
  color: #5e5852;
  line-height: 1.6;
}

.empty-state {
  margin: 10px 0 2px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 16px;
}

.placeholder-panel {
  margin-top: 28px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.quick-card {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 16px;
}

.quick-card strong {
  display: block;
  margin-bottom: 8px;
}

.quick-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.project-directory {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.project-large-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: inherit;
  padding: 18px;
  text-align: left;
  cursor: pointer;
}

.project-large-card:hover {
  border-color: var(--gold);
  box-shadow: 0 14px 30px rgba(7, 31, 61, 0.1);
}

.project-progress {
  margin-top: 14px;
  background: #eadcc4;
}

.calendar-list {
  display: grid;
  gap: 0;
  margin-top: 18px;
}

.calendar-item {
  display: grid;
  grid-template-columns: 92px 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.calendar-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.calendar-date {
  color: var(--accent);
  font-weight: 800;
  white-space: nowrap;
}

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

.calendar-shell {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.calendar-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.calendar-month-title {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 900;
  color: var(--accent);
}

.calendar-toolbar p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.calendar-controls {
  display: flex;
  gap: 8px;
}

.calendar-controls button,
.calendar-filter {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--accent);
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.calendar-controls button:hover,
.calendar-filter:hover {
  border-color: var(--gold);
}

.calendar-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.calendar-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.calendar-filter span {
  min-width: 22px;
  border-radius: 999px;
  background: #eadcc4;
  color: var(--gold-deep);
  padding: 2px 7px;
  font-size: 12px;
}

.calendar-filter.active {
  background: var(--accent);
  color: #fffaf2;
  border-color: var(--accent);
}

.calendar-filter.active span {
  background: var(--gold);
  color: var(--accent);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.weekday {
  min-height: 38px;
  display: grid;
  place-items: center;
  background: #eadcc4;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  border-right: 1px solid var(--line);
}

.weekday:nth-child(7n) {
  border-right: 0;
}

.month-day {
  min-height: 118px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #fffaf2;
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 6px;
}

.month-day:nth-child(7n) {
  border-right: 0;
}

.month-day.outside-month {
  background: #f6efe4;
  color: #a29584;
}

.month-day.today {
  background: #f7ecd6;
  box-shadow: inset 0 0 0 2px var(--gold);
}

.day-number {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 900;
}

.today .day-number {
  background: var(--accent);
  color: #fffaf2;
}

.day-events {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.calendar-event {
  min-height: 22px;
  border-radius: 5px;
  padding: 3px 6px;
  color: #fffaf2;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-event.case {
  background: var(--accent-2);
}

.calendar-event.site {
  background: #438a91;
}

.calendar-event.lead {
  background: #5d7d3e;
}

.calendar-event.money {
  background: var(--gold-deep);
}

.calendar-more {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-agenda {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.calendar-agenda h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.agenda-item {
  display: grid;
  grid-template-columns: 76px 110px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid #eadcc4;
}

.agenda-item:first-of-type {
  border-top: 0;
}

.agenda-item span {
  color: var(--muted);
  font-weight: 800;
}

.agenda-item strong {
  color: var(--accent);
}

.agenda-item p {
  color: #5e5852;
  line-height: 1.5;
}

.hidden {
  display: none;
}

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

  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    top: 0;
    padding: 12px 14px;
    display: block;
  }

  .brand {
    margin-bottom: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 19px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
    padding: 0 12px;
    border: 1px solid transparent;
    background: rgba(255, 250, 242, 0.08);
  }

  .nav-divider,
  .sync-card {
    display: none;
  }

  .main-panel {
    padding: 24px 16px 38px;
  }

  .topbar {
    display: grid;
  }

  .date-block {
    text-align: left;
    min-width: 0;
  }

  .metric-grid,
  .content-grid,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 122px;
  }

  .metric-card strong {
    margin-top: 18px;
    font-size: 34px;
  }
}

@media (max-width: 1180px) and (min-width: 941px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .main-panel {
    padding-inline: 12px;
  }

  .assistant-strip,
  .metric-card,
  .panel {
    border-radius: 8px;
  }

  .section-title-row,
  .project-head {
    display: grid;
    justify-content: stretch;
  }

  .progress-card-head {
    display: grid;
  }

  .project-select-label {
    min-width: 0;
  }

  .follow-item {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .timeline-list {
    padding-left: 18px;
  }

  .timeline-item {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
  }

  .calendar-item {
    grid-template-columns: 72px 36px minmax(0, 1fr);
    gap: 10px;
  }

  .calendar-toolbar {
    display: grid;
  }

  .calendar-month-title {
    font-size: 25px;
  }

  .calendar-filters {
    gap: 8px;
  }

  .calendar-filter {
    min-height: 34px;
    padding: 0 10px;
  }

  .month-grid {
    margin-inline: -6px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .weekday {
    min-height: 30px;
    font-size: 11px;
  }

  .month-day {
    min-height: 92px;
    padding: 5px 3px;
  }

  .day-number {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }

  .calendar-event {
    min-height: 20px;
    padding: 2px 4px;
    font-size: 11px;
  }

  .agenda-item {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .agenda-item p {
    grid-column: 1 / -1;
  }
}
