:root { --mor-green:#5d9e52; --mor-green-soft:rgba(93,158,82,.14); --mor-danger:#d26354; }
.mor-page { align-items: stretch; text-align: left; width: 100%; }
.mor-shell { width: min(1280px, 100%); margin: 0 auto; display:grid; gap:16px; }
.mor-titlebar { display:flex; justify-content:space-between; align-items:flex-end; gap:12px; margin-bottom:18px; text-align:left; flex-wrap:wrap; }
.mor-logo-small { height:34px; width:auto; display:block; flex:0 0 auto; border-radius:0; }
.mor-sync-status { color:var(--muted); font-size:14px; text-align:right; display: flex; align-items: flex-end;}
.mor-hero { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:15px; border-top:5px solid var(--mor-green); flex-wrap:wrap; }
.mor-hero > div:first-child { min-width:0; }
.mor-hero h1 { margin:0 0 10px; color:var(--text); font-size:42px; line-height:1.05; }
.mor-hero p { max-width:680px; margin:0; color:var(--soft-text); }
.mor-kicker { color:var(--mor-green); font-weight:bold; letter-spacing:0.08em; text-transform:uppercase; font-size:13px; margin-bottom:0; }
.mor-current-month { display:flex; flex-direction:column; align-items:flex-end; justify-content:center; gap:4px; flex:0 0 auto; color:var(--text); text-align:right; }
.mor-current-month span { color:var(--muted); font-size:13px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; }
.mor-current-month strong { color:var(--mor-green); font-size:24px; line-height:1.15; }
.mor-summary-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.mor-summary-card { background:var(--input-bg); border:1px solid var(--border); border-radius:18px; padding:16px; min-width:0; }
.mor-summary-card span { color:var(--muted); display:block; font-size:13px; font-weight:800; margin-bottom:6px; }
.mor-summary-card strong { color:var(--text); display:block; font-size:28px; overflow-wrap:anywhere; }
.mor-summary-card.income strong { color:var(--mor-green); }
.mor-summary-card.expense strong { color:var(--mor-danger); }
.mor-summary-card.surplus strong.negative { color:var(--mor-danger); }
.mor-summary-card.surplus strong.positive { color:var(--mor-green); }
.mor-top-toolbar { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.mor-actions, .mor-month-controls { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.mor-button, .mor-panel button, .mor-modal button, .mor-back { border:0; background:var(--mor-green); color:#fff; border-radius:13px; padding:10px 13px; cursor:pointer; font-weight:800; text-decoration:none; }
.mor-button.secondary, .mor-panel button.secondary, .mor-modal button.secondary, .mor-back { background:transparent; color:var(--text); border:1px solid var(--border); }
.mor-button.danger, .mor-panel button.danger, .mor-modal button.danger { background:rgba(210,99,84,.12); border:1px solid rgba(210,99,84,.32); color:var(--mor-danger); }
.mor-month-label { color:var(--text); font-weight:900; min-width:160px; text-align:center; }
.mor-layout { display:grid; grid-template-columns:minmax(190px,250px) minmax(0,1fr) minmax(210px,280px); gap:15px; align-items:start; }
.mor-panel { background:var(--card-bg); border:1px solid var(--border); border-radius:22px; padding:18px; box-shadow:var(--shadow); min-width:0; }
.mor-panel h2 { margin:0 0 12px; color:var(--text); }
.mor-group-list, .mor-list { display:grid; gap:10px; }
.mor-group-card, .mor-list-row { width:100%; border:1px solid var(--border); background:var(--input-bg); color:var(--text); border-radius:16px; padding:12px; display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:left; cursor:pointer; min-width:0; }
.mor-group-card.active { border-color:var(--mor-green); box-shadow:0 0 0 3px var(--mor-green-soft); }
.mor-group-card strong, .mor-list-row strong { display:block; overflow-wrap:anywhere; }
.mor-group-card span, .mor-list-row span { color:var(--muted); font-size:13px; overflow-wrap:anywhere; }
.mor-workspace-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:14px; }
.mor-workspace-head h2 { overflow-wrap:anywhere; }
.mor-workspace-head p { color:var(--muted); margin:-6px 0 0; }
.mor-search { width:100%; min-height:42px; border:1px solid var(--border); border-radius:13px; padding:10px 12px; background:var(--input-bg); color:var(--text); margin-bottom:0; }
.mor-item-list { display:grid; gap:12px; }
.mor-item-card { border:1px solid var(--border); background:var(--input-bg); border-radius:18px; padding:14px; min-width:0; }
.mor-item-main { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.mor-item-copy { min-width:0; }
.mor-item-copy h3 { color:var(--text); margin:0 0 5px; overflow-wrap:anywhere; }
.mor-item-copy p { color:var(--muted); margin:0; overflow-wrap:anywhere; }
.mor-item-amount { font-size:22px; font-weight:900; color:var(--text); white-space:nowrap; }
.mor-item-card.income .mor-item-amount { color:var(--mor-green); }
.mor-item-card.expenses .mor-item-amount { color:var(--mor-danger); }
.mor-item-actions { display:flex; gap:8px; justify-content:flex-end; margin-top:12px; flex-wrap:wrap; }
.mor-empty { border:1px dashed var(--border); color:var(--muted); border-radius:16px; padding:18px; text-align:center; }
.mor-tool-button { background:var(--input-bg) !important; border:1px solid var(--border) !important; border-radius:16px !important; color:var(--text) !important; cursor:pointer; font-weight:800; padding:12px; text-align:left; width:100%; }
.mor-tool-button:hover { border-color:var(--mor-green) !important; box-shadow:0 0 0 3px var(--mor-green-soft); }
.mor-tools { display:grid; gap:10px; }
.mor-mini-list { display:grid; gap:8px; margin-top:8px; }
.mor-mini-row { border:1px solid var(--border); border-radius:14px; padding:10px; color:var(--text); background:var(--input-bg); display:flex; justify-content:space-between; gap:10px; }
.mor-modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.45); display:grid; place-items:center; padding:18px; z-index:999; }
.mor-modal { background:var(--card-bg); color:var(--text); border:1px solid var(--border); border-radius:22px; padding:20px; width:min(540px,100%); box-shadow:0 24px 70px rgba(0,0,0,.3); max-height:90vh; overflow:auto; }
.mor-modal-wide { width:min(880px,100%); }
.mor-modal-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.mor-modal h2 { margin:0; }
.mor-modal label { display:block; font-weight:800; margin:12px 0 6px; color:var(--text); }
.mor-modal input, .mor-modal select { width:100%; min-height:42px; border:1px solid var(--border); border-radius:12px; padding:9px 11px; background:var(--input-bg); color:var(--text); }
.mor-modal-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:16px; flex-wrap:wrap; }
.mor-table { width:100%; border-collapse:separate; border-spacing:0 8px; }
.mor-table th { color:var(--muted); font-size:12px; text-align:left; padding:0 8px; }
.mor-table td { background:var(--input-bg); color:var(--text); border-top:1px solid var(--border); border-bottom:1px solid var(--border); padding:10px 8px; }
.mor-table td:first-child { border-left:1px solid var(--border); border-radius:12px 0 0 12px; }
.mor-table td:last-child { border-right:1px solid var(--border); border-radius:0 12px 12px 0; text-align:right; font-weight:900; }
@media (max-width: 980px) { .mor-layout { grid-template-columns:1fr; } .mor-summary-grid { grid-template-columns:1fr; } .mor-workspace-head { flex-direction:column; } }
@media (max-width: 520px) { .mor-titlebar, .mor-top-toolbar, .mor-actions, .mor-month-controls { align-items:stretch; flex-direction:column; } .mor-month-label { min-width:0; } .mor-item-main { flex-direction:column; } .mor-item-amount { white-space:normal; } }

/* Mor three-column Sor/Dor-style refinement */
.mor-layout {
  grid-template-columns: minmax(220px, 270px) minmax(0, 1fr) minmax(230px, 290px);
}
.mor-sidebar,
.mor-workspace {
  min-width: 0;
}
.mor-sidebar-left,
.mor-sidebar-right,
.mor-workspace {
  padding: 18px;
}
.mor-sidebar-left {
  background: var(--mor-green);
  border-color: rgba(255,255,255,.16);
}
.mor-sidebar-left h2,
.mor-sidebar-left .mor-month-label,
.mor-sidebar-left .mor-group-card,
.mor-sidebar-left .mor-group-card strong,
.mor-sidebar-left .mor-group-card span,
.mor-sidebar-left .mor-group-card span span {
  color: #fff;
}
.mor-side-section {
  display: grid;
  gap: 10px;
}
.mor-side-section h2,
.mor-tools-panel h2,
.mor-snapshot-title {
  margin: 0 0 2px;
}
.mor-month-picker {
  align-items: center;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
}
.mor-sidebar-left .mor-button.secondary,
.mor-sidebar-left .mor-view-toggle button {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.34);
  color: #fff;
}
.mor-sidebar-left .mor-button.secondary:hover,
.mor-sidebar-left .mor-view-toggle button:hover,
.mor-sidebar-left .mor-view-toggle button.active {
  background: #fff;
  color: var(--mor-green);
}
.mor-full-button {
  width: 100%;
}
.mor-view-toggle {
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}
.mor-view-toggle button {
  border: 0;
  border-radius: 0;
  cursor: pointer;
  font-weight: 900;
  padding: 10px;
}
.mor-divider {
  border-top: 1px solid rgba(255,255,255,.32);
  margin: 18px 0;
}
.mor-tools-panel .mor-divider {
  border-top-color: var(--border);
}
.mor-sidebar-left .mor-group-card {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.28);
}
.mor-sidebar-left .mor-group-card.active {
  background: rgba(255,255,255,.22);
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,.16);
}
.mor-danger-zone {
  display: grid;
  gap: 10px;
}
.mor-clear-button,
.mor-delete-all-button {
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 14px;
  cursor: pointer;
  font-weight: 900;
  padding: 11px 12px;
  text-align: left;
}
.mor-clear-button {
  background: rgba(255,255,255,.14);
  color: #fff;
}
.mor-delete-all-button {
  background: rgba(255,255,255,.92);
  border-color: rgba(255,255,255,.92);
  color: var(--mor-danger);
}
.mor-sort-row {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-bottom: 13px;
  min-width: 0;
}
.mor-workspace-head {
  margin-bottom: 12px;
}
.mor-tools-panel .mor-tool-button {
  background: var(--input-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 16px !important;
  color: var(--text) !important;
  cursor: pointer;
  font-weight: 900;
  padding: 12px;
  text-align: left;
  width: 100%;
}
.mor-mini-row span {
  min-width: 0;
}
.mor-mini-row span strong {
  display: block;
  margin-bottom: 4px;
}
.mor-mini-row small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.35;
}
.mor-mini-row > strong.positive { color: var(--mor-green); }
.mor-mini-row > strong.negative { color: var(--mor-danger); }
@media (max-width: 980px) {
  .mor-layout { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .mor-month-picker { grid-template-columns: auto minmax(0,1fr) auto; }
}


/* Mor left column correction: match Sor/Dor white card style */
.mor-sidebar-left {
  background: var(--card-bg) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.mor-sidebar-left h2,
.mor-sidebar-left .mor-month-label,
.mor-sidebar-left .mor-group-card,
.mor-sidebar-left .mor-group-card strong,
.mor-sidebar-left .mor-group-card span,
.mor-sidebar-left .mor-group-card span span {
  color: var(--text) !important;
}
.mor-sidebar-left .mor-group-card span,
.mor-sidebar-left .mor-group-card span span {
  color: var(--muted) !important;
}
.mor-sidebar-left .mor-button.secondary,
.mor-sidebar-left .mor-view-toggle button {
  background: var(--input-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.mor-sidebar-left .mor-button.secondary:hover,
.mor-sidebar-left .mor-view-toggle button:hover,
.mor-sidebar-left .mor-view-toggle button.active {
  background: var(--mor-green) !important;
  border-color: var(--mor-green) !important;
  color: #fff !important;
}
.mor-view-toggle {
  border-color: var(--border) !important;
}
.mor-divider {
  border-top-color: var(--border) !important;
}
.mor-sidebar-left .mor-group-card {
  background: var(--input-bg) !important;
  border-color: var(--border) !important;
}
.mor-sidebar-left .mor-group-card.active {
  background: var(--mor-green-soft) !important;
  border-color: var(--mor-green) !important;
  box-shadow: 0 0 0 3px var(--mor-green-soft) !important;
}
.mor-sidebar-left .mor-group-card.active strong:first-child {
  color: var(--mor-green) !important;
}
.mor-danger-zone {
  border-top: 0 !important;
  padding-top: 0 !important;
  margin-top: 0 !important;
}
.mor-clear-button,
.mor-delete-all-button {
  background: var(--mor-green) !important;
  border: 1px solid var(--mor-green) !important;
  color: #fff !important;
  text-align: left;
}
.mor-clear-button:hover,
.mor-clear-button:focus-visible,
.mor-delete-all-button:hover,
.mor-delete-all-button:focus-visible {
  filter: brightness(.96);
  outline: none;
}

/* Restore Sor/Dor-style item card action buttons */
.mor-item-actions .button.secondary,
.mor-item-actions button.button.secondary {
  background: transparent !important;
  border: 1px solid var(--border) !important;
  border-radius: 13px !important;
  color: var(--text) !important;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 13px;
}
.mor-item-actions .button.secondary:hover,
.mor-item-actions .button.secondary:focus-visible,
.mor-item-actions button.button.secondary:hover,
.mor-item-actions button.button.secondary:focus-visible {
  border-color: var(--mor-green) !important;
  background: var(--mor-green-soft) !important;
  outline: none !important;
}
.button.secondary.mor-item-delete-button,
button.button.secondary.mor-item-delete-button,
.mor-item-actions .button.secondary.mor-item-delete-button,
.mor-item-actions button.button.secondary.mor-item-delete-button {
  color: #b91c1c !important;
  border-color: var(--border) !important;
  background: transparent !important;
}
.button.secondary.mor-item-delete-button:hover,
.button.secondary.mor-item-delete-button:focus-visible,
button.button.secondary.mor-item-delete-button:hover,
button.button.secondary.mor-item-delete-button:focus-visible,
.mor-item-actions .button.secondary.mor-item-delete-button:hover,
.mor-item-actions .button.secondary.mor-item-delete-button:focus-visible,
.mor-item-actions button.button.secondary.mor-item-delete-button:hover,
.mor-item-actions button.button.secondary.mor-item-delete-button:focus-visible {
  color: #b91c1c !important;
  border-color: rgba(185, 28, 28, 0.35) !important;
  background: rgba(185, 28, 28, 0.06) !important;
  outline: none !important;
}
body.dark .button.secondary.mor-item-delete-button,
body.dark button.button.secondary.mor-item-delete-button,
body.dark .mor-item-actions .button.secondary.mor-item-delete-button,
body.dark .mor-item-actions button.button.secondary.mor-item-delete-button {
  color: #fca5a5 !important;
}


/* Final Mor card/action styling updates: match Sor/Dor card layout */
.mor-item-card {
  background: #f8fafc !important;
}
body.dark .mor-item-card {
  background: rgba(255,255,255,0.045) !important;
}
.mor-item-card-content {
  min-width: 0;
  display: grid;
  gap: 12px;
}
.mor-item-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}
.mor-item-card-top-row {
  align-items: flex-start;
}
.mor-item-card-bottom-row {
  align-items: flex-end;
}
.mor-item-main {
  display: block !important;
}
.mor-item-actions {
  display: inline-flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  margin-top: 0 !important;
  flex-wrap: nowrap;
}
.mor-item-actions .button,
.mor-item-edit-button,
.mor-item-delete-button {
  min-height: 36px !important;
  height: auto !important;
  min-width: 72px !important;
  padding: 7px 12px !important;
  font-size: 13px !important;
  font-weight: bold !important;
  border-radius: 12px !important;
}
.mor-item-amount {
  font-size: 24px !important;
  line-height: 1.1;
  text-align: right;
}
.mor-clear-button,
.mor-delete-all-button {
  width: 100%;
  min-height: 42px;
  border-radius: 12px !important;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center !important;
  padding: 10px 12px !important;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.mor-clear-button {
  background: rgba(194, 65, 12, 0.07) !important;
  border: 1px solid rgba(194, 65, 12, 0.28) !important;
  color: #c2410c !important;
}
.mor-clear-button:hover,
.mor-clear-button:focus-visible {
  background: rgba(194, 65, 12, 0.12) !important;
  border-color: rgba(194, 65, 12, 0.42) !important;
  outline: none;
  transform: translateY(-1px);
}
.mor-delete-all-button {
  background: rgba(185, 28, 28, 0.07) !important;
  border: 1px solid rgba(185, 28, 28, 0.28) !important;
  color: #b91c1c !important;
}
.mor-delete-all-button:hover,
.mor-delete-all-button:focus-visible {
  background: rgba(185, 28, 28, 0.12) !important;
  border-color: rgba(185, 28, 28, 0.42) !important;
  outline: none;
  transform: translateY(-1px);
}
body.dark .mor-clear-button {
  background: rgba(251, 146, 60, 0.10) !important;
  border-color: rgba(251, 146, 60, 0.32) !important;
  color: #fdba74 !important;
}
body.dark .mor-delete-all-button {
  background: rgba(248, 113, 113, 0.10) !important;
  border-color: rgba(248, 113, 113, 0.32) !important;
  color: #fca5a5 !important;
}
@media (max-width: 520px) {
  .mor-item-card-row { align-items: stretch; flex-direction: column; }
  .mor-item-actions { justify-content: flex-start; flex-wrap: wrap; }
  .mor-item-amount { text-align: left; }
}


/* Mor spacing/header alignment update */
.mor-summary-grid {
  margin-bottom: 20px;
}
.mor-workspace-head {
  align-items: center !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}
.mor-workspace-title-row {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: space-between;
  width: 100%;
}
.mor-workspace-title-row h2 {
  margin: 0 !important;
  line-height: 1.15;
}
.mor-workspace-context {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 !important;
  text-align: right;
}
@media (max-width: 620px) {
  .mor-workspace-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .mor-workspace-context {
    text-align: left;
  }
}


/* Keep Mor search and sort controls on one line, even at narrower widths */
.mor-sort-row .mor-search {
  flex: 1 1 auto;
  min-width: 0;
}
.mor-sort-row .mor-button {
  flex: 0 0 auto;
  white-space: nowrap;
}


/* Mor popup/header button update */
.mor-modal {
  background: #ffffff !important;
  color: #111827 !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
}
.mor-modal h2,
.mor-modal label,
.mor-modal .mor-list-row strong,
.mor-modal .mor-table td {
  color: #111827 !important;
}
.mor-modal input,
.mor-modal select,
.mor-modal .mor-list-row,
.mor-modal .mor-table td,
.mor-modal .mor-empty {
  background: #ffffff !important;
  color: #111827 !important;
  border-color: rgba(15, 23, 42, 0.14) !important;
}
.mor-modal .mor-table th,
.mor-modal .mor-list-row span,
.mor-modal .mor-empty {
  color: #64748b !important;
}
.mor-modal .secondary {
  background: #ffffff !important;
  color: #111827 !important;
  border: 1px solid rgba(15, 23, 42, 0.16) !important;
}
.mor-workspace-title-row {
  align-items: center !important;
  display: grid !important;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr) auto;
  gap: 12px;
}
.mor-workspace-title-row h2 {
  justify-self: start;
}
.mor-workspace-context {
  justify-self: center;
  text-align: center !important;
}
.mor-add-header-button {
  justify-self: end;
  white-space: nowrap;
  background: var(--mor-green) !important;
  border: 1px solid var(--mor-green) !important;
  color: #fff !important;
}
@media (max-width: 700px) {
  .mor-workspace-title-row {
    grid-template-columns: 1fr;
    align-items: stretch !important;
  }
  .mor-workspace-context,
  .mor-add-header-button,
  .mor-workspace-title-row h2 {
    justify-self: stretch;
    text-align: left !important;
  }
}

/* Mor Tools popups: match Sor/Dor tool modal feel */
.mor-tools-panel .mor-modal-buttons {
  display: grid;
  gap: 10px;
}
.mor-tools-panel .mor-tool-button {
  background: rgba(93, 158, 82, 0.14) !important;
  border: 1px solid rgba(93, 158, 82, 0.28) !important;
  color: var(--text) !important;
  text-align: center !important;
  font-weight: 900 !important;
  border-radius: 16px !important;
  min-height: 48px;
}
.mor-tools-panel .mor-tool-button:hover,
.mor-tools-panel .mor-tool-button:focus-visible {
  background: rgba(93, 158, 82, 0.22) !important;
  border-color: var(--mor-green) !important;
  box-shadow: 0 0 0 3px var(--mor-green-soft);
}
.mor-tool-modal-backdrop {
  align-items: flex-start;
  padding-top: 6vh;
}
.mor-tool-modal {
  width: min(900px, calc(100vw - 32px));
  padding: 0 !important;
  overflow: hidden;
  background: #fff !important;
}
.mor-tool-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(93, 158, 82, 0.12);
}
.mor-tool-modal-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
}
.mor-tool-modal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mor-tool-modal-head button,
.mor-modal-back-button {
  border: 0;
  border-radius: 12px;
  min-height: 38px;
  padding: 8px 12px;
  font-weight: 900;
  cursor: pointer;
  background: var(--mor-green);
  color: #fff;
}
.mor-tool-modal-head button[data-action="close-modal"] {
  width: 38px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}
.mor-tool-modal-body {
  padding: 18px 20px 20px;
  max-height: min(72vh, 760px);
  overflow: auto;
  background: #fff;
}
.mor-tool-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  padding: 5px;
  border-radius: 16px;
}
.mor-tool-toggle button {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-weight: 900;
  min-height: 40px;
}
.mor-tool-toggle button.active {
  background: var(--mor-green);
  color: #fff;
}
.mor-tool-list,
.mor-history-months {
  display: grid;
  gap: 9px;
}
.mor-tool-modal-row {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input-bg);
  border-radius: 16px;
  padding: 14px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: var(--text);
  text-align: left;
}
.mor-tool-modal-row:hover,
.mor-tool-modal-row:focus-visible {
  border-color: var(--mor-green);
  box-shadow: 0 0 0 3px var(--mor-green-soft);
}
.mor-tool-modal-row h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
}
.mor-tool-modal-row p,
.mor-tool-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.mor-chevron {
  font-size: 25px;
  font-weight: 900;
  color: var(--mor-green);
}
.mor-summary-detail-block {
  border: 1px solid var(--border);
  background: var(--input-bg);
  border-radius: 16px;
  padding: 15px;
  margin-bottom: 12px;
}
.mor-summary-detail-block.surplus {
  background: rgba(93, 158, 82, 0.10);
}
.mor-summary-detail-head,
.mor-detail-lines > div,
.mor-history-occurrences > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.mor-summary-detail-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
}
.mor-detail-lines {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}
.mor-detail-lines > div,
.mor-history-occurrences > div {
  border-top: 1px solid var(--border);
  padding-top: 9px;
}
.mor-timeline-table {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}
.mor-timeline-head,
.mor-timeline-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 120px;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  border-radius: 14px;
}
.mor-timeline-head {
  background: rgba(15, 23, 42, 0.06);
  font-weight: 900;
}
.mor-timeline-row {
  border: 1px solid var(--border);
  background: var(--input-bg);
}
.mor-timeline-head span:last-child,
.mor-timeline-row strong:last-child {
  text-align: right;
}
.mor-tool-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.mor-tool-toolbar input {
  flex: 1 1 auto;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 9px 12px;
  background: var(--input-bg);
  color: var(--text);
}
.mor-tool-toolbar button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 9px 12px;
  font-weight: 900;
}
.mor-history-month {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--input-bg);
  overflow: hidden;
}
.mor-history-month-head {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 14px 15px;
  cursor: pointer;
}
.mor-history-month-head strong {
  font-weight: 900;
}
.mor-history-occurrences {
  display: grid;
  gap: 9px;
  padding: 0 15px 14px 53px;
}
.positive { color: var(--mor-green); }
.negative { color: var(--mor-danger); }
body.dark .mor-tool-modal,
body.dark .mor-tool-modal-body {
  background: #101826 !important;
}
body.dark .mor-tool-modal-head {
  background: rgba(93, 158, 82, 0.18);
}
@media (max-width: 640px) {
  .mor-tool-modal-backdrop { padding: 12px; align-items: start; }
  .mor-tool-modal { width: calc(100vw - 24px); }
  .mor-tool-modal-head { align-items: flex-start; }
  .mor-timeline-head,
  .mor-timeline-row { grid-template-columns: 86px minmax(0, 1fr) 92px; font-size: 13px; }
  .mor-tool-toolbar { flex-direction: column; }
}

/* Mor Tools card readability refinement: match Sor/Dor light-gray content cards */
.mor-tool-modal-row,
.mor-summary-detail-block,
.mor-timeline-row,
.mor-history-month {
  background: #f3f4f6 !important;
  border: 1px solid #e5e7eb !important;
  color: var(--text) !important;
}

.mor-tool-modal-row h3,
.mor-tool-modal-row p,
.mor-summary-detail-block h3,
.mor-summary-detail-block span,
.mor-summary-detail-block strong,
.mor-timeline-row span,
.mor-timeline-row strong,
.mor-history-month strong,
.mor-history-month span,
.mor-history-occurrences div {
  color: var(--text);
}

.mor-tool-modal-row p,
.mor-tool-help {
  color: var(--muted) !important;
}

.mor-tool-modal-row:hover,
.mor-tool-modal-row:focus-visible,
.mor-history-month:hover {
  background: #eef7ec !important;
  border-color: rgba(93, 158, 82, 0.34) !important;
  box-shadow: 0 0 0 3px rgba(93, 158, 82, 0.10);
}

.mor-summary-detail-block.surplus {
  background: #f3f4f6 !important;
}

.mor-timeline-head {
  background: #e5e7eb !important;
  color: var(--text) !important;
}

.mor-history-month-head {
  background: transparent !important;
}

body.dark .mor-tool-modal-row,
body.dark .mor-summary-detail-block,
body.dark .mor-summary-detail-block.surplus,
body.dark .mor-timeline-row,
body.dark .mor-history-month {
  background: #1f2937 !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
}

body.dark .mor-tool-modal-row:hover,
body.dark .mor-tool-modal-row:focus-visible,
body.dark .mor-history-month:hover {
  background: rgba(93, 158, 82, 0.16) !important;
  border-color: rgba(93, 158, 82, 0.44) !important;
}

body.dark .mor-timeline-head {
  background: #111827 !important;
}


/* Mor card metadata and section heading refinements */
.mor-item-meta {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}
.mor-item-meta span {
  display: block;
}
.mor-side-section h2,
.mor-tools-panel > h2,
.mor-snapshot-title {
  text-align: center !important;
}


/* Final polish: keep item amount beside occurrence details and add Mor Tools header spacing */
.mor-item-meta-amount-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  width: 100%;
}
.mor-item-meta-amount-row .mor-item-meta {
  flex: 1 1 auto;
  min-width: 0;
}
.mor-item-meta-amount-row .mor-item-amount {
  flex: 0 0 auto;
  margin-top: 0;
  align-self: flex-start;
}
.mor-tools-panel .mor-modal-buttons {
  margin-top: 12px;
}
@media (max-width: 520px) {
  .mor-item-meta-amount-row {
    align-items: flex-start;
    flex-direction: row;
  }
  .mor-item-meta-amount-row .mor-item-amount {
    text-align: right;
  }
}


/* Patch: right-align Mor item amounts with consistent card padding */
.mor-item-meta-amount-row {
  align-items: center !important;
  gap: 16px !important;
  padding-right: 12px !important;
  box-sizing: border-box !important;
}
.mor-item-meta-amount-row .mor-item-meta {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}
.mor-item-meta-amount-row .mor-item-amount {
  flex: 0 0 auto !important;
  min-width: 96px !important;
  max-width: 42% !important;
  padding-right: 0 !important;
  text-align: right !important;
  align-self: center !important;
  overflow-wrap: anywhere !important;
  line-height: 1.15 !important;
}
@media (max-width: 520px) {
  .mor-item-meta-amount-row {
    align-items: center !important;
    flex-direction: row !important;
    padding-right: 8px !important;
  }
  .mor-item-meta-amount-row .mor-item-amount {
    min-width: 84px !important;
    max-width: 44% !important;
  }
}

/* Patch: make the item amount use the full card width, not the title/actions row */
.mor-item-card-content > .mor-item-meta-amount-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 16px !important;
  width: 100% !important;
  min-width: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}
.mor-item-card-content > .mor-item-meta-amount-row .mor-item-meta {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}
.mor-item-card-content > .mor-item-meta-amount-row .mor-item-amount {
  flex: 0 0 auto !important;
  min-width: max-content !important;
  max-width: none !important;
  margin-left: auto !important;
  padding-right: 0 !important;
  text-align: right !important;
  align-self: center !important;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
}
@media (max-width: 520px) {
  .mor-item-card-content > .mor-item-meta-amount-row {
    flex-direction: row !important;
    align-items: center !important;
  }
  .mor-item-card-content > .mor-item-meta-amount-row .mor-item-amount {
    white-space: nowrap !important;
    min-width: max-content !important;
  }
}

/* Final fix: pin item-card dollar amounts to the card's right content edge */
.mor-item-card-content > .mor-item-meta-amount-row {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  min-height: 54px !important;
  padding-right: 150px !important;
  box-sizing: border-box !important;
}
.mor-item-card-content > .mor-item-meta-amount-row .mor-item-meta {
  display: grid !important;
  gap: 3px !important;
  min-width: 0 !important;
  width: 100% !important;
}
.mor-item-card-content > .mor-item-meta-amount-row .mor-item-amount {
  position: absolute !important;
  right: 0 !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 140px !important;
  max-width: 140px !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: right !important;
  white-space: nowrap !important;
  overflow-wrap: normal !important;
}
@media (max-width: 520px) {
  .mor-item-card-content > .mor-item-meta-amount-row {
    min-height: 54px !important;
    padding-right: 118px !important;
  }
  .mor-item-card-content > .mor-item-meta-amount-row .mor-item-amount {
    width: 108px !important;
    max-width: 108px !important;
  }
}


/* Patch: first amount sort is high-to-low and make the top month/year much larger */
.mor-current-month strong {
  font-size: 72px !important;
  line-height: 0.95 !important;
  letter-spacing: -0.04em;
}
@media (max-width: 720px) {
  .mor-current-month strong {
    font-size: 54px !important;
  }
}
@media (max-width: 520px) {
  .mor-current-month {
    align-items: flex-start !important;
    text-align: left !important;
  }
  .mor-current-month strong {
    font-size: 44px !important;
  }
}

/* Patch: tighten spacing between the Mor logo/sync status row and Money Plan card */
.mor-shell {
  gap: 0 !important;
}
.mor-titlebar {
  margin-bottom: 18px !important;
  align-items: flex-end !important;
}
.mor-titlebar > div:first-child {
  display: flex !important;
  align-items: flex-end !important;
  gap: 0px !important;
}
.mor-sync-status {
  align-self: flex-end !important;
  display: block !important;
  line-height: 1.1 !important;
  margin-bottom: 0 !important;
}
[data-mor-app] {
  margin-top: 0 !important;
}
.mor-hero {
  margin-top: 0 !important;
}
@media (max-width: 520px) {
  .mor-titlebar {
    margin-bottom: 18px !important;
    align-items: stretch !important;
  }
  .mor-titlebar > div:first-child {
    align-items: flex-end !important;
  }
}

.mor-projection-month {
  font-style: italic;
}
