:root {
  --bg: #f6efe4;
  --panel: rgba(255, 251, 245, 0.82);
  --panel-strong: #fffaf2;
  --text: #1d1a17;
  --muted: #6e6256;
  --accent: #d96c3d;
  --accent-dark: #9f3f1b;
  --chart-one: #d96c3d;
  --chart-two: #567bc7;
  --line: rgba(29, 26, 23, 0.08);
  --shadow: 0 24px 70px rgba(93, 56, 28, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans KR", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(242, 164, 98, 0.28), transparent 28%),
    radial-gradient(circle at bottom right, rgba(217, 108, 61, 0.18), transparent 24%),
    linear-gradient(135deg, #f7f2e9 0%, #efe3d2 100%);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

.background-orb {
  position: fixed;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.65;
  z-index: 0;
}

.orb-left {
  top: -8rem;
  left: -6rem;
  background: rgba(255, 203, 154, 0.7);
}

.orb-right {
  right: -8rem;
  bottom: -8rem;
  background: rgba(218, 137, 92, 0.5);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.session-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 18px;
  padding: 11px 16px;
  border: 1px solid rgba(29, 26, 23, 0.1);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.9);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(93, 56, 28, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(93, 56, 28, 0.12);
}

.session-bar + .back-link {
  display: none;
}

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

.sync-status,
.storage-mode,
.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.82);
  color: var(--muted);
  border: 1px solid rgba(29, 26, 23, 0.08);
}

.storage-mode {
  font-weight: 700;
  color: var(--text);
}

.sync-status.is-error {
  color: var(--accent-dark);
  border-color: rgba(217, 108, 61, 0.25);
  background: rgba(217, 108, 61, 0.12);
}

.auth-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}

#logoutButton[hidden] {
  display: none;
}

.top-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.toolbar-button,
.save-button {
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #1d1a17 0%, #4a4038 100%);
  color: #fff8f1;
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(29, 26, 23, 0.16);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.save-button:hover {
  transform: translateY(-2px);
}

.toolbar-button {
  background: rgba(255, 250, 242, 0.9);
  color: var(--text);
  border: 1px solid rgba(29, 26, 23, 0.08);
}

.danger-button {
  background: rgba(217, 108, 61, 0.14);
  color: var(--accent-dark);
  border: 1px solid rgba(217, 108, 61, 0.25);
}

.secondary-button {
  box-shadow: 0 12px 24px rgba(93, 56, 28, 0.08);
}

.save-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.hero,
.composer,
.summary-card {
  backdrop-filter: blur(12px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
}

.hero {
  padding: 36px;
  border-radius: 32px;
  animation: rise 0.7s ease;
}

.eyebrow,
.section-label,
.card-label,
.memo-title {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.77rem;
  color: var(--muted);
}

.hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hero h1,
.summary-card h2,
.composer h2 {
  margin: 12px 0 0;
  font-family: "Space Grotesk", sans-serif;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
}

.hero-copy,
.summary-copy,
.stock-memo {
  color: var(--muted);
  line-height: 1.65;
}

.hero-copy {
  max-width: 560px;
  margin: 20px 0 0;
  font-size: 1rem;
}

.add-trigger,
.primary-button,
.close-button,
.delete-button,
.edit-button,
.ghost-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.add-trigger {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--accent) 0%, #f29e61 100%);
  color: white;
  font-size: 3rem;
  box-shadow: 0 20px 40px rgba(217, 108, 61, 0.28);
}

.add-trigger:hover,
.primary-button:hover,
.close-button:hover,
.delete-button:hover,
.edit-button:hover,
.ghost-button:hover {
  transform: translateY(-2px);
}

.composer {
  margin-top: 22px;
  padding: 28px;
  border-radius: 28px;
  display: none;
  animation: rise 0.35s ease;
}

.composer.is-open {
  display: block;
}

.composer-header,
.summary-card,
.card-top,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stock-form {
  margin-top: 24px;
  display: grid;
  gap: 18px;
}

.type-selector {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.type-selector legend {
  margin-bottom: 10px;
  font-size: 0.94rem;
  font-weight: 600;
}

.type-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.type-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.type-option span {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.type-option input:checked + span {
  background: rgba(217, 108, 61, 0.14);
  border-color: rgba(217, 108, 61, 0.45);
  color: var(--accent-dark);
}

.stock-form label {
  display: grid;
  gap: 8px;
}

.stock-form span {
  font-size: 0.94rem;
  font-weight: 600;
}

.stock-form input,
.stock-form textarea {
  width: 100%;
  padding: 15px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
}

.stock-form input:focus,
.stock-form textarea:focus {
  outline: 2px solid rgba(217, 108, 61, 0.3);
  border-color: rgba(217, 108, 61, 0.5);
}

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

.primary-button,
.close-button,
.edit-button,
.delete-button,
.ghost-button {
  padding: 12px 18px;
  border-radius: 999px;
}

.primary-button {
  background: var(--text);
  color: #fff8f1;
}

.close-button {
  background: rgba(29, 26, 23, 0.08);
  color: var(--text);
}

.summary-card {
  margin-top: 22px;
  padding: 22px 28px;
  border-radius: 26px;
}

.summary-details {
  min-width: 0;
  text-align: right;
}

.summary-total {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.summary-total strong {
  display: inline-block;
  margin-left: 10px;
  color: var(--accent-dark);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.summary-card h2 span {
  color: var(--accent-dark);
}

.cards-section {
  margin-top: 24px;
}

.chart-section {
  margin-top: 28px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.chart-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  padding: 26px 28px;
  border-radius: 28px;
  backdrop-filter: blur(12px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
}

.chart-card h3 {
  margin: 8px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.8rem;
}

.chart-copy {
  min-width: 0;
}

.chart-visuals {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.donut-chart {
  display: grid;
  place-items: center;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: conic-gradient(var(--chart-one) 0deg 180deg, var(--chart-two) 180deg 360deg);
  box-shadow: inset 0 0 0 1px rgba(29, 26, 23, 0.05), 0 20px 44px rgba(93, 56, 28, 0.12);
}

.donut-hole {
  display: grid;
  place-items: center;
  width: 156px;
  height: 156px;
  border-radius: 50%;
  background: #fffaf3;
  box-shadow: inset 0 0 0 1px rgba(29, 26, 23, 0.06);
  text-align: center;
  padding: 18px;
}

.donut-hole span {
  font-size: 0.88rem;
  color: var(--muted);
}

.donut-hole strong {
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.3rem;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chart-legend {
  width: 100%;
  display: grid;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid rgba(29, 26, 23, 0.08);
}

.legend-item > div {
  min-width: 0;
  flex: 1 1 auto;
}

.legend-item strong {
  display: block;
  font-size: 1rem;
}

.legend-item p {
  margin: 6px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.legend-one {
  background: var(--chart-one);
}

.legend-two {
  background: var(--chart-two);
}

.category-filter {
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: 24px;
  background: rgba(255, 250, 242, 0.78);
  border: 1px solid rgba(29, 26, 23, 0.08);
  box-shadow: 0 12px 26px rgba(93, 56, 28, 0.06);
}

.category-filter .type-selector {
  margin-top: 12px;
}

.category-section + .category-section {
  margin-top: 28px;
}

.category-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.category-heading > div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.category-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.category-heading h3 {
  margin: 8px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.15rem;
}

.category-count-inline {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--muted);
}

.category-total-box {
  min-width: 180px;
  max-width: 100%;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid rgba(29, 26, 23, 0.08);
  box-shadow: 0 12px 26px rgba(93, 56, 28, 0.07);
}

.category-total-box span {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
}

.category-total-box strong {
  display: block;
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.3rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.category-total-box small {
  display: block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

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

.stock-card {
  background: var(--panel-strong);
  border: 1px solid rgba(29, 26, 23, 0.07);
  border-radius: 26px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(93, 56, 28, 0.08);
  animation: rise 0.4s ease;
}

.stock-title {
  margin: 10px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.6rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.type-badge {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.type-badge.type-long {
  background: rgba(89, 127, 84, 0.14);
  color: #466942;
}

.type-badge.type-short {
  background: rgba(217, 108, 61, 0.14);
  color: var(--accent-dark);
}

.theme-badge {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.theme-badge.theme-growth {
  background: rgba(86, 123, 199, 0.14);
  color: #365796;
}

.theme-badge.theme-dividend {
  background: rgba(165, 132, 66, 0.18);
  color: #8b6827;
}

.market-badge {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.market-badge.market-kr {
  background: rgba(73, 136, 110, 0.16);
  color: #2f6f56;
}

.market-badge.market-us {
  background: rgba(208, 84, 84, 0.15);
  color: #9d3535;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.edit-button,
.ghost-button {
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.98) 0%, rgba(242, 235, 226, 0.95) 100%);
  color: var(--text);
  border: 1px solid rgba(29, 26, 23, 0.08);
  box-shadow: 0 10px 18px rgba(93, 56, 28, 0.08);
}

.delete-button {
  background: linear-gradient(180deg, rgba(255, 237, 232, 0.98) 0%, rgba(251, 218, 206, 0.95) 100%);
  color: var(--accent-dark);
  border: 1px solid rgba(217, 108, 61, 0.18);
  box-shadow: 0 10px 18px rgba(217, 108, 61, 0.12);
}

.edit-button,
.delete-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.edit-button::before,
.delete-button::before,
.ghost-button::before {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.95em;
}

.edit-button::before {
  content: "✎";
}

.delete-button::before {
  content: "−";
  font-weight: 700;
}

.ghost-button::before {
  content: "↺";
}

.edit-button:hover,
.ghost-button:hover {
  background: linear-gradient(180deg, rgba(255, 252, 247, 1) 0%, rgba(246, 239, 230, 1) 100%);
  box-shadow: 0 14px 24px rgba(93, 56, 28, 0.12);
}

.delete-button:hover {
  background: linear-gradient(180deg, rgba(255, 242, 238, 1) 0%, rgba(250, 224, 214, 1) 100%);
  box-shadow: 0 14px 24px rgba(217, 108, 61, 0.18);
}

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

.metric-box {
  padding: 14px;
  border-radius: 18px;
  background: #fff4e8;
}

.metric-box span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.metric-box strong {
  display: block;
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.amounts-hidden #overallTotalAmount,
body.amounts-hidden #categoryOneSummaryAmount,
body.amounts-hidden #categoryTwoSummaryAmount,
body.amounts-hidden #categoryOneTotalAmount,
body.amounts-hidden #categoryTwoTotalAmount,
body.amounts-hidden .stock-shares,
body.amounts-hidden .stock-price,
body.amounts-hidden .stock-invested {
  color: transparent;
  background: linear-gradient(90deg, rgba(29, 26, 23, 0.08), rgba(29, 26, 23, 0.16), rgba(29, 26, 23, 0.08));
  border-radius: 999px;
  user-select: none;
}

body.amounts-hidden #overallTotalAmount,
body.amounts-hidden #categoryOneTotalAmount,
body.amounts-hidden #categoryTwoTotalAmount,
body.amounts-hidden .stock-shares,
body.amounts-hidden .stock-price,
body.amounts-hidden .stock-invested {
  display: inline-block;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}

body.amounts-hidden #typeChartCenterAmount,
body.amounts-hidden #themeChartCenterAmount,
body.amounts-hidden #marketChartCenterAmount,
body.amounts-hidden #typeChartLegendOneValue,
body.amounts-hidden #typeChartLegendTwoValue,
body.amounts-hidden #themeChartLegendOneValue,
body.amounts-hidden #themeChartLegendTwoValue,
body.amounts-hidden #marketChartLegendOneValue,
body.amounts-hidden #marketChartLegendTwoValue {
  color: transparent;
  background: linear-gradient(90deg, rgba(29, 26, 23, 0.08), rgba(29, 26, 23, 0.16), rgba(29, 26, 23, 0.08));
  border-radius: 999px;
  user-select: none;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap;
}

body.amounts-hidden #typeChartCenterAmount,
body.amounts-hidden #themeChartCenterAmount {
  display: block;
  width: 100%;
  max-width: 7em;
  margin: 8px auto 0;
}

body.amounts-hidden #marketChartCenterAmount {
  display: block;
  width: 100%;
  max-width: 7em;
  margin: 8px auto 0;
}

body.amounts-hidden #typeChartLegendOneValue,
body.amounts-hidden #typeChartLegendTwoValue,
body.amounts-hidden #themeChartLegendOneValue,
body.amounts-hidden #themeChartLegendTwoValue,
body.amounts-hidden #marketChartLegendOneValue,
body.amounts-hidden #marketChartLegendTwoValue {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding-right: 0.2em;
}

.memo-title {
  margin-bottom: 10px;
}

.card-view.hidden,
.edit-form.hidden {
  display: none;
}

.card-details {
  max-height: 120px;
  overflow: hidden;
  position: relative;
}

.card-details::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 46px;
  background: linear-gradient(180deg, rgba(255, 250, 242, 0), rgba(255, 250, 242, 1));
  pointer-events: none;
}

.card-details.is-expanded {
  max-height: none;
}

.card-details.is-expanded::after {
  display: none;
}

.toggle-details-button {
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 700;
  cursor: pointer;
}

.edit-form {
  display: grid;
  gap: 16px;
}

.edit-form label {
  display: grid;
  gap: 8px;
}

.edit-form span {
  font-size: 0.94rem;
  font-weight: 600;
}

.edit-form input,
.edit-form textarea {
  width: 100%;
  padding: 15px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
}

.edit-form input:focus,
.edit-form textarea:focus {
  outline: 2px solid rgba(217, 108, 61, 0.3);
  border-color: rgba(217, 108, 61, 0.5);
}

.empty-state {
  margin-top: 10px;
  padding: 42px 24px;
  text-align: center;
  border: 1px dashed rgba(29, 26, 23, 0.18);
  border-radius: 26px;
  color: var(--muted);
  background: rgba(255, 250, 242, 0.68);
}

.empty-state.hidden {
  display: none;
}

body.is-exporting {
  background: linear-gradient(180deg, #f5eee3 0%, #efe4d4 100%);
}

body.is-exporting .background-orb {
  display: none;
}

body.is-exporting .page-shell {
  width: min(1440px, calc(100% - 40px));
  padding: 24px 0 56px;
}

body.is-exporting #exportTarget {
  padding: 12px 0 12px;
}

body.is-exporting .hero,
body.is-exporting .summary-card,
body.is-exporting .category-filter,
body.is-exporting .category-total-box,
body.is-exporting .stock-card,
body.is-exporting .empty-state {
  backdrop-filter: none;
  background: #fffaf3;
  border-color: rgba(29, 26, 23, 0.1);
  box-shadow: 0 14px 36px rgba(93, 56, 28, 0.08);
}

body.is-exporting .hero h1,
body.is-exporting .summary-card h2,
body.is-exporting .category-heading h3,
body.is-exporting .stock-title,
body.is-exporting .summary-total,
body.is-exporting .metric-box strong,
body.is-exporting .category-total-box strong {
  color: #1d1a17;
}

body.is-exporting .hero-copy,
body.is-exporting .summary-copy,
body.is-exporting .stock-memo,
body.is-exporting .eyebrow,
body.is-exporting .section-label,
body.is-exporting .card-label,
body.is-exporting .memo-title,
body.is-exporting .metric-box span,
body.is-exporting .category-total-box span {
  color: #5f5447;
}

body.is-exporting .hero-row {
  align-items: flex-start;
}

body.is-exporting .hero-copy {
  max-width: 720px;
}

body.is-exporting .cards-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .cards-grid,
  body.is-exporting .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body.is-exporting .metric-box {
  background: #fff1e1;
}

body.is-exporting .top-toolbar,
body.is-exporting .add-trigger,
body.is-exporting .composer,
body.is-exporting .card-actions {
  visibility: hidden;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
  }

  .hero,
  .composer,
  .summary-card,
  .stock-card {
    border-radius: 24px;
  }

  .hero {
    padding: 26px;
  }

  .hero-row,
  .composer-header,
  .summary-card,
  .card-top,
  .form-actions,
  .category-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-card {
    grid-template-columns: 1fr;
  }

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

  .summary-details {
    text-align: left;
  }

  .card-actions {
    flex-direction: column;
  }

  .add-trigger {
    width: 100%;
    height: 64px;
    font-size: 2.2rem;
  }

  .top-toolbar {
    align-items: stretch;
    margin-bottom: 12px;
  }

  .session-bar,
  .session-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .sync-status,
  .storage-mode,
  .user-pill {
    justify-content: center;
  }

  .back-link {
    margin-bottom: 14px;
  }

  .toolbar-actions {
    width: 100%;
  }

  .save-button {
    width: 100%;
  }

  .toolbar-button,
  .save-button {
    width: 100%;
  }

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

  .type-selector {
    flex-direction: column;
  }
}

@media (max-width: 1280px) {
  .chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
