:root {
  --ink: #202124;
  --muted: #6b7280;
  --line: #d6d1c7;
  --paper: #fbfaf5;
  --panel: #ffffff;
  --accent: #446c83;
  --accent-ink: #ffffff;
  --mint: #d7f2ea;
  --rose: #ffe1df;
  --shadow: 0 18px 45px rgba(32, 33, 36, .12);
  --radius: 8px;
  --hour-height: 72px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(251, 250, 245, .9), rgba(251, 250, 245, .9)),
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(68, 108, 131, .06) 36px),
    repeating-linear-gradient(90deg, transparent 0 35px, rgba(150, 120, 78, .06) 36px);
  font-family: "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(rgba(251, 250, 245, .92), rgba(251, 250, 245, .92)),
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(68, 108, 131, .08) 36px);
}

.login-gate.hidden {
  display: none;
}

.login-card {
  width: min(390px, 100%);
  padding: 26px;
  border: 1px solid #c9c2b7;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.login-card .brand-mark {
  margin-bottom: 4px;
}

.login-card h1 {
  font-size: 30px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: #ba2d2d;
  font-size: 13px;
  font-weight: 700;
}

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

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

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

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #153456;
  background: linear-gradient(135deg, var(--mint), #fdf1ca);
  font-size: 26px;
  font-weight: 900;
  border: 1px solid #bcded5;
}

.brand-mark.logo-mark {
  overflow: hidden;
  padding: 0;
  background: #fff;
  border-color: rgba(47, 42, 31, .14);
  box-shadow: 0 8px 18px rgba(32, 33, 36, .12);
}

.brand-mark.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
}

.login-card .logo-mark {
  width: 84px;
  height: 84px;
  border-radius: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #607084;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.18;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 28px;
}

.mini-card,
.hint-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 16px;
}

.date-card {
  background: #202124;
  color: white;
}

.date-card p,
.hint-panel p,
.subtle {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.date-card p {
  color: #c9d3df;
}

.date-card strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab,
.primary-btn,
.ghost-btn,
.icon-btn {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
}

.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.tab.active {
  border-color: #8dc7ba;
  background: var(--mint);
}

.sidebar-actions {
  display: grid;
  gap: 10px;
}

.primary-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0 16px;
}

.ghost-btn {
  padding: 0 16px;
}

.backup-import-btn {
  display: grid;
  place-items: center;
}

.backup-import-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.icon-btn {
  width: 42px;
  padding: 0;
  font-size: 20px;
}

.danger,
.danger-text {
  color: #ba2d2d;
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar,
.month-hero,
.cards-header,
.fixed-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

[hidden] {
  display: none !important;
}

.month-hero {
  padding: 18px 0 14px;
}

.month-hero h2,
#monthTitle {
  font-size: clamp(28px, 4vw, 54px);
  font-weight: 500;
  letter-spacing: 0;
}

.month-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.paper-month {
  border: 1px solid #c9c2b7;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow);
  padding: 18px;
}

.month-top-space {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.month-memo {
  min-height: 150px;
  display: grid;
  align-content: start;
}

.month-memo span {
  color: #6f6258;
  font-size: 13px;
  font-weight: 700;
}

#monthMemoText {
  min-height: 118px;
  margin-top: 8px;
  border: 0;
  border-radius: 0;
  padding: 8px 2px;
  background:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(111, 98, 88, .22) 28px),
    transparent;
  color: #34312f;
  line-height: 28px;
  resize: vertical;
  outline: 0;
}

#monthMemoText:focus {
  background:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(68, 108, 131, .35) 28px),
    rgba(255, 253, 245, .5);
}

.mini-months {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
}

.mini-month {
  width: 132px;
  color: #6f6258;
  font-size: 10px;
}

.mini-month strong {
  display: block;
  margin-bottom: 5px;
  font-size: 18px;
  font-weight: 500;
}

.mini-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  text-align: center;
}

.mini-month-grid span:nth-child(-n+7) {
  color: #b45a5a;
  font-weight: 700;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid #c9c2b7;
  border-left: 1px solid #c9c2b7;
}

.month-weekday,
.month-day {
  border-right: 1px solid #c9c2b7;
  border-bottom: 1px solid #c9c2b7;
}

.month-weekday {
  min-height: 38px;
  display: grid;
  place-items: center;
  color: #6f6258;
  background: #fbf7ef;
  font-size: 13px;
  font-weight: 700;
}

.month-day {
  position: relative;
  min-height: clamp(104px, 14vw, 158px);
  padding: 10px;
  background: rgba(255, 255, 255, .44);
  text-align: left;
  border-radius: 0;
}

.month-day:hover,
.month-day:focus-visible {
  outline: 2px solid rgba(68, 108, 131, .28);
  outline-offset: -2px;
  background: #fffdf5;
}

.month-day.outside {
  color: #a9a39b;
  background: rgba(248, 246, 240, .58);
}

.month-day.today .day-number {
  border: 1px solid #5f6b76;
  border-radius: 999px;
}

.day-number {
  display: inline-grid;
  width: clamp(22px, 2.6vw, 34px);
  height: clamp(22px, 2.6vw, 34px);
  place-items: center;
  color: #334155;
  font-size: clamp(18px, 2.2vw, 28px);
  font-weight: 400;
  line-height: 1;
}

.lunar-date {
  margin-left: 4px;
  color: #6f6258;
  font-size: 11px;
}

.month-note-preview {
  margin-top: 12px;
  padding: 7px 8px;
  border-left: 5px solid #fff36d;
  background: rgba(255, 243, 109, .28);
  color: #34312f;
  font-size: clamp(10px, 1.1vw, 14px);
  line-height: 1.55;
  white-space: pre-line;
  word-break: break-word;
}

.month-note-empty {
  margin-top: 18px;
  color: #bab2a7;
  font-size: 13px;
}

.schedule-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
}

.schedule-grid {
  display: grid;
  grid-template-columns: 78px repeat(7, minmax(132px, 1fr));
  min-width: 1050px;
  position: relative;
}

.time-head,
.day-head {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 62px;
  padding: 12px;
  background: #fffaf0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.day-head {
  display: grid;
  align-content: center;
  gap: 2px;
}

.day-head strong {
  font-size: 16px;
}

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

.time-cell {
  min-height: var(--hour-height);
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .72);
}

.day-cell {
  position: relative;
  min-height: var(--hour-height);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  overflow: visible;
}

.course-block {
  position: absolute;
  z-index: 3;
  left: 7px;
  right: 7px;
  border-radius: var(--radius);
  padding: 8px 9px;
  color: #102033;
  border: 1px solid rgba(0, 0, 0, .12);
  box-shadow: 0 10px 24px rgba(40, 49, 60, .13);
  overflow: hidden;
  min-height: 46px;
}

.course-block strong {
  display: block;
  font-size: 13px;
  line-height: 1.25;
}

.course-block span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(16, 32, 51, .74);
}

.search-box {
  width: min(360px, 100%);
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
}

.course-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.course-card {
  min-height: 184px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 10px 24px rgba(32, 33, 36, .08);
}

.course-card .stripe {
  width: 100%;
  height: 8px;
  border-radius: 99px;
  margin-bottom: 14px;
}

.course-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.notebook-lock {
  min-height: 0;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 18px rgba(32, 33, 36, .08);
  padding: 14px;
}

.notebook-card {
  box-shadow: none;
  width: 100%;
  max-width: none;
  padding: 0;
  background: transparent;
  border: 0;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 260px) auto;
  gap: 10px;
  align-items: end;
}

.notebook-card .subtle {
  display: none;
}

.notebook-card h2 {
  margin: 0;
  font-size: 18px;
}

.notebook-card label {
  margin: 0;
}

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

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

.sticky-notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.sticky-note {
  min-height: 190px;
  border: 1px solid rgba(32, 33, 36, .16);
  border-radius: var(--radius);
  padding: 16px;
  color: #2f2a1f;
  box-shadow: 0 12px 22px rgba(32, 33, 36, .1);
  text-align: left;
  transform: rotate(var(--tilt, 0deg));
}

.sticky-note h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.sticky-note p {
  margin: 0;
  line-height: 1.65;
  white-space: pre-line;
  word-break: break-word;
}

.sticky-note small {
  display: block;
  margin-top: 14px;
  color: rgba(47, 42, 31, .64);
}

.backup-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.backup-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .88);
  padding: 16px;
  box-shadow: 0 10px 24px rgba(32, 33, 36, .08);
}

.backup-panel h3 {
  margin: 0 0 8px;
}

.backup-panel p,
.backup-status {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.7;
}

.backup-status {
  display: grid;
  gap: 7px;
}

.backup-status span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 6px;
}

.website-panel {
  grid-column: 1 / -1;
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-title-row p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.website-links-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.website-link-page {
  display: grid;
  gap: 16px;
}

.website-quick-add {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.website-quick-add h2 {
  margin: 0;
}

.quick-website-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.quick-website-form input {
  min-height: 46px;
}

.website-icon-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.website-link-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.website-open-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: #2f2a1f;
  text-align: center;
  text-decoration: none;
}

.website-open-card strong {
  display: block;
  font-size: 15px;
}

.website-open-card em {
  display: block;
  margin-top: 4px;
  color: #315f7d;
  font-size: 12px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.website-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: #e7f3ef;
  color: #2f6d62;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
}

.website-link-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.website-link-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

#importView .import-layout {
  display: none;
}

.money-layout {
  display: grid;
  grid-template-columns: minmax(260px, .9fr) minmax(320px, 1.1fr);
  gap: 16px;
}

.money-panel,
.private-zone {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  padding: 16px;
}

.money-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 130px auto;
  gap: 10px;
  margin-bottom: 14px;
}

.investment-form {
  grid-template-columns: 96px minmax(0, 1fr) 100px 120px auto;
}

.money-list,
.payment-table {
  display: grid;
  gap: 8px;
}

.money-item,
.payment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px;
}

.money-item span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.payment-row {
  grid-template-columns: auto 64px minmax(0, 1fr) auto auto;
}

.payment-row input {
  width: 20px;
  height: 20px;
}

.payment-row:has(input:checked) {
  background: #eef8f2;
  color: #2f6d62;
}

.payment-row em {
  justify-self: end;
  border-radius: 999px;
  background: #f5efe7;
  color: #76533a;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  padding: 4px 8px;
  white-space: nowrap;
}

.payment-row:has(input:checked) em {
  background: #d8efe4;
  color: #2f6d62;
}

.private-zone {
  margin-top: 0;
}

.private-lock {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 240px) auto auto;
  gap: 10px;
  align-items: end;
}

.private-lock h2 {
  margin: 0;
}

.private-app {
  display: grid;
  gap: 12px;
}

.private-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.private-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 12px;
  align-self: start;
}

.private-panel h3 {
  margin: 0;
  font-size: 18px;
}

.private-form {
  grid-template-columns: minmax(0, 1fr) 150px 130px auto;
}

.private-summary {
  overflow-x: auto;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 14px;
}

.summary-table th,
.summary-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: right;
}

.summary-table th:first-child,
.summary-table td:first-child {
  text-align: left;
}

.summary-table thead th {
  background: #fbf7ef;
  color: #6f6258;
}

.compact-summary {
  font-size: 13px;
}

.compact-summary th,
.compact-summary td {
  padding: 7px 8px;
}

.summary-loan td {
  background: #fff6df;
}

.summary-tw {
  background: #eaf7ef;
}

.summary-us {
  background: #eaf1ff;
}

.summary-total td {
  background: #f3efe7;
  color: #2f2a1f;
  font-weight: 900;
  border-top: 2px solid #c9c2b7;
}

.investment-section {
  display: grid;
  gap: 8px;
}

.investment-section h4 {
  margin: 6px 0 0;
  color: #4a5868;
}

.compact-empty {
  padding: 14px;
}

.color-memory {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 7px;
}

.color-memory span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.color-chip {
  width: 22px;
  height: 22px;
  border: 1px solid rgba(32, 33, 36, .22);
  border-radius: 5px;
  padding: 0;
  box-shadow: 0 2px 5px rgba(32, 33, 36, .12);
}

.meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
  color: var(--muted);
  font-size: 14px;
}

.note {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: #536171;
  line-height: 1.6;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 18px;
}

.import-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  padding: 18px;
}

textarea {
  width: 100%;
  resize: vertical;
}

#importText {
  min-height: 320px;
  margin: 16px 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  line-height: 1.7;
}

.import-actions,
.dialog-actions,
.dialog-actions > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.import-preview {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.preview-item {
  border: 1px solid var(--line);
  border-left: 8px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px;
  background: white;
}

.fixed-wrap {
  overflow: auto;
  border: 1px solid #1f2933;
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.fixed-title-block {
  min-width: 0;
}

.fixed-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

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

.file-btn {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  padding: 0 14px;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

.file-btn input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sheet-select {
  min-height: 42px;
  width: auto;
  max-width: 100px;
}

.fixed-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.fixed-summary-strip {
  display: none;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 6px;
  overflow-x: auto;
  padding: 0;
  max-width: min(780px, 56vw);
}

.has-import .fixed-summary-strip {
  display: grid;
}

.summary-card {
  border: 1px solid #d6d1c7;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .92);
  padding: 5px 7px;
  box-shadow: none;
}

.summary-card.active {
  border-color: #446c83;
  box-shadow: inset 0 0 0 2px rgba(68, 108, 131, .16);
}

.summary-card strong {
  display: inline-block;
  margin: 0 6px 0 0;
  color: #243447;
  font-size: 12px;
}

.summary-items {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.summary-pill {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: #f7f2e8;
  color: #334155;
  font-size: 11px;
  font-weight: 700;
}

.summary-pill.total {
  background: #fff36d;
  color: #3f3300;
}

.changed-legend {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 99px;
  border: 1px solid #d4a700;
  background: #fff36d;
  color: #4a3b00;
  font-weight: 700;
}

.import-fixed-table {
  display: none;
}

.has-import #fallbackFixedTable {
  display: none;
}

.has-import #fixedImportTable {
  display: table;
}

.fixed-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 10px;
}

.fixed-table th,
.fixed-table td {
  border: 1px solid #1f2933;
  padding: 2px 3px;
  text-align: center;
  vertical-align: middle;
}

.fixed-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fffaf0;
  font-size: 10px;
}

.fixed-table .meta-col {
  width: 38px;
  background: #f8f6f0;
  font-weight: 700;
}

.fixed-table .slot-col {
  width: 78px;
}

.fixed-table .teacher-col {
  width: 40px;
}

.fixed-cell {
  min-height: 27px;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #14212f;
  display: grid;
  gap: 1px;
  place-items: center;
  line-height: 1.22;
  white-space: pre-line;
}

.fixed-cell.modified {
  /* 移除已修改樣式 */
}

.fixed-cell.modified::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 1px;
  padding: 1px 3px;
  border-radius: 99px;
  background: #4a3b00;
  color: white;
  font-size: 8px;
}

.fixed-cell {
  position: relative;
}

.fixed-cell strong {
  font-size: 10px;
  font-weight: 700;
}

.fixed-cell span {
  color: #5a6675;
  font-size: 9px;
}

.fixed-cell.highlight {
  color: #b00020;
}

.fixed-row-week {
  background: #f7fbff;
}

.fixed-empty {
  color: #9aa5b1;
  font-size: 9px;
}

.course-dialog {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
}

.course-dialog::backdrop {
  background: rgba(32, 33, 36, .38);
  backdrop-filter: blur(4px);
}

#courseForm {
  padding: 20px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}

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

label span {
  display: block;
  margin-bottom: 6px;
  color: #4a5868;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

input[type="color"] {
  height: 44px;
  padding: 5px;
}

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

.dialog-actions {
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #202124;
  color: white;
  transition: .2s ease;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.empty-state {
  border: 1px dashed #a7b2bf;
  border-radius: var(--radius);
  padding: 28px;
  background: rgba(255, 255, 255, .72);
  color: var(--muted);
  text-align: center;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

  .brand {
    align-items: flex-start;
  }

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

  .hint-panel {
    display: none;
  }

  .content {
    padding: 18px;
  }

  .import-layout {
    grid-template-columns: 1fr;
  }

  .notebook-card,
  .quick-website-form,
  .money-layout,
  .money-form,
  .investment-form,
  .private-form,
  .private-two-col,
  .private-lock {
    grid-template-columns: 1fr;
  }

  .paper-month {
    padding: 12px;
  }

  .private-zone,
  .money-panel,
  .backup-panel,
  .website-quick-add {
    padding: 14px;
  }

  .private-summary,
  .fixed-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .summary-table {
    min-width: 360px;
  }

  .payment-row,
  .money-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .payment-row {
    grid-template-columns: auto 52px minmax(0, 1fr);
  }

  .payment-row b {
    grid-column: 2 / 3;
    justify-self: end;
  }

  .payment-row em {
    grid-column: 3 / 4;
    justify-self: end;
  }

  .month-top-space {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mini-months {
    justify-content: start;
    overflow-x: auto;
  }

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

@media (max-width: 640px) {
  h2 {
    font-size: 23px;
  }

  body {
    font-size: 15px;
  }

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

  .sidebar {
    padding: 14px;
    gap: 14px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .brand h1 {
    font-size: 22px;
  }

  .tabs,
  .sidebar-actions,
  .topbar,
  .month-hero,
  .cards-header,
  .fixed-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

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

  .tab {
    min-height: 46px;
    padding: 0 10px;
    font-size: 14px;
  }

  .content {
    padding: 14px;
  }

  .topbar {
    margin-bottom: 6px;
  }

  .fixed-summary-strip {
    max-width: 100%;
  }

  .fixed-title-row {
    align-items: flex-start;
  }

  .toolbar {
    justify-content: end;
  }

  .month-controls {
    justify-content: space-between;
  }

  .paper-month {
    overflow-x: hidden;
    padding: 8px;
  }

  .month-memo {
    min-height: 118px;
  }

  #monthMemoText {
    min-height: 92px;
    font-size: 14px;
  }

  .month-day {
    min-height: 86px;
    padding: 4px;
  }

  .day-number {
    width: 24px;
    height: 24px;
    font-size: 20px;
  }

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

  .lunar-date {
    display: block;
    margin: 2px 0 0;
    font-size: 9px;
  }

  .month-note-preview {
    margin-top: 6px;
    padding: 4px 5px;
    border-left-width: 3px;
    font-size: 9.5px;
    line-height: 1.45;
    max-height: 58px;
    overflow: hidden;
  }

  .month-note-empty {
    margin-top: 8px;
    font-size: 10px;
  }

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

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

  .website-link-card,
  .private-panel,
  .money-panel,
  .backup-panel {
    padding: 12px;
  }

  .website-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 21px;
  }

  .summary-table {
    min-width: 320px;
    font-size: 12px;
  }

  .summary-table th,
  .summary-table td {
    padding: 6px 7px;
  }

  .private-two-col {
    gap: 12px;
  }

  .private-lock {
    gap: 8px;
  }

  .money-form,
  .investment-form,
  .private-form {
    gap: 8px;
  }

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

  .money-item b,
  .money-item button {
    justify-self: stretch;
  }

  .fixed-wrap {
    max-width: calc(100vw - 28px);
  }

  .dialog-actions,
  .dialog-actions > div,
  .import-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .dialog-actions button,
  .import-actions button {
    width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .toast,
  .course-dialog {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .content {
    padding: 0;
  }

  .schedule-wrap {
    box-shadow: none;
    border: 0;
  }
}
