:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  color: #122033;
  background: #f4f7fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 1280px;
  min-height: 100vh;
  background: #f4f7fb;
}

button, input, select, textarea { font: inherit; }

button { cursor: pointer; }

.memo-shell {
  display: grid;
  grid-template-columns: minmax(560px, 697px) minmax(700px, 1fr);
  gap: 12px;
  min-height: 100vh;
  padding: 12px;
}


.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h1, .panel-header h2, .schedule-panel > h2 { margin: 0; }
.panel-header h1 { font-size: 20px; }
.panel-header h2 { font-size: 19px; }
.schedule-panel > h2 { font-size: 16px; }

.panel-header p, .section-note, .panel-hint, #historyText, .export-dialog p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 12px;
}

.library-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: calc(100vh - 24px);
  padding: 12px;
}

.library-header { margin-bottom: 10px; }

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.status-chip {
  max-width: 210px;
  padding: 5px 8px;
  overflow: hidden;
  color: #1f5eff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: #eef4ff;
  border-radius: 4px;
}


.button:hover:not(:disabled) { opacity: .9; }
.button:disabled { cursor: not-allowed; opacity: .52; }
.button.primary { color: #fff; background: #1f5eff; border-color: #1f5eff; }
.button.danger { color: #fff; background: #b91c1c; border-color: #b91c1c; }
.button.full { width: 100%; }



input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid rgb(31 94 255 / 28%);
  outline-offset: 1px;
}

.filter-toolbar { margin-bottom: 10px; }
.search-row { display: grid; grid-template-columns: minmax(0, 1fr) 78px; gap: 8px; }
.filter-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.select-all { display: flex; align-items: center; gap: 6px; padding-left: 4px; font-size: 13px; }
.select-all input { width: auto; height: auto; }


.memo-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.memo-table thead { position: sticky; top: 0; z-index: 2; }
.memo-table th {
  height: 38px;
  padding: 0 10px;
  color: #435166;
  font-size: 13px;
  text-align: left;
  background: #f3f7fc;
  border-bottom: 1px solid #dce5ef;
}
.memo-table td {
  height: 44px;
  padding: 6px 10px;
  overflow: hidden;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-bottom: 1px solid #e8eef5;
}
.memo-table tbody tr:hover { background: #f4f8ff; }
.memo-table tbody tr.active { background: #eaf1ff; }
.memo-table .check-col { width: 35px; padding-inline: 7px; }
.memo-table th:nth-child(2) { width: 74px; }
.memo-table th:nth-child(4) { width: 118px; }
.memo-table th:nth-child(5) { width: 54px; text-align: center; }
.memo-table th:nth-child(6) { width: 58px; }
.memo-table input[type="checkbox"] { width: auto; height: auto; }
.reminder-dot { display: block; color: #1f5eff; font-size: 16px; text-align: center; }

.category-badge {
  display: inline-block;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 3px;
}
.category-email { color: #075985; background: #e0f2fe; }
.category-connection { color: #5b21b6; background: #ede9fe; }
.category-bank { color: #166534; background: #dcfce7; }
.category-application { color: #9a3412; background: #ffedd5; }
.category-important { color: #991b1b; background: #fee2e2; }
.category-other { color: #334155; background: #e2e8f0; }

.empty-state { margin: 16px; color: #64748b; text-align: center; }
.panel-hint { margin-top: 10px; }

.right-workspace {
  display: grid;
  grid-template-rows: 440px minmax(360px, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: calc(100vh - 24px);
}

.editor-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 12px;
}

.editor-header { margin-bottom: 10px; }
.compact-actions { flex-wrap: nowrap; }
.compact-actions .button { padding-inline: 10px; white-space: nowrap; }
.editor-scroll { min-height: 0; overflow: auto; }

.compact-card {
  padding: 10px;
  background: #fff;
  border: 1px solid #afc0d4;
  border-radius: 6px;
  box-shadow: 0 1px 12px rgb(11 18 32 / 7%);
}
.compact-card + .compact-card { margin-top: 6px; }
.compact-card h3, .agenda-card h3 { margin: 0 0 6px; font-size: 14px; }
.section-note { margin-bottom: 8px; line-height: 1.5; }

.six-field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; }
.six-field-grid label, .reminder-form label { color: #64748b; font-size: 12px; }
.six-field-grid input { height: 28px; margin-top: 2px; padding: 2px 7px; font-size: 13px; }
.secret-control { display: grid; grid-template-columns: minmax(0, 1fr) 60px; gap: 5px; margin-top: 2px; }
.secret-control input { margin-top: 0; }
.vertical-actions { display: grid; grid-template-rows: 1fr 1fr; gap: 3px; }
.vertical-actions button {
  min-width: 0;
  padding: 0 4px;
  color: #122033;
  font-size: 11px;
  background: #eff4fb;
  border: 1px solid #d4deea;
  border-radius: 4px;
}

.note-card textarea { min-height: 62px; max-height: 120px; }
#historyText { margin-top: 4px; }

.schedule-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 360px;
  padding: 12px;
}

.schedule-panel > h2 { margin-bottom: 8px; }
.schedule-workspace { display: grid; grid-template-columns: 300px 220px minmax(260px, 1fr); gap: 10px; min-height: 0; }
.calendar-card, .agenda-card {
  min-height: 0;
  padding: 8px;
  overflow: auto;
  background: #f8fafd;
  border: 1px solid #e8eef5;
  border-radius: 5px;
}
.calendar-head { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; margin-bottom: 6px; text-align: center; }
.calendar-head button { height: 28px; background: #fff; border: 1px solid #d4deea; border-radius: 4px; }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.calendar-weekdays span { padding: 3px 0; color: #64748b; font-size: 11px; text-align: center; }
.calendar-days button {
  min-height: 29px;
  padding: 0;
  color: #122033;
  font-size: 12px;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 4px;
}
.calendar-days button:hover { border-color: #afc0d4; }
.calendar-days button.outside { color: #94a3b8; background: transparent; }
.calendar-days button.today { border-color: #1f5eff; }
.calendar-days button.selected { color: #fff; background: #1f5eff; }
.calendar-days button.has-reminder::after { content: ""; display: block; width: 4px; height: 4px; margin: -3px auto 1px; background: currentColor; border-radius: 50%; }

.reminder-form { min-width: 0; }
.reminder-top { display: grid; grid-template-columns: minmax(0, 1fr) 78px; gap: 6px; margin-bottom: 6px; }
.reminder-form input, .reminder-form select { margin-top: 4px; }
.reminder-form textarea { min-height: 70px; margin-top: 6px; }
.reserve-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }

.agenda-card { padding: 10px; }
.agenda-item {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr);
  gap: 9px;
  padding: 8px;
  margin-bottom: 7px;
  background: #fff;
  border: 1px solid #d7dee8;
  border-radius: 4px;
}
.agenda-mark { background: #1f5eff; border-radius: 3px; }
.agenda-main strong { font-size: 13px; }
.agenda-main small { float: right; color: #64748b; }
.agenda-main p { margin: 3px 0 0; color: #64748b; font-size: 12px; line-height: 1.45; }

.context-menu {
  position: fixed;
  z-index: 30;
  width: 170px;
  margin: 0;
  padding: 5px;
  list-style: none;
  background: #fff;
  border: 1px solid #afc0d4;
  border-radius: 5px;
  box-shadow: 0 8px 24px rgb(15 23 42 / 18%);
}
.context-menu button { display: block; width: 100%; padding: 7px 9px; text-align: left; background: transparent; border: 0; border-radius: 3px; }
.context-menu button:hover { background: #eef4fc; }
.context-menu hr { margin: 4px 0; border: 0; border-top: 1px solid #e8eef5; }

dialog {
  width: min(390px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid #afc0d4;
  border-radius: 7px;
  box-shadow: 0 18px 50px rgb(15 23 42 / 24%);
}
dialog::backdrop { background: rgb(15 23 42 / 34%); }
dialog h2 { margin: 0 0 10px; font-size: 17px; }
dialog p { color: #64748b; font-size: 12px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.export-dialog { width: min(860px, calc(100vw - 32px)); }
.export-dialog header { display: flex; align-items: center; justify-content: space-between; }
.export-dialog textarea { width: 100%; min-height: 430px; resize: vertical; font-family: Consolas, monospace; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1500px) {
  .memo-shell { grid-template-columns: minmax(540px, 45vw) minmax(700px, 1fr); }
  .header-actions { gap: 5px; }
}

/* === 桌面版DataGrid对齐 === */
thead tr { background: #f3f7fc; }
th { color: #435166; font-weight: 600; text-align: left; padding: 0 8px; height: 34px; border-bottom: 1px solid #afc0d4; }
td { padding: 0 8px; height: 25px; border-bottom: 1px solid #e8eef5; }
tbody tr:nth-child(even) { background: #fafcff; }
tbody tr:hover { background: #f4f8ff; }
