:root {
  --ink: #171717;
  --muted: #727783;
  --soft: #a1a6b3;
  --paper: #f6f4ef;
  --surface: #ffffff;
  --line: #dfe4ec;
  --line-strong: #cbd3df;
  --green: #119c7b;
  --green-soft: #ebf8f4;
  --blue: #2563eb;
  --blue-soft: #edf3ff;
  --red: #d84a57;
  --red-soft: #fff0f1;
  --amber: #c98b1c;
  --amber-soft: #fff8e7;
  --dark: #17201d;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(23, 23, 23, 0.06);
  --shadow-md: 0 12px 30px rgba(23, 23, 23, 0.08);
  --shadow-lg: 0 22px 70px rgba(23, 23, 23, 0.18);
  --radius: 8px;
  --header-h: 88px;
  --fab-size: 58px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 244, 239, 0.92);
  border-bottom: 1px solid rgba(23, 23, 23, 0.10);
  backdrop-filter: blur(16px);
}

.header-inner {
  max-width: 1440px;
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 0 2.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 50%, var(--surface) 0 42%, transparent 43%),
    conic-gradient(from 220deg, var(--green), var(--blue), var(--amber), var(--green));
  box-shadow: inset 0 0 0 7px var(--surface), var(--shadow-sm);
  flex: 0 0 auto;
}

.logo-copy { display: grid; gap: 0.25rem; }

.logo-text {
  color: var(--ink);
  font-size: 1.75rem;
  font-weight: 900;
  line-height: 1;
}

.logo-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
}

.header-actions,
.desktop-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#save-status {
  min-width: 0;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid #c7eadf;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.65rem 0.85rem;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}

#save-status.saving,
#save-status.saved,
#save-status.error { opacity: 1; }
#save-status.error { color: var(--red); background: var(--red-soft); border-color: #ffd1d5; }

.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 2.6rem 3rem;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn-icon { font-weight: 900; }
.btn-month { background: var(--ink); border-color: var(--ink); color: var(--white); }
.btn-expense:hover { background: var(--red-soft); border-color: #ffd1d5; color: var(--red); }
.btn-income:hover { background: var(--green-soft); border-color: #c7eadf; color: var(--green); }

.overview-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 1.35rem;
}

.summary-card,
.metric-card,
.insights-panel,
.table-wrapper {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.summary-card,
.metric-card {
  min-height: 116px;
  padding: 1.2rem 1.35rem;
  background: var(--surface);
}

.summary-card {
  background: var(--dark);
  border-color: var(--dark);
  color: var(--white);
}

.summary-card.hidden { display: none; }

.summary-label,
.metric-card p,
.insight-card p {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.summary-label { color: #b9c9c1; }

.summary-value,
.metric-card strong {
  display: block;
  margin-top: 0.65rem;
  font-size: clamp(1.65rem, 2.7vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.summary-period,
.metric-card small {
  display: block;
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
}

.summary-period { color: #b9c9c1; }
.summary-card.negative { background: #2a1518; border-color: #2a1518; }
.summary-card.warning { background: #261f12; border-color: #261f12; }
#top-category { font-size: clamp(1.45rem, 2.1vw, 1.85rem); }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 1rem;
  align-items: start;
}

.table-wrapper {
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.table-wrapper::-webkit-scrollbar { height: 6px; }
.table-wrapper::-webkit-scrollbar-track { background: transparent; }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }

.table-toolbar {
  min-width: 660px;
  height: 62px;
  padding: 0 1.1rem;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.table-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.table-tab {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 0.75rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 900;
}

.table-tab.active {
  background: var(--blue-soft);
  border-color: #cbdcff;
  color: var(--blue);
}

table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
  table-layout: fixed;
}

th {
  height: 48px;
  padding: 0 1rem;
  background: #fafafa;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  height: 58px;
  padding: 0 1rem;
  border-bottom: 1px solid #edf0f5;
  color: var(--ink);
  font-size: 0.9rem;
  text-align: center;
  vertical-align: middle;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 320px;
  min-width: 260px;
  text-align: left;
}

th:first-child {
  z-index: 3;
  background: #fafafa;
}

td:first-child {
  background:
    linear-gradient(90deg, var(--row-accent, transparent) 0 4px, transparent 4px),
    var(--surface);
  box-shadow: 10px 0 24px rgba(23, 23, 23, 0.04);
}

tbody tr:hover td { background-color: #fbfcfe; }
tbody tr:hover td:first-child {
  background:
    linear-gradient(90deg, var(--row-accent, transparent) 0 4px, transparent 4px),
    #fbfcfe;
}

tbody tr:last-child td { border-bottom: none; }

.col-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.col-header-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-delete-col {
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: transparent;
  cursor: pointer;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

th:hover .btn-delete-col {
  color: var(--muted);
  border-color: var(--line);
  pointer-events: all;
}

.btn-delete-col:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffd1d5;
}

.label-wrapper {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.label-stack {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
  flex: 1 1 auto;
}

.category-meta {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-category {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.btn-category.has-category {
  border-style: solid;
  border-color: var(--line);
  background: color-mix(in srgb, var(--row-accent, #f0f0f5) 52%, white);
  font-size: 1.1rem;
}

.btn-category:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.btn-category:active { transform: translateY(0) scale(0.96); }

.drag-handle {
  display: none;
  flex: 0 0 auto;
  color: var(--line-strong);
  cursor: grab;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.1rem;
  user-select: none;
}

.drag-handle:hover { color: var(--muted); }
.drag-handle:active { cursor: grabbing; }

.reorder-wrapper {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}

.btn-reorder {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--line-strong);
  cursor: pointer;
  font-size: 0.58rem;
  line-height: 1.1;
  padding: 0.05rem;
}

.btn-reorder:hover:not(:disabled) { color: var(--blue); }
.btn-reorder:disabled { opacity: 0.25; cursor: default; }

.label-input {
  width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.15;
  padding: 0.16rem 0.25rem;
  transition: border-color 0.15s, background 0.15s;
}

.label-input:hover { border-color: var(--line); }
.label-input:focus {
  outline: none;
  background: var(--blue-soft);
  border-color: #cbdcff;
}

.btn-toggle-row,
.btn-delete-row {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}

tbody tr:hover .btn-toggle-row,
tbody tr:hover .btn-delete-row { opacity: 1; }
.btn-toggle-row:hover { background: var(--blue-soft); border-color: #cbdcff; color: var(--blue); }
.btn-delete-row:hover { background: var(--red-soft); border-color: #ffd1d5; color: var(--red); }
.btn-toggle-row.is-hidden { opacity: 1; color: var(--red); }

.value-cell { text-align: right; }

.cell-display {
  width: 100%;
  min-width: 88px;
  display: block;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.65rem 0.5rem;
  text-align: right;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.cell-display[data-empty="true"] { color: var(--soft); }
.cell-display:hover {
  background: var(--blue-soft);
  border-color: #cbdcff;
  transform: translateY(-1px);
}
.cell-display:active { transform: translateY(0) scale(0.98); }

.row-income .cell-display:not([data-empty="true"]) { color: var(--green); }
.row-expense .cell-display:not([data-empty="true"]) { color: var(--ink); }

.row-disabled { opacity: 0.4; }
.row-disabled .cell-display,
.row-disabled .label-input { text-decoration: line-through; }

.row-dragging { opacity: 0.45; }
.row-drag-over > td { border-top: 2px solid var(--blue) !important; }

.row-balance td {
  height: 62px;
  background: #f5fbf7;
  color: var(--green);
  font-size: 0.95rem;
  font-weight: 900;
}

.row-balance td:first-child {
  background:
    linear-gradient(90deg, var(--green) 0 4px, transparent 4px),
    #f5fbf7;
  color: var(--green);
  box-shadow: 10px 0 24px rgba(23, 23, 23, 0.04);
}

.insights-panel {
  position: sticky;
  top: calc(var(--header-h) + 1rem);
  background: var(--surface);
  padding: 1.15rem;
}

.insights-panel h2 {
  margin-bottom: 1rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.insight-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.85rem;
  background: var(--surface);
}

.insight-card strong {
  display: block;
  margin-top: 0.65rem;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
}

.health-bar {
  height: 9px;
  margin-top: 0.9rem;
  border-radius: 999px;
  background: #edf0f5;
  overflow: hidden;
}

.health-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.25s;
}

.insight-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1.2rem;
}

.insight-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.insight-row span {
  display: flex;
  align-items: center;
  min-width: 0;
}

.insight-row i {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
  border-radius: 7px;
  font-style: normal;
  line-height: 1;
}

.insight-row strong {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.cell-sheet {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
}

.cell-sheet.hidden { display: none; }

.cell-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 0.25s;
}

.cell-sheet.open .cell-sheet-backdrop {
  background: rgba(23, 23, 23, 0.45);
  backdrop-filter: blur(3px);
}

.cell-sheet-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 1.5rem 2rem;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.34, 1.05, 0.64, 1);
}

.cell-sheet.open .cell-sheet-panel { transform: translateY(0); }

.cell-sheet-panel::before {
  content: '';
  display: block;
  width: 38px;
  height: 4px;
  margin: 1rem auto 1.25rem;
  border-radius: 999px;
  background: var(--line-strong);
}

.cell-sheet-context {
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.cell-sheet-current {
  margin-bottom: 1.25rem;
  color: var(--ink);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.cell-sheet-input {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 800;
  text-align: center;
}

.cell-sheet-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.cell-sheet-input::-webkit-outer-spin-button,
.cell-sheet-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cell-sheet-input { -moz-appearance: textfield; }

.cell-sheet-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.sheet-action-btn,
.sheet-cancel-btn,
.modal-btn {
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 850;
  transition: transform 0.15s, opacity 0.15s;
}

.sheet-action-btn {
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--white);
}

.sheet-action-btn:hover,
.sheet-cancel-btn:hover,
.modal-btn:hover { transform: translateY(-1px); }
.sheet-action-btn:active,
.sheet-cancel-btn:active,
.modal-btn:active { transform: translateY(0) scale(0.98); }

.sheet-btn-icon { font-size: 1.25rem; line-height: 1; }
.sheet-btn-set { background: var(--ink); }
.sheet-btn-add { background: var(--green); }
.sheet-btn-sub { background: var(--amber); color: var(--ink); }

.sheet-cancel-btn {
  width: 100%;
  min-height: 44px;
  background: #edf0f5;
  color: var(--muted);
}

.category-picker {
  position: fixed;
  z-index: 600;
  width: 252px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  padding: 0.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: cat-in 0.14s ease-out;
}

@keyframes cat-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cat-item {
  min-height: 66px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem 0.3rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.cat-item:hover,
.cat-item.cat-selected {
  background: color-mix(in srgb, var(--item-bg, #f0f0f5) 68%, white);
  border-color: rgba(23, 23, 23, 0.10);
}

.cat-item:active { transform: scale(0.97); }
.cat-item.cat-none { grid-column: span 3; min-height: 42px; flex-direction: row; }
.cat-item-emoji { font-size: 1.35rem; line-height: 1; }
.cat-item-label {
  max-width: 64px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fab-container {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.65rem;
}

.fab-main {
  width: var(--fab-size);
  height: var(--fab-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  font-size: 1.8rem;
  font-weight: 400;
}

.fab-icon { transition: transform 0.2s; }
.fab-main.open .fab-icon { transform: rotate(45deg); }

.fab-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.18s, transform 0.18s;
}

.fab-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.fab-item {
  min-height: 42px;
  padding: 0 1rem;
  border: none;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  color: var(--white);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 850;
}

.fab-expense { background: var(--red); }
.fab-income { background: var(--green); }
.fab-month { background: var(--ink); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(23, 23, 23, 0.46);
  backdrop-filter: blur(5px);
}

.modal-overlay.hidden { display: none; }

.modal {
  width: min(100%, 360px);
  padding: 1.8rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal-icon {
  margin-bottom: 0.8rem;
  color: var(--amber);
  font-size: 2rem;
  line-height: 1;
}

.modal p {
  margin-bottom: 1.35rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.modal-btn {
  min-height: 42px;
  padding: 0 1.2rem;
}

.btn-cancel { background: #edf0f5; color: var(--muted); }
.btn-delete { background: var(--red); color: var(--white); }

@media (min-width: 768px) {
  .fab-container { display: none; }
  .drag-handle { display: flex; }
  .reorder-wrapper { display: none; }
  .cell-sheet {
    align-items: center;
    justify-content: center;
  }
  .cell-sheet-panel {
    width: 380px;
    max-width: 92%;
    padding-top: 1.6rem;
    border-radius: var(--radius);
    opacity: 0;
    transform: scale(0.94) translateY(10px);
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
  }
  .cell-sheet-panel::before { display: none; }
  .cell-sheet.open .cell-sheet-panel {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (max-width: 1120px) {
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-grid { grid-template-columns: 1fr; }
  .insights-panel {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }
  .insights-panel h2,
  .insight-list { grid-column: 1 / -1; }
  .insight-card { margin: 0; }
}

@media (max-width: 767px) {
  :root { --header-h: 76px; }
  .header-inner {
    padding: 0 1rem;
  }
  .logo-mark { width: 38px; height: 38px; }
  .logo-text { font-size: 1.35rem; }
  .logo-subtitle { display: none; }
  .desktop-controls { display: none; }
  #save-status { padding: 0.55rem 0.65rem; }
  .main-content {
    padding: 1rem 0.85rem 5.5rem;
  }
  .overview-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .summary-card,
  .metric-card {
    min-height: auto;
    padding: 1rem;
  }
  .summary-value,
  .metric-card strong {
    font-size: 1.8rem;
  }
  .workspace-grid { gap: 0.85rem; }
  .table-toolbar,
  table { min-width: 500px; }
  th:first-child,
  td:first-child {
    width: 126px;
    min-width: 126px;
    max-width: 126px;
  }
  th,
  td {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  th:not(:first-child),
  td:not(:first-child) {
    min-width: 122px;
  }
  .btn-category {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
  .category-meta { display: none; }
  .label-wrapper { gap: 0.3rem; }
  .label-stack { min-width: 0; }
  .label-input {
    padding-left: 0.1rem;
    padding-right: 0.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .reorder-wrapper,
  .btn-toggle-row,
  .btn-delete-row { display: none; }
  .cell-display { min-width: 106px; }
  .insights-panel { grid-template-columns: 1fr; }
}
