* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg-app: #1e1e1e;
  --bg-ribbon: #181818;
  --bg-workspace: #202020;
  --bg-topbar: #232323;
  --bg-panel: #262626;
  --bg-panel-soft: #232323;
  --bg-panel-hover: #2b2b2b;
  --bg-control: #2d2d2d;
  --bg-control-hover: #363636;
  --bg-accent-soft: #342c4b;
  --bg-overlay: rgba(10, 10, 12, 0.55);
  --bg-modal: #262626;
  --border-strong: #111111;
  --border-normal: #353535;
  --border-control: #444444;
  --border-subtle: #2a2a2a;
  --text-main: #dcddde;
  --text-strong: #f1f1f1;
  --text-muted: #b7b9bd;
  --text-faint: #9ca0a4;
  --text-disabled: #6f7174;
  --accent: #7c5cd4;
  --accent-strong: #9572e9;
  --accent-text: #cfc3ff;
  --avatar-bg: #4b3a77;
  --danger: #d65454;
  --danger-soft: #3a1f1f;
  --success: #67b471;
  --success-soft: #1e3324;
  --warn: #e0a458;
  --warn-soft: #3a2e1a;
  --series-rent: #8f6bdc;
  --series-advance: #4db6ac;
  --series-deposit: #e0a458;
  --series-other: #6f7376;
  --chart-grid: #333333;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-app: #f2f2f2;
  --bg-ribbon: #e7e7e7;
  --bg-workspace: #f8f8f8;
  --bg-topbar: #ffffff;
  --bg-panel: #ffffff;
  --bg-panel-soft: #fafafa;
  --bg-panel-hover: #f1eef9;
  --bg-control: #f0f0f0;
  --bg-control-hover: #e7e3ee;
  --bg-accent-soft: #ede7fb;
  --bg-overlay: rgba(48, 48, 56, 0.32);
  --bg-modal: #ffffff;
  --border-strong: #d0d0d0;
  --border-normal: #d8d8d8;
  --border-control: #c9c9c9;
  --border-subtle: #ececec;
  --text-main: #2f3033;
  --text-strong: #1f2023;
  --text-muted: #5f6066;
  --text-faint: #70727a;
  --text-disabled: #9a9aa0;
  --accent: #6b4fb5;
  --accent-strong: #7f5fd1;
  --accent-text: #4f378f;
  --avatar-bg: #b6a3ef;
  --danger: #c14545;
  --danger-soft: #fbecec;
  --success: #4d9a55;
  --success-soft: #e8f3ea;
  --warn: #c9871f;
  --warn-soft: #f8efdd;
  --series-rent: #7f5fd1;
  --series-advance: #2f9e91;
  --series-deposit: #c9871f;
  --series-other: #a2a4ab;
  --chart-grid: #e4e4e8;
  --shadow-md: 0 6px 18px rgba(45, 45, 60, 0.12);
  --shadow-lg: 0 18px 44px rgba(45, 45, 60, 0.18);
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

/* ----------- Shell ----------- */

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

.shell[hidden] {
  display: none;
}

.ribbon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-right: 1px solid var(--border-strong);
  background: var(--bg-ribbon);
}

.ribbon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--text-faint);
  background: transparent;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.ribbon-button:hover {
  color: var(--text-strong);
  background: var(--bg-panel-hover);
}

.ribbon-button.active {
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.workspace {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) 24px;
  background: var(--bg-workspace);
}

.topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--bg-topbar);
}

.topbar-title {
  min-width: 0;
  display: grid;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
  font-weight: 600;
  color: var(--text-strong);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.view[hidden],
.icon-button[hidden] {
  display: none !important;
}

.view {
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.app-home.view {
  height: 100%;
  overflow: hidden;
}

/* ----------- Launcher ----------- */

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.app-card {
  min-height: 140px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  color: inherit;
  background: var(--bg-panel);
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.app-card:hover {
  border-color: var(--accent);
  background: var(--bg-panel-hover);
}

.app-card:active {
  transform: translateY(1px);
}

.app-card:focus-visible,
.icon-button:focus-visible,
.ribbon-button:focus-visible,
.icon-only-button:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.chip:focus-visible,
.form-input:focus-visible,
.search-input:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 1px;
}

.app-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: #ffffff;
  background: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.app-icon.large {
  width: 52px;
  height: 52px;
  font-size: 16px;
}

.app-icon.has-svg svg {
  width: 22px;
  height: 22px;
}

.app-icon.large.has-svg svg {
  width: 28px;
  height: 28px;
}

.card-content {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.card-title {
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 600;
}

.card-description {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.card-status {
  width: fit-content;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--accent-text);
  background: var(--bg-accent-soft);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ----------- Buttons ----------- */

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  color: var(--text-main);
  background: var(--bg-control);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.icon-button:hover {
  background: var(--bg-control-hover);
}

.icon-only-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.icon-only-button:hover {
  color: var(--text-strong);
  background: var(--bg-panel-hover);
}

.icon-only-button.danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.icon-only-button.active-star {
  color: var(--accent-text);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.primary-button.danger {
  background: var(--danger);
  border-color: var(--danger);
}

.primary-button.danger:hover {
  filter: brightness(1.1);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  color: var(--text-main);
  background: var(--bg-control);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}

.secondary-button:hover {
  background: var(--bg-control-hover);
}

.secondary-button:disabled {
  color: var(--text-disabled);
  cursor: not-allowed;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border-normal);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.chip:hover {
  border-color: var(--border-control);
  color: var(--text-strong);
}

.chip.active {
  color: var(--accent-text);
  background: var(--bg-accent-soft);
  border-color: var(--bg-accent-soft);
}

.lucide {
  display: block;
  flex: 0 0 auto;
}

[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ----------- Theme toggle ----------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  color: var(--text-main);
  background: var(--bg-control);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
}

.theme-toggle:hover {
  background: var(--bg-control-hover);
}

.theme-toggle-icon {
  color: var(--accent-text);
}

/* ----------- App home ----------- */

.app-home {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 22px;
}

.app-home-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.app-home-title {
  min-width: 0;
}

h2,
h3 {
  margin: 0;
}

h2 {
  color: var(--text-strong);
  font-size: 22px;
  line-height: 1.2;
  font-weight: 650;
}

h3 {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 650;
}

.detail-description {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--text-muted);
  line-height: 1.5;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 12px;
}

.wheeler-shell {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.wheeler-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: var(--bg-workspace);
}

.tool-panel {
  padding: 14px 16px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.tool-panel p,
.tool-panel li {
  color: var(--text-muted);
  line-height: 1.55;
}

.tool-panel p {
  margin: 10px 0 0;
}

.tool-panel ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.tool-panel li + li {
  margin-top: 6px;
}

/* ----------- Contacts ----------- */

.contacts-shell {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.contacts-loading {
  padding: 32px;
  text-align: center;
  color: var(--text-faint);
}

.contacts-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.stat-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.stat-body {
  display: grid;
  gap: 2px;
}

.stat-body strong {
  color: var(--text-strong);
  font-size: 20px;
  line-height: 1;
  font-weight: 650;
}

.stat-body span {
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
}

.contacts-pane {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 12px;
}

/* Left list */

.contacts-list-panel {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-wrap {
  position: relative;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 24px;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 32px;
  padding: 0 10px 0 32px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-control);
  color: var(--text-main);
  font: inherit;
  font-size: 13px;
}

.search-input::placeholder {
  color: var(--text-faint);
}

.filter-row {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.contacts-list {
  height: 100%;
  min-height: 0;
  display: grid;
  overflow-y: auto;
  align-content: start;
}

.contact-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.1s ease;
}

.contact-row:hover {
  background: var(--bg-panel-hover);
}

.contact-row.selected {
  background: var(--bg-accent-soft);
}

.contact-row.selected .contact-title-row strong {
  color: var(--accent-text);
}

.contact-row:last-child {
  border-bottom: 0;
}

.contact-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--avatar-bg);
  font-size: 12.5px;
  font-weight: 650;
}

.contact-avatar.large {
  width: 56px;
  height: 56px;
  font-size: 18px;
}

.contact-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.contact-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.contact-title-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relationship-pill {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--accent-text);
  background: var(--bg-accent-soft);
  font-size: 10.5px;
  font-weight: 600;
}

.contact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.meta-item > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-toggle {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-disabled);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.favorite-toggle:hover {
  color: var(--accent-text);
  background: var(--bg-panel-hover);
}

.favorite-toggle.active {
  color: var(--accent-strong);
}

.favorite-toggle.active svg {
  fill: currentColor;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 40px 20px;
  color: var(--text-faint);
  text-align: center;
}

.empty-icon {
  color: var(--text-disabled);
}

/* Right detail */

.contacts-detail-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}

.contacts-detail-panel.empty {
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 40px;
  color: var(--text-faint);
  text-align: center;
  grid-template-rows: auto auto;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-identity {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.detail-identity h3 {
  font-size: 16px;
  font-weight: 650;
}

.detail-relationship {
  margin: 0;
  color: var(--text-faint);
  font-size: 12.5px;
}

.detail-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.detail-body {
  display: grid;
  gap: 18px;
  padding: 18px;
  overflow-y: auto;
  align-content: start;
}

.detail-field {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.detail-field-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--accent-text);
  background: var(--bg-accent-soft);
  flex: 0 0 auto;
}

.detail-field-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.detail-field-label {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-field-value {
  color: var(--text-strong);
  font-size: 13.5px;
  word-break: break-word;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-control);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
}

.detail-section {
  display: grid;
  gap: 6px;
}

.detail-section-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-notes {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.detail-footer {
  margin-top: 4px;
  color: var(--text-disabled);
  font-size: 11.5px;
}

/* ----------- Properties ----------- */

.properties-shell {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.properties-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.property-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.properties-layout {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 12px;
}

.properties-list-panel,
.property-detail-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}

.properties-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.property-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.property-panel-header p {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.property-card-list {
  height: 100%;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
}

.property-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-panel-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.property-card:hover {
  border-color: var(--border-control);
  background: var(--bg-panel-hover);
}

.property-card.selected {
  border-color: var(--accent);
  background: var(--bg-accent-soft);
}

.property-card-top {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.property-type-icon,
.property-hero-icon {
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.property-type-icon {
  width: 34px;
  height: 34px;
}

.property-card-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.property-card-title strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.property-card-title span,
.property-card-meta {
  color: var(--text-faint);
  font-size: 11.5px;
}

.property-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.status-pill {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--accent-text);
  background: var(--bg-accent-soft);
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}

.status-pill.occupied {
  color: var(--success);
}

.status-pill.vacant {
  color: var(--danger);
  background: var(--danger-soft);
}

.property-detail-panel {
  display: grid;
  align-content: start;
  overflow-y: auto;
}

.property-detail-panel.empty {
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 40px;
  color: var(--text-faint);
  text-align: center;
}

.property-detail-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.property-hero-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
}

.property-hero-title {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.property-hero-title h3 {
  font-size: 18px;
}

.property-hero-title p {
  margin: 0;
  color: var(--text-faint);
  font-size: 12.5px;
}

.property-detail-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.property-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.property-metric {
  min-width: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
}

.property-metric > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.property-metric strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.property-detail-section {
  display: grid;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.property-detail-section p {
  margin: 0;
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
}

/* ----------- GoldLedger ----------- */

.gold-ledger-shell {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.gold-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.gold-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.gold-ledger-layout {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(330px, 450px) minmax(0, 1fr);
  gap: 12px;
}

.gold-list-panel,
.gold-detail-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}

.gold-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.gold-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.gold-panel-header p {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.gold-item-list {
  height: 100%;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
}

.gold-item-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-panel-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.gold-item-card:hover {
  border-color: var(--border-control);
  background: var(--bg-panel-hover);
}

.gold-item-card.selected {
  border-color: var(--accent);
  background: var(--bg-accent-soft);
}

.gold-thumb,
.gold-hero-photo {
  display: grid;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  object-fit: cover;
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.gold-thumb {
  width: 64px;
  height: 64px;
}

.gold-card-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.gold-card-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gold-card-title strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gold-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.gold-card-value {
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 650;
}

.gold-detail-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.gold-detail-panel.empty {
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 40px;
  color: var(--text-faint);
  text-align: center;
  grid-template-rows: auto auto;
}

.gold-detail-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.gold-hero-photo {
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
}

.gold-hero-title {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.gold-hero-title h3 {
  font-size: 18px;
}

.gold-hero-title p {
  margin: 0;
  color: var(--text-faint);
  font-size: 12.5px;
}

.gold-detail-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.gold-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.gold-metric {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
}

.gold-metric > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.gold-metric strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gold-detail-body {
  min-height: 0;
  display: grid;
  align-content: start;
  overflow-y: auto;
}

.gold-info-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.gold-info-row {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
}

.gold-info-row span {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.gold-info-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gold-attachments-section {
  border-bottom: 1px solid var(--border-subtle);
}

.gold-attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  padding: 12px;
}

.gold-attachment-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
}

.gold-attachment-preview {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  object-fit: cover;
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.gold-attachment-body {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.gold-attachment-body strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gold-attachment-body span {
  color: var(--text-faint);
  font-size: 11.5px;
}

.gold-attachment-actions {
  display: flex;
  gap: 2px;
}

.gold-form,
.gold-attachment-form {
  gap: 12px;
}

.attachment-picker-button {
  width: fit-content;
}

.picked-file-list {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
}

.picked-file-list p {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
}

.empty-state.compact {
  padding: 22px 16px;
}

/* ----------- RentLedger ----------- */

.rent-ledger-shell {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.rent-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.rent-ledger-layout {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 12px;
}

.leases-panel,
.lease-detail-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}

.leases-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.lease-list {
  height: 100%;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  overflow-y: auto;
}

.lease-card {
  display: grid;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-panel-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.lease-card:hover {
  border-color: var(--border-control);
  background: var(--bg-panel-hover);
}

.lease-card.selected {
  border-color: var(--accent);
  background: var(--bg-accent-soft);
}

.lease-card-top {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.lease-detail-panel {
  display: grid;
  align-content: start;
  overflow-y: auto;
}

.lease-detail-panel.empty {
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 40px;
  color: var(--text-faint);
  text-align: center;
}

.lease-terms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-subtle);
}

.lease-terms-grid .property-detail-section {
  border-bottom: 0;
}

.lease-terms-grid .property-detail-section + .property-detail-section {
  border-left: 1px solid var(--border-subtle);
}

.lease-document-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  background: var(--bg-panel-soft);
  font-size: 12px;
}

.lease-document-bar button {
  margin-left: auto;
}

.payments-panel {
  border-bottom: 1px solid var(--border-subtle);
}

.payments-heading {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.payments-heading p {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.payments-table {
  display: grid;
  overflow-x: auto;
}

.payments-table-header,
.payment-row {
  min-width: 680px;
  display: grid;
  grid-template-columns: minmax(90px, 0.8fr) minmax(150px, 1fr) minmax(100px, 0.9fr) minmax(110px, auto) 32px;
  align-items: center;
  gap: 12px;
}

.payments-table-header {
  padding: 8px 14px;
  color: var(--text-faint);
  background: var(--bg-panel-soft);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
}

.payments-table-header span:nth-child(4) {
  text-align: right;
}

.credit-payments-table .payments-table-header,
.credit-payments-table .payment-row {
  min-width: 820px;
  grid-template-columns: minmax(80px, 0.7fr) minmax(90px, 0.7fr) minmax(150px, 1fr) minmax(100px, 0.8fr) minmax(110px, auto) 32px;
}

.credit-payments-table .payments-table-header span:nth-child(5) {
  text-align: right;
}

.credit-bills-table .payments-table-header,
.credit-bills-table .payment-row {
  min-width: 840px;
  grid-template-columns: minmax(120px, 0.9fr) minmax(190px, 1.2fr) minmax(110px, 0.8fr) minmax(120px, auto) minmax(170px, auto);
}

.credit-bills-table .payments-table-header span:nth-child(4) {
  text-align: right;
}

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

.payment-type-cell {
  display: grid;
  gap: 4px;
}

.payment-row {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
}

.payment-type-cell strong {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 650;
}

.payment-muted-cell {
  min-width: 0;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-amount {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 650;
  text-align: right;
  white-space: nowrap;
}

.lease-form,
.payment-form {
  gap: 12px;
}

/* ----------- RentLedger tabs ----------- */

.rent-tabbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rent-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
}

.rent-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.rent-tab:hover {
  color: var(--text-strong);
}

.rent-tab.active {
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.rent-tab-content {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

.rent-collection {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.rent-collection-head,
.rent-collection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.rent-collection-head h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 15px;
}

.rent-collection-head p {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 12px;
}

.rent-collection-toolbar {
  justify-content: flex-start;
  background: var(--bg-panel-soft);
}

.rent-search {
  width: min(420px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  color: var(--text-faint);
  background: var(--bg-control);
}

.rent-search-input {
  min-height: 34px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text-strong);
  background: transparent;
}

.rent-status-filter {
  width: auto;
  min-width: 140px;
  min-height: 36px;
}

.rent-data-table {
  min-height: 0;
  overflow: auto;
}

.rent-data-header,
.rent-data-row {
  min-width: 880px;
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
}

.rent-data-header {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--text-faint);
  background: var(--bg-panel-soft);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.rent-data-row {
  min-height: 58px;
  border-bottom: 1px solid var(--border-subtle);
}

.rent-data-row:hover {
  background: var(--bg-panel-hover);
}

.rent-property-row,
.rent-collection-properties .rent-data-header {
  grid-template-columns: minmax(170px, 1.2fr) minmax(210px, 1.5fr) minmax(150px, 1fr) minmax(130px, .8fr) 36px;
}

.rent-tenant-row,
.rent-collection-tenants .rent-data-header {
  grid-template-columns: minmax(180px, 1.1fr) minmax(210px, 1.3fr) minmax(170px, 1fr) 90px 36px;
}

.rent-due-row,
.rent-collection-dues .rent-data-header {
  min-width: 1080px;
  grid-template-columns: minmax(190px, 1.3fr) minmax(150px, 1fr) minmax(125px, .8fr) minmax(120px, .8fr) minmax(120px, .8fr) 90px 60px;
}

.rent-payment-history-row,
.rent-collection-payments .rent-data-header {
  min-width: 1100px;
  grid-template-columns: minmax(190px, 1.2fr) 110px 90px minmax(180px, 1.1fr) minmax(125px, .8fr) minmax(120px, .8fr) 36px;
}

.rent-expense-row,
.rent-collection-expenses .rent-data-header {
  grid-template-columns: 110px minmax(170px, 1fr) minmax(130px, .8fr) minmax(190px, 1.1fr) minmax(120px, .8fr) 72px;
}

.rent-data-cell {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.rent-data-cell strong,
.rent-data-cell small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rent-data-cell strong {
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 620;
}

.rent-data-cell small {
  color: var(--text-faint);
  font-size: 11px;
}

.rent-data-cell.numeric,
.rent-data-header span:nth-last-child(2) {
  text-align: right;
}

.rent-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.rent-settled {
  display: grid;
  place-items: center;
  color: var(--success);
}

.rent-empty {
  min-height: 260px;
}

.rent-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.rent-check input {
  width: 16px;
  height: 16px;
}

.rent-payment-summary {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-strong);
  background: var(--bg-panel-soft);
}

.rent-payment-summary span {
  color: var(--text-faint);
  font-size: 12px;
}

.rent-document-picker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px dashed var(--border-control);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
}

.rent-document-picker > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.rent-document-picker strong {
  color: var(--text-strong);
  font-size: 12px;
}

.rent-document-picker > div span {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rent-document-actions {
  display: flex;
  gap: 6px;
}

.status-pill.unpaid,
.status-pill.partial {
  color: var(--warn);
  background: var(--warn-soft);
}

.status-pill.overdue {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ----------- Dashboard layout ----------- */

.rent-dashboard {
  display: grid;
  gap: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  border: 1px solid var(--border-normal);
  border-left-width: 3px;
  border-left-color: var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.kpi-card.tone-accent {
  border-left-color: var(--accent);
}
.kpi-card.tone-good {
  border-left-color: var(--success);
}
.kpi-card.tone-bad {
  border-left-color: var(--danger);
}
.kpi-card.tone-warn {
  border-left-color: var(--warn);
}

.kpi-head {
  display: flex;
  align-items: center;
  gap: 7px;
}

.kpi-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.tone-good .kpi-icon {
  color: var(--success);
  background: var(--success-soft);
}
.tone-bad .kpi-icon {
  color: var(--danger);
  background: var(--danger-soft);
}
.tone-warn .kpi-icon {
  color: var(--warn);
  background: var(--warn-soft);
}

.kpi-label {
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
}

.kpi-value {
  color: var(--text-strong);
  font-size: 22px;
  font-weight: 680;
  line-height: 1;
}

.kpi-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-control);
  overflow: hidden;
}

.kpi-progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.tone-good .kpi-progress > span {
  background: var(--success);
}
.tone-bad .kpi-progress > span {
  background: var(--danger);
}

.kpi-foot {
  color: var(--text-faint);
  font-size: 11px;
}

/* ----------- Chart panels ----------- */

.dashboard-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 12px;
}

.dashboard-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 12px;
}

.chart-panel,
.cycle-panel,
.expiry-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.chart-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chart-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-text);
}

.chart-title h3 {
  color: var(--text-strong);
}

.chart-sub {
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
}

.chart-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 160px;
  color: var(--text-faint);
}

/* Bar chart */

.bar-chart {
  width: 100%;
  height: auto;
}

.chart-grid {
  stroke: var(--chart-grid);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.chart-axis-label {
  fill: var(--text-faint);
  font-size: 9px;
  font-family: inherit;
}

.bar-seg.series-rent {
  fill: var(--series-rent);
}
.bar-seg.series-advance {
  fill: var(--series-advance);
}
.bar-seg.series-deposit {
  fill: var(--series-deposit);
}
.bar-seg.series-other {
  fill: var(--series-other);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-self: end;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 11.5px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.legend-dot.series-rent {
  background: var(--series-rent);
}
.legend-dot.series-advance {
  background: var(--series-advance);
}
.legend-dot.series-deposit {
  background: var(--series-deposit);
}
.legend-dot.series-other {
  background: var(--series-other);
}

/* Donut */

.donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.donut-chart {
  width: 150px;
  height: 150px;
  flex: 0 0 auto;
}

.donut-track {
  stroke: var(--bg-control);
}

.donut-seg.series-rent {
  stroke: var(--series-rent);
}
.donut-seg.series-advance {
  stroke: var(--series-advance);
}
.donut-seg.series-deposit {
  stroke: var(--series-deposit);
}
.donut-seg.series-other {
  stroke: var(--series-other);
}

.donut-center-value {
  fill: var(--text-strong);
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
}

.donut-center-label {
  fill: var(--text-faint);
  font-size: 10px;
  font-family: inherit;
}

.donut-legend {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 8px;
}

.donut-legend-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
}

.donut-legend-label {
  color: var(--text-muted);
  font-size: 12px;
}

.donut-legend-value {
  color: var(--text-strong);
  font-size: 12px;
  font-weight: 650;
}

/* ----------- Rent cycle tracker ----------- */

.cycle-list {
  display: grid;
  gap: 10px;
  align-content: start;
  max-height: 420px;
  overflow-y: auto;
}

.cycle-row {
  display: grid;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.cycle-row:hover {
  border-color: var(--border-control);
  background: var(--bg-panel-hover);
}

.cycle-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cycle-identity {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.cycle-identity strong {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cycle-identity span {
  color: var(--text-faint);
  font-size: 11.5px;
}

.due-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.due-chip.ok {
  color: var(--success);
  background: var(--success-soft);
}
.due-chip.soon {
  color: var(--warn);
  background: var(--warn-soft);
}
.due-chip.overdue {
  color: var(--danger);
  background: var(--danger-soft);
}

.cycle-bars {
  display: grid;
  gap: 8px;
}

.cycle-bar-block {
  display: grid;
  gap: 4px;
}

.cycle-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-faint);
  font-size: 11px;
}

.cycle-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-control);
  overflow: hidden;
}

.cycle-progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.cycle-progress > span.good {
  background: var(--success);
}

.cycle-progress.term > span {
  background: var(--series-advance);
}

.cycle-term-open {
  color: var(--text-faint);
  font-size: 11.5px;
}

.cycle-actions {
  display: flex;
  justify-content: flex-end;
}

.secondary-button.small {
  height: 26px;
  padding: 0 9px;
  font-size: 11.5px;
}

/* ----------- Upcoming expiries ----------- */

.expiry-list {
  display: grid;
  gap: 8px;
  align-content: start;
  max-height: 420px;
  overflow-y: auto;
}

.expiry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.expiry-row:hover {
  border-color: var(--border-control);
  background: var(--bg-panel-hover);
}

.expiry-identity {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.expiry-identity strong {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expiry-identity span {
  color: var(--text-faint);
  font-size: 11px;
}

.expiry-countdown {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: 1px;
  text-align: right;
}

.expiry-countdown strong {
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 700;
}

.expiry-countdown.urgent strong {
  color: var(--danger);
}

.expiry-countdown span {
  color: var(--text-faint);
  font-size: 10.5px;
}

/* ----------- TaskBoard ----------- */

.taskboard-shell {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
}

.taskboard-layout {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(200px, 250px) minmax(320px, 430px) minmax(0, 1fr);
  gap: 12px;
}

.task-nav-panel,
.task-list-panel,
.task-detail-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}

.task-nav-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.task-nav-header,
.task-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.task-nav-header h3,
.task-list-header h3 {
  font-size: 14px;
}

.task-nav-header p,
.task-list-header p {
  margin: 3px 0 0;
  color: var(--text-faint);
  font-size: 11.5px;
}

.task-new-button {
  padding: 0 9px;
}

.task-nav-scroll {
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
}

.task-nav-section-title {
  padding: 10px 8px 6px;
  color: var(--text-disabled);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.task-nav-item {
  width: 100%;
  min-width: 0;
  height: 32px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}

.task-nav-item:hover {
  color: var(--text-strong);
  background: var(--bg-panel-hover);
}

.task-nav-item.active {
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.task-nav-icon {
  display: grid;
  place-items: center;
}

.task-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-nav-count {
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 650;
}

.task-list-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.task-list-panel.no-quick-add {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.task-quick-add {
  height: 40px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-faint);
}

.task-quick-input {
  width: 100%;
  height: 28px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-main);
  font: inherit;
}

.task-quick-input::placeholder {
  color: var(--text-faint);
}

.task-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.task-search-wrap {
  padding: 0;
  border-bottom: 0;
}

.task-filter-select {
  width: 100%;
  height: 32px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-control);
  color: var(--text-main);
  font: inherit;
  font-size: 12.5px;
}

.task-list-scroll {
  height: 100%;
  min-height: 0;
  display: grid;
  align-content: start;
  overflow-y: auto;
}

.task-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.12s ease;
}

.task-row:hover {
  background: var(--bg-panel-hover);
}

.task-row.selected {
  background: var(--bg-accent-soft);
}

.task-row.completed .task-row-title strong {
  color: var(--text-faint);
  text-decoration: line-through;
}

.task-check {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-control);
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
}

.task-check:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.task-check.checked {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.task-check.detail {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.task-check.small {
  width: 17px;
  height: 17px;
}

.task-row-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.task-row-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.task-row-title strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.priority-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-disabled);
  flex: 0 0 auto;
}

.priority-dot.high {
  background: var(--danger);
}

.priority-dot.medium {
  background: var(--warn);
}

.priority-dot.low {
  background: var(--success);
}

.task-row-meta {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.task-due.today {
  color: var(--warn);
}

.task-due.overdue {
  color: var(--danger);
}

.task-due.done {
  color: var(--success);
}

.task-mini-tag {
  color: var(--accent-text);
}

.task-detail-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.task-detail-panel.empty {
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 40px;
  color: var(--text-faint);
  text-align: center;
  grid-template-rows: auto auto;
}

.task-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.task-detail-title {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.task-detail-title h3 {
  font-size: 18px;
  line-height: 1.25;
}

.task-detail-title p {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
}

.task-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.task-metric {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
}

.task-metric > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.task-metric strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-detail-body {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 16px 18px;
  overflow-y: auto;
}

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

.checklist-count {
  margin-left: auto;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
}

.checklist-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-control);
  overflow: hidden;
}

.checklist-progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.18s ease;
}

.checklist-progress > span.good {
  background: var(--success);
}

.task-checklist {
  display: grid;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.task-checklist-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-panel-soft);
  color: var(--text-main);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.task-checklist-item:hover {
  background: var(--bg-panel-hover);
}

.task-checklist-item:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: -2px;
}

.task-checklist-item:last-child {
  border-bottom: 0;
}

.task-checklist-item .task-check.small {
  cursor: pointer;
}

.task-checklist-item .checklist-item-title {
  min-width: 0;
}

.task-checklist-item.done .checklist-item-title {
  color: var(--text-faint);
  text-decoration: line-through;
}

.task-form {
  gap: 12px;
}

/* ----------- TaskBoard: list management ----------- */

.task-nav-section-title.with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nav-add-button {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.nav-add-button:hover {
  color: var(--text-strong);
  background: var(--bg-control-hover);
}

.task-nav-row {
  position: relative;
}

.task-nav-row .task-nav-item {
  width: 100%;
}

.task-nav-edit {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
  opacity: 0;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.task-nav-row:hover .task-nav-edit,
.task-nav-edit:focus-visible {
  opacity: 1;
}

.task-nav-edit:hover {
  color: var(--text-strong);
  background: var(--bg-control-hover);
}

.task-nav-row:hover .task-nav-count {
  visibility: hidden;
}

/* List form pickers */

.list-form-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.list-preview-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--bg-accent-soft);
  color: var(--accent-text);
}

.list-form-name {
  flex: 1;
  min-width: 0;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
}

.swatch.active {
  border-color: var(--text-strong);
  box-shadow: 0 0 0 2px var(--bg-modal) inset;
}

.icon-pick-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.icon-pick {
  display: grid;
  place-items: center;
  height: 34px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-control);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.icon-pick:hover {
  color: var(--text-strong);
  border-color: var(--border-control);
}

.icon-pick.active {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.modal-footer-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.secondary-button.danger-text {
  color: var(--danger);
}

.secondary-button.danger-text:hover {
  background: var(--danger-soft);
}

.primary-button.small {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

/* ----------- TaskBoard: row meta, tags, quick dates ----------- */

.task-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.task-mini-tag {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent-text);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.task-mini-tag:hover {
  text-decoration: underline;
}

.tag.tag-clickable {
  border: 0;
  font: inherit;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tag.tag-clickable:hover {
  background: var(--bg-accent-soft);
  color: var(--accent-text);
}

.tag.tag-clickable.active {
  background: var(--accent);
  color: #ffffff;
}

.tag-filter-bar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.tag-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px 0 9px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--bg-accent-soft);
  color: var(--accent-text);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.tag-filter-pill:hover {
  background: var(--accent);
  color: #ffffff;
}

.due-block {
  display: grid;
  gap: 6px;
  align-content: start;
}

.due-quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.due-quick-chip {
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border-normal);
  border-radius: 999px;
  background: var(--bg-control);
  color: var(--text-muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.due-quick-chip:hover {
  border-color: var(--accent);
  color: var(--text-strong);
}

.due-quick-chip.clear {
  color: var(--text-faint);
}

/* ----------- TaskBoard: comments ----------- */

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

.comment-list {
  display: grid;
  gap: 8px;
}

.comment-row {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
}

.comment-body {
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-faint);
  font-size: 11px;
}

.comment-delete {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.comment-delete:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.comment-empty {
  margin: 0;
  color: var(--text-faint);
  font-size: 12.5px;
}

.comment-add {
  display: grid;
  gap: 8px;
}

.comment-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-control);
  color: var(--text-main);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 38px;
}

.comment-input:focus {
  border-color: var(--accent);
  background: var(--bg-panel-hover);
  outline: none;
}

.comment-add-actions {
  display: flex;
  justify-content: flex-end;
}

/* ----------- Modals ----------- */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
}

.modal-root[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  animation: fade-in 0.12s ease;
}

.modal-dialog {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-modal);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}

.modal-sm {
  max-width: 380px;
}

.modal-lg {
  max-width: 720px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 14px;
}

.modal-body {
  overflow-y: auto;
  padding: 16px;
}

.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-panel-soft);
}

.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* ----------- Forms ----------- */

.contact-form {
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.form-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-faint);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.required-mark {
  color: var(--danger);
  text-transform: none;
}

.form-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-control);
  color: var(--text-main);
  font: inherit;
  font-size: 13px;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.form-input:focus {
  border-color: var(--accent);
  background: var(--bg-panel-hover);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  color: var(--text-main);
  font-size: 13px;
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

.form-error {
  padding: 8px 10px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12.5px;
}

/* ----------- Confirm ----------- */

.confirm-body {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.confirm-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--danger);
  background: var(--danger-soft);
}

.confirm-body p {
  margin: 0;
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
}

/* ----------- Toasts ----------- */

.toast-root {
  position: fixed;
  right: 18px;
  bottom: 36px;
  display: grid;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-modal);
  color: var(--text-strong);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.16s ease;
}

.toast.error {
  color: var(--danger);
  border-color: var(--danger);
}

.toast.success [data-icon] {
  color: var(--success);
}

.toast.leaving {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

/* ----------- Statusbar ----------- */

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border-top: 1px solid var(--border-strong);
  color: var(--text-faint);
  background: var(--bg-ribbon);
  font-size: 11.5px;
}

/* ----------- Auth (lock & setup) ----------- */

.auth-view {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-app);
  z-index: 90;
}

.auth-view[hidden] {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  display: grid;
  gap: 14px;
  padding: 28px 28px 24px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.auth-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin: 0 auto 4px;
  border-radius: 50%;
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.auth-title {
  margin: 0;
  text-align: center;
  font-size: 18px;
  font-weight: 650;
}

.auth-subtitle {
  margin: -4px 0 4px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-submit {
  width: 100%;
  height: 36px;
  justify-content: center;
}

.auth-hint {
  margin: 0;
  color: var(--text-faint);
  font-size: 11.5px;
  text-align: center;
}

.auth-hint.warn {
  color: var(--text-muted);
}

.auth-hint.ok {
  color: var(--success);
}

.auth-footer-hint {
  margin: 4px 0 0;
  color: var(--text-disabled);
  font-size: 11.5px;
  text-align: center;
}

.password-field {
  position: relative;
}

.password-field .form-input {
  padding-right: 36px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.password-toggle:hover {
  color: var(--text-strong);
  background: var(--bg-panel-hover);
}

/* ----------- Credit Cards ----------- */

.credit-cards-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.credit-card-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.credit-cards-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 12px;
}

.credit-card-list-panel,
.credit-card-detail-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}

.credit-card-detail-panel {
  overflow: auto;
}

.credit-card-detail-panel.empty {
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-faint);
}

.credit-card-controls {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.credit-card-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.credit-card-list {
  min-height: 0;
  overflow: auto;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.credit-card-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.credit-card-row:hover,
.credit-card-row.selected {
  border-color: var(--accent);
  background: var(--bg-panel-hover);
}

.credit-card-row-top {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.credit-card-row-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.credit-card-row-title strong,
.credit-card-row-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-card-row-title strong {
  color: var(--text-strong);
  font-size: 13.5px;
}

.credit-card-row-title span,
.credit-card-row-meta {
  color: var(--text-faint);
  font-size: 12px;
}

.credit-card-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.credit-card-row-meta > span {
  min-width: 0;
}

.credit-card-hero {
  border-bottom: 1px solid var(--border-subtle);
}

.credit-util-panel {
  display: grid;
  gap: 10px;
  margin: 0 14px 14px;
  padding: 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel-soft);
}

.credit-util-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.credit-util-head h3 {
  margin: 0 0 4px;
  color: var(--text-strong);
  font-size: 14px;
}

.credit-util-head p {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
}

.util-value {
  color: var(--success);
}

.util-value.warn {
  color: var(--warn);
}

.util-value.bad {
  color: var(--danger);
}

.credit-util-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-control);
}

.credit-util-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
}

.credit-util-track span.warn {
  background: var(--warn);
}

.credit-util-track span.bad {
  background: var(--danger);
}

.security-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background: var(--bg-panel-soft);
  font-size: 12px;
  line-height: 1.45;
}

.security-note [data-icon] {
  flex: 0 0 auto;
  color: var(--accent-text);
  margin-top: 1px;
}

.credit-autopay-row {
  min-height: 61px;
  align-self: end;
  margin: 0;
}

/* ----------- Asset and document modules ----------- */

.finance-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
}

.asset-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.asset-kpi {
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.asset-kpi-icon,
.asset-row-icon,
.asset-file-icon,
.asset-hero-icon {
  display: grid;
  place-items: center;
  color: var(--accent-text);
  background: var(--bg-accent-soft);
  border-radius: var(--radius-md);
}

.asset-kpi-icon {
  width: 38px;
  height: 38px;
}

.asset-kpi > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.asset-kpi-label,
.asset-kpi small {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-kpi strong {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 17px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-kpi.tone-good .asset-kpi-icon,
.asset-kpi.tone-good > div > strong {
  color: var(--success);
}

.asset-kpi.tone-bad .asset-kpi-icon,
.asset-kpi.tone-bad > div > strong {
  color: var(--danger);
}

.asset-kpi.tone-warn .asset-kpi-icon,
.asset-kpi.tone-warn > div > strong {
  color: var(--warn);
}

.asset-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
  gap: 12px;
}

.asset-list-panel,
.asset-detail-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}

.asset-detail-panel {
  overflow: auto;
}

.asset-detail-panel.empty {
  align-items: center;
  justify-content: center;
}

.asset-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

.asset-panel-header h3,
.asset-panel-header p,
.asset-hero-title h3,
.asset-hero-title p {
  margin: 0;
}

.asset-panel-header h3 {
  color: var(--text-strong);
  font-size: 14px;
}

.asset-panel-header p,
.asset-hero-title p {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 11.5px;
}

.asset-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 0 12px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.asset-controls.stacked {
  grid-template-columns: 1fr;
}

.asset-search-input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-md);
  outline: none;
  color: var(--text-main);
  background: var(--bg-control);
}

.asset-search-input:focus {
  border-color: var(--accent);
}

.asset-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.asset-filter-row .task-filter-select {
  flex: 1 1 120px;
}

.asset-list-scroll {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow: auto;
}

.asset-row {
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  outline: none;
  background: var(--bg-panel-soft);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.asset-row:hover,
.asset-row.selected,
.asset-row:focus-visible {
  border-color: var(--accent);
  background: var(--bg-panel-hover);
}

.asset-row-top {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
}

.asset-row-icon,
.ticker-badge {
  width: 34px;
  height: 34px;
}

.ticker-badge {
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  color: var(--accent-text);
  background: var(--bg-accent-soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.asset-row-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.asset-row-title strong,
.asset-row-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-row-title strong {
  color: var(--text-strong);
  font-size: 13px;
}

.asset-row-title span,
.asset-row-meta {
  color: var(--text-faint);
  font-size: 11.5px;
}

.asset-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 10px;
}

.asset-row-meta strong {
  color: var(--text-main);
}

.row-favorite {
  color: var(--warn);
}

.asset-detail-hero {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 15px;
  border-bottom: 1px solid var(--border-subtle);
}

.asset-hero-icon {
  width: 44px;
  height: 44px;
}

.asset-hero-title {
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 4px;
}

.asset-hero-title h3 {
  overflow: hidden;
  max-width: 100%;
  color: var(--text-strong);
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.asset-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  padding: 14px;
}

.asset-metric {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  background: var(--bg-panel-soft);
}

.asset-metric > [data-icon] {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.asset-metric > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.asset-metric span,
.asset-metric strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-metric span {
  color: var(--text-faint);
  font-size: 10.5px;
}

.asset-metric strong {
  color: var(--text-strong);
  font-size: 12.5px;
}

.asset-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 14px 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.asset-info-grid .property-detail-section {
  border: 0;
  border-radius: 0;
}

.asset-info-grid .property-detail-section + .property-detail-section {
  border-left: 1px solid var(--border-subtle);
}

.asset-files-panel {
  margin: 0 14px 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.asset-file-list {
  display: grid;
}

.asset-file-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
}

.asset-file-icon {
  width: 34px;
  height: 34px;
}

.asset-file-row > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.asset-file-row strong,
.asset-file-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-file-row strong {
  color: var(--text-strong);
  font-size: 12.5px;
}

.asset-file-row > div span {
  color: var(--text-faint);
  font-size: 11px;
}

.portfolio-gain-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel-soft);
}

.portfolio-gain-banner > div {
  display: grid;
  gap: 3px;
}

.portfolio-gain-banner span {
  color: var(--text-faint);
  font-size: 11px;
}

.portfolio-gain-banner.positive > strong,
.portfolio-gain-banner.positive > div strong,
.gain-copy.positive {
  color: var(--success);
}

.portfolio-gain-banner.negative > strong,
.portfolio-gain-banner.negative > div strong,
.gain-copy.negative,
.expiry-copy.bad {
  color: var(--danger);
}

.expiry-copy.warn {
  color: var(--warn);
}

.asset-tags {
  padding: 0 14px 14px;
}

.selected-file-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-md);
  color: var(--accent-text);
  background: var(--bg-accent-soft);
}

.selected-file-banner > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.selected-file-banner strong,
.selected-file-banner span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-banner span {
  color: var(--text-faint);
  font-size: 11px;
}

.status-pill.overdue,
.status-pill.expired {
  color: var(--danger);
  background: var(--danger-soft);
}

.status-pill.pending,
.status-pill.paused {
  color: var(--warn);
  background: var(--warn-soft);
}

.status-pill.paid,
.status-pill.active {
  color: var(--success);
  background: var(--success-soft);
}

/* ----------- Holdings table (stocks / mutual funds) ----------- */

.holdings-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  overflow: hidden;
}

.holdings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.holdings-toolbar-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.holdings-toolbar-title h3 {
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 650;
}

.holdings-toolbar-title p {
  color: var(--text-faint);
  font-size: 11.5px;
}

.holdings-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.holdings-toolbar-controls .search-wrap {
  width: 240px;
}

.holdings-scroll {
  min-height: 0;
  overflow: auto;
}

.holdings-head,
.holdings-row {
  min-width: 960px;
  display: grid;
  grid-template-columns:
    minmax(200px, 1.8fr) 80px 112px 112px 120px 120px minmax(120px, 1fr) 76px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.holdings-head {
  position: sticky;
  z-index: 1;
  top: 0;
  color: var(--text-faint);
  background: var(--bg-panel-soft);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.holdings-row {
  min-height: 60px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.holdings-row:hover,
.holdings-row:focus-visible {
  background: var(--bg-panel-hover);
  outline: none;
}

.holdings-num {
  min-width: 0;
  text-align: right;
  color: var(--text-main);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holdings-muted {
  color: var(--text-faint);
}

.holdings-strong {
  color: var(--text-strong);
  font-weight: 600;
}

.holdings-instrument {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.holdings-instrument-text {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.holdings-instrument-text strong {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holdings-instrument-text span {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holdings-tag {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--accent-text);
  background: var(--bg-accent-soft);
  font-size: 10px;
  font-weight: 600;
}

.holdings-pnl {
  display: grid;
  gap: 1px;
  justify-items: end;
}

.holdings-pnl strong {
  font-size: 13px;
  font-weight: 600;
}

.holdings-pnl small {
  font-size: 11px;
}

.holdings-pnl.positive strong,
.holdings-pnl.positive small {
  color: var(--success);
}

.holdings-pnl.negative strong,
.holdings-pnl.negative small {
  color: var(--danger);
}

.holdings-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0;
  transition: opacity .12s ease;
}

.holdings-row:hover .holdings-row-actions,
.holdings-row:focus-within .holdings-row-actions {
  opacity: 1;
}

.holdings-scroll .empty-state.compact {
  min-height: 240px;
}

/* ----------- Responsive ----------- */

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .credit-card-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .asset-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .taskboard-layout {
    grid-template-columns: minmax(180px, 220px) minmax(300px, 380px) minmax(0, 1fr);
  }
  .task-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .contacts-pane {
    grid-template-columns: 1fr;
  }
  .contacts-summary,
  .properties-summary,
  .gold-summary,
  .rent-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .properties-layout,
  .gold-ledger-layout,
  .rent-ledger-layout,
  .credit-cards-layout,
  .asset-layout,
  .taskboard-layout,
  .dashboard-charts,
  .dashboard-lower {
    grid-template-columns: 1fr;
  }
  .property-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .asset-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .gold-detail-grid,
  .gold-info-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .shell {
    grid-template-columns: 42px minmax(0, 1fr);
  }
  h1 {
    font-size: 16px;
  }
  .view {
    padding: 14px;
  }
  .home-grid {
    grid-template-columns: 1fr;
  }
  .app-home-header {
    align-items: flex-start;
  }
  .app-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .property-detail-grid,
  .gold-detail-grid,
  .gold-info-section,
  .task-detail-grid,
  .properties-summary,
  .gold-summary,
  .rent-summary,
    .credit-card-kpis {
    grid-template-columns: 1fr;
  }
  .asset-kpi-grid,
  .asset-detail-grid,
  .asset-info-grid {
    grid-template-columns: 1fr;
  }
  .asset-info-grid .property-detail-section + .property-detail-section {
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
  }
  .asset-detail-hero {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .asset-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .asset-file-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }
  .asset-file-row .icon-only-button {
    grid-column: 3;
  }
  .holdings-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .holdings-toolbar-controls {
    flex-wrap: wrap;
  }
  .holdings-toolbar-controls .search-wrap {
    flex: 1;
    width: auto;
  }
  .holdings-row-actions {
    opacity: 1;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rent-tabbar {
    flex-wrap: wrap;
  }
  .rent-tabs {
    width: 100%;
    overflow-x: auto;
  }
  .rent-tab {
    flex: none;
  }
  .rent-collection-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .rent-search {
    width: 100%;
  }
  .donut-wrap {
    flex-direction: column;
    align-items: stretch;
  }
  .property-card-top,
  .lease-card-top {
    grid-template-columns: 34px minmax(0, 1fr);
  }
  .property-card-top .status-pill,
  .lease-card-top .status-pill {
    grid-column: 2;
  }
  .lease-terms-grid {
    grid-template-columns: 1fr;
  }
  .lease-terms-grid .property-detail-section + .property-detail-section {
    border-left: 0;
    border-top: 1px solid var(--border-subtle);
  }
  .modal-dialog {
    max-height: calc(100vh - 24px);
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .rent-collection-head {
    align-items: flex-start;
  }
  .rent-document-picker {
    align-items: stretch;
    flex-direction: column;
  }
}

/* ----------- Zerodha sync banner (Stocks / Mutual Funds) ----------- */

.zerodha-sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 14px;
  border: 1px solid var(--border-normal);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}

.zerodha-sync-banner-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.zerodha-sync-banner-info > [data-icon] {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  color: var(--accent-text);
  background: var(--bg-accent-soft);
  flex-shrink: 0;
}

.zerodha-sync-banner.connected .zerodha-sync-banner-info > [data-icon] {
  color: var(--success);
  background: var(--success-soft);
}

.zerodha-sync-banner-info > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.zerodha-sync-banner-info strong {
  overflow: hidden;
  color: var(--text-strong);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zerodha-sync-banner-info span {
  overflow: hidden;
  color: var(--text-faint);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zerodha-sync-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
