:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --ink: #17201d;
  --muted: #66736f;
  --line: #d9e1de;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --green-soft: #e7f5ee;
  --red: #b42318;
  --red-soft: #fff0ed;
  --amber: #8a5a00;
  --amber-soft: #fff7df;
  --shadow: 0 12px 30px rgba(23, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  overflow-x: hidden;
}

body.auth-pending .topbar,
body.auth-pending main,
body.auth-pending .app-shell {
  display: none;
}

.auth-screen {
  display: none;
  height: 100vh;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  padding: 12px 24px 10px;
  background:
    radial-gradient(circle at 18% 12%, rgba(15, 118, 110, 0.10), transparent 28%),
    radial-gradient(circle at 82% 86%, rgba(12, 72, 80, 0.08), transparent 32%),
    linear-gradient(135deg, #f7faf9 0%, #eef7f4 48%, #f8fbfa 100%);
}

body.auth-pending .auth-screen {
  display: flex;
}

.is-hidden {
  display: none !important;
}

.auth-shell {
  width: min(1440px, 100%);
  height: calc(100vh - 52px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(440px, 0.92fr);
  overflow: hidden;
  border: 1px solid rgba(217, 225, 222, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 80px rgba(23, 32, 29, 0.14);
}

.auth-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  min-height: 100%;
  padding: 34px clamp(40px, 4.8vw, 72px);
  color: #fff;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 96, 82, 0.96), rgba(0, 88, 84, 0.72)),
    linear-gradient(135deg, #005f54 0%, #1f6f76 50%, #dfe7e6 100%);
}

.auth-showcase::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.20;
  background:
    linear-gradient(110deg, rgba(0, 0, 0, 0) 0 54%, rgba(255, 255, 255, 0.26) 54% 70%, rgba(255, 255, 255, 0.08) 70% 100%),
    url("assets/real_trabzon_mark.svg") right 8% bottom 7% / min(620px, 76%) auto no-repeat;
}

.auth-showcase::after {
  content: "";
  position: absolute;
  right: -90px;
  bottom: -120px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  filter: blur(2px);
}

.auth-showcase > * {
  position: relative;
  z-index: 1;
}

.auth-showcase-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auth-showcase-brand img {
  width: 64px;
  height: 64px;
  display: block;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

.auth-showcase-brand strong {
  display: block;
  font-size: 23px;
  letter-spacing: 0;
}

.auth-showcase-brand span {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.auth-showcase-copy {
  max-width: 520px;
}

.auth-showcase-copy h2 {
  margin: 0;
  font-size: clamp(34px, 3.6vw, 46px);
  line-height: 1.14;
}

.auth-showcase-copy p {
  max-width: 470px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.90);
  font-size: 17px;
  line-height: 1.55;
}

.auth-feature-list {
  display: grid;
  gap: 18px;
  max-width: 520px;
}

.auth-feature {
  display: grid;
  grid-template-columns: 54px 1fr;
  align-items: center;
  gap: 18px;
}

.auth-feature > span {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(14, 162, 145, 0.82);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
}

.auth-feature svg {
  width: 25px;
  height: 25px;
}

.auth-feature strong {
  display: block;
  font-size: 17px;
}

.auth-feature p {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.45;
}

.auth-feature b {
  display: inline-block;
  margin-top: 9px;
  font-size: 20px;
}

.auth-card {
  align-self: center;
  justify-self: center;
  width: min(540px, calc(100% - 38px));
  height: calc(100% - 34px);
  max-height: 780px;
  display: grid;
  align-content: center;
  gap: 9px;
  overflow: hidden;
  padding: 20px 48px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(217, 225, 222, 0.86);
  border-radius: 18px;
  box-shadow: 0 22px 62px rgba(23, 32, 29, 0.12);
  backdrop-filter: blur(14px);
}

.auth-brand {
  display: grid;
  place-items: center;
  padding: 0 8px;
}

.auth-logo {
  width: min(138px, 48%);
  max-height: 138px;
  height: auto;
  display: block;
  border-radius: 10px;
  object-fit: contain;
}

.auth-heading {
  display: grid;
  gap: 4px;
  text-align: center;
}

.auth-card h1 {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 25px;
  line-height: 1.15;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
}

.auth-field {
  position: relative;
  display: grid;
  gap: 8px;
}

.auth-field span {
  color: #465451;
  font-weight: 600;
}

.auth-card input {
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.auth-card input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.62);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.11);
}

.auth-card .primary-btn {
  order: 20;
  min-height: 46px;
  margin-top: 2px;
  font-weight: 700;
  border-radius: 8px;
  font-size: 16px;
}

.resident-apply-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.auth-switch {
  order: 30;
  display: grid;
  gap: 6px;
  justify-content: stretch;
  text-align: center;
}

.auth-switch::before {
  content: "veya";
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
}

.auth-switch::before {
  background:
    linear-gradient(var(--line), var(--line)) left center / calc(50% - 28px) 1px no-repeat,
    linear-gradient(var(--line), var(--line)) right center / calc(50% - 28px) 1px no-repeat;
}

.auth-switch .ghost-btn {
  min-height: 44px;
  justify-content: center;
  border-color: rgba(15, 118, 110, 0.45);
  color: var(--teal);
  font-weight: 800;
}

.auth-security-note {
  order: 40;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.auth-security-note > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #edf5f2;
  color: var(--teal);
}

.auth-security-note strong {
  display: block;
  margin-bottom: 4px;
}

.auth-security-note p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.auth-footer {
  width: min(1280px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 24px;
  color: var(--muted);
  font-size: 13px;
}

.auth-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.auth-footer a {
  color: var(--muted);
  text-decoration: none;
}

.auth-footer a:hover {
  color: var(--teal);
}

button,
input,
select,
textarea {
  font: inherit;
}

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

.app-content {
  min-width: 0;
}

.side-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 16px 10px;
  background: #0b2a2d;
  color: #fff;
  box-shadow: 12px 0 30px rgba(2, 16, 18, 0.18);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #eff7f4;
  overflow: hidden;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 10px 22px rgba(0, 0, 0, 0.18);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-mark:hover,
.brand-mark:focus-visible,
.brand-mark.active {
  outline: none;
  box-shadow: 0 0 0 3px rgba(217, 165, 33, 0.72), 0 10px 22px rgba(0, 0, 0, 0.20);
}

.nav-stack {
  width: 100%;
  display: grid;
  gap: 10px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 86px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  max-width: 220px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #f8faf9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  font-weight: 700;
}

h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

#dbStatus {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px 28px 36px;
  overflow-x: hidden;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dashboard-only {
  display: none;
}

body.dashboard-view .summary-grid.dashboard-only {
  display: grid;
}

body.dashboard-view .bank-admin-panel.dashboard-only {
  display: block;
}

.debt-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.view-tab {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.icon-button {
  position: relative;
  width: 56px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.74);
  background: transparent;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.25;
}

.icon-button i {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 11px;
  font-weight: 900;
}

.icon-button::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px -10px;
  width: 4px;
  border-radius: 999px;
  background: transparent;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  outline: none;
}

.icon-button.active {
  color: #fff;
  background: rgba(19, 127, 114, 0.95);
}

.icon-button.active::before {
  background: #d9a521;
}

.icon-button span {
  position: absolute;
  left: 68px;
  top: 50%;
  z-index: 40;
  transform: translateY(-50%) translateX(-4px);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #102b2f;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.icon-button:hover span,
.icon-button:focus-visible span {
  opacity: 1;
  transform: translateY(-50%);
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
}

.metric,
.mini-metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric,
.mini-metric {
  min-height: 88px;
  padding: 16px;
  border-radius: 8px;
}

.metric span,
.mini-metric span,
.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 24px;
}

.mini-metric strong {
  font-size: 22px;
}

.mini-metric.clickable {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.mini-metric.clickable:hover {
  border-color: var(--teal);
}

.mini-metric.clickable.active-filter {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14), var(--shadow);
}

.metric.danger {
  background: var(--red-soft);
  border-color: #ffd0c9;
}

.metric.bank {
  background: #eef8f7;
  border-color: #b8e2dd;
}

.bank-admin-panel {
  margin-top: 12px;
}

.bank-balance-form {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(220px, 300px) auto;
  align-items: end;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.bank-balance-form p:not(.section-kicker) {
  color: var(--muted);
  margin-top: 4px;
}

.bank-balance-form .primary-btn {
  min-height: 46px;
  padding-inline: 18px;
}

.mini-metric.warning {
  background: var(--amber-soft);
  border-color: #f3d17b;
}

.mini-metric.overpay {
  background: #eef8f7;
  border-color: #b8e2dd;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.apartment-grid {
  display: block;
}

.apartment-workspace {
  display: grid;
  gap: 16px;
}

.apartment-detail-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(460px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.apartment-list-panel {
  padding-bottom: 12px;
}

.user-admin-panel {
  display: grid;
  gap: 16px;
}

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

.panel-separator {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.user-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.resident-panel {
  display: grid;
  gap: 16px;
}

.resident-section-head {
  padding-top: 6px;
}

.resident-debt-notice {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.resident-debt-notice strong {
  font-size: 15px;
}

.resident-debt-notice span {
  color: var(--muted);
}

.resident-debt-notice.warning {
  color: var(--red);
  border-color: #ffc9c0;
  background: var(--red-soft);
}

.resident-debt-notice.warning span {
  color: #7a271a;
}

.resident-debt-notice.ok {
  color: var(--teal-dark);
  border-color: #bde8dc;
  background: var(--green-soft);
}

.resident-apartment-selector {
  max-width: 360px;
}

.resident-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.resident-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

.resident-form-grid .form-actions {
  grid-column: span 2;
}

.resident-application-wrap table {
  min-width: 1260px;
}

.resident-month-wrap table {
  min-width: 720px;
}

.month-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: #f3f6f5;
  font-size: 12px;
  font-weight: 700;
}

.month-status.paid {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.month-status.late {
  color: var(--red);
  background: var(--red-soft);
}

.month-status.pending {
  color: var(--amber);
  background: var(--amber-soft);
}

.resident-application-wrap input,
.resident-application-wrap textarea {
  width: 100%;
  min-width: 120px;
}

.resident-application-wrap textarea {
  min-width: 170px;
  min-height: 42px;
  resize: vertical;
}

.resident-application-wrap .row-actions {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  justify-content: stretch;
  gap: 6px;
  min-width: 96px;
}

.resident-application-wrap .row-actions button {
  width: 100%;
  min-height: 34px;
  white-space: nowrap;
}

.application-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
  background: #f3f6f5;
}

.application-status.pending {
  color: var(--amber);
  background: var(--amber-soft);
}

.application-status.approved {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.application-status.rejected {
  color: var(--red);
  background: var(--red-soft);
}

.user-form-grid .check-row,
.user-form-grid .form-actions {
  align-self: center;
}

@media (max-width: 900px) {
  .user-form-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

.apartment-list-panel .table-wrap {
  max-height: 330px;
}

.section-kicker {
  margin-bottom: 4px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

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

.wide-field {
  grid-column: span 2;
}

.apartment-table-wrap table {
  min-width: 1180px;
}

.apartment-table-wrap th,
.apartment-table-wrap td {
  white-space: normal;
}

.apartment-table-wrap td:nth-child(2),
.apartment-table-wrap td:nth-child(3),
.apartment-table-wrap td:nth-child(6),
.apartment-table-wrap td:nth-child(7) {
  min-width: 180px;
}

.selected-resident,
.finance-resident {
  border-left: 4px solid var(--teal);
}

.plate-box {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.plate-box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.plate-box-head span {
  color: var(--muted);
  font-size: 12px;
}

.finance-status-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.apartment-payment-wrap .mini-table {
  min-width: 430px;
}

.selectable-row {
  cursor: pointer;
}

.selectable-row:hover {
  background: #f4fbf9;
}

.selectable-row.active {
  background: #e7f5ee;
}

.panel {
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

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

.top-actions,
.form-actions,
.filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.ghost-btn,
.primary-btn,
.segment {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 36px;
  cursor: pointer;
}

.icon-btn {
  width: 40px;
  font-size: 18px;
}

.ghost-btn {
  padding: 0 12px;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0 16px;
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--teal-dark);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segment {
  border: 0;
  border-radius: 0;
  background: #fff;
}

.segment.active {
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  outline-offset: 1px;
}

textarea {
  resize: vertical;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 2px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.check-row span {
  color: var(--ink);
  font-size: 13px;
}

.resident {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfa;
  margin-bottom: 12px;
}

.resident span {
  color: var(--muted);
}

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

.status-grid div {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.status-grid strong {
  font-size: 18px;
}

.table-wrap,
.mini-table-wrap {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.mini-table {
  min-width: 580px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8faf9;
  color: #43504c;
  font-size: 12px;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.num {
  text-align: right;
}

.actions {
  width: 120px;
}

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

.row-actions button {
  width: 34px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.plate-entry {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.plate-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.plate-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.plate-chip button {
  width: 24px;
  min-height: 24px;
  border: 0;
  border-radius: 4px;
  background: var(--red-soft);
  color: var(--red);
  cursor: pointer;
}

.badge {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.income {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.badge.expense {
  color: var(--red);
  background: var(--red-soft);
}

.status-pill {
  display: inline-flex;
  min-width: 84px;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.legal {
  color: var(--red);
  background: var(--red-soft);
}

.status-pill.debtor {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-pill.clear {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.status-pill.overpay {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.list-head {
  align-items: flex-start;
}

.records-list-head {
  flex-direction: column;
  align-items: stretch;
}

.records-list-head h2 {
  margin-bottom: 4px;
}

.filters {
  width: min(520px, 100%);
}

.filters input {
  min-width: 240px;
}

.filters select {
  width: 130px;
}

.records-filters {
  width: 100%;
  max-width: 100%;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.records-filters input[type="search"] {
  flex: 1 1 260px;
  min-width: 220px;
}

.records-filters input[type="date"] {
  flex: 0 0 150px;
  min-width: 150px;
}

.records-filters select {
  flex: 0 0 120px;
  width: 120px;
}

.records-filters .pdf-btn {
  flex: 0 0 auto;
}

.pdf-btn {
  white-space: nowrap;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.month-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.month-card strong {
  display: block;
  margin-bottom: 8px;
}

.month-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #17201d;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  background: var(--red);
}

.print-report {
  display: none;
}

.print-report-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #cbd5d1;
}

.print-report h1 {
  margin: 0 0 4px;
  font-size: 15px;
}

.print-report p {
  color: #53605c;
}

.print-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.print-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.print-summary div {
  border: 1px solid #d9e1de;
  border-radius: 4px;
  padding: 5px 6px;
}

.print-info-grid div {
  border: 1px solid #d9e1de;
  border-radius: 4px;
  padding: 5px 6px;
}

.print-summary span {
  display: block;
  color: #53605c;
  font-size: 8px;
}

.print-info-grid span {
  display: block;
  color: #53605c;
  font-size: 8px;
}

.print-summary strong {
  font-size: 10px;
}

.print-info-grid strong {
  font-size: 9px;
}

.print-section-title {
  margin: 8px 0 5px;
  font-size: 11px;
}

.print-debt-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.print-debt-table th,
.print-debt-table td {
  padding: 3px 4px;
  border: 1px solid #d9e1de;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.print-debt-table th {
  background: #eef4f2;
  color: #17201d;
  font-weight: 800;
}

.print-debt-table .num {
  white-space: nowrap;
}

.print-col-status {
  width: 9%;
}

.print-col-daire {
  width: 5%;
}

.print-col-kisi {
  width: 16%;
}

.print-col-ay-sayi {
  width: 7%;
}

.print-col-aylar {
  width: 13%;
}

.print-col-money {
  width: 9%;
}

.print-apartment-table {
  margin-bottom: 8px;
}

.print-payment-table th:nth-child(1),
.print-payment-table td:nth-child(1) {
  width: 12%;
}

.print-payment-table th:nth-child(2),
.print-payment-table td:nth-child(2) {
  width: 10%;
}

.print-payment-table th:nth-child(5),
.print-payment-table td:nth-child(5) {
  width: 14%;
}

.print-record-date {
  width: 9%;
}

.print-record-kind {
  width: 7%;
}

.print-record-apartment {
  width: 7%;
}

.print-record-description {
  width: 35%;
}

.print-record-person {
  width: 16%;
}

.print-record-money {
  width: 13%;
}

.print-records-table th,
.print-records-table td {
  font-size: 8px;
  padding: 2px 3px;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  body.printing-debt-report {
    background: #fff;
    color: #17201d;
    font-size: 9px;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body.printing-debt-report > .app-shell,
  body.printing-debt-report > header,
  body.printing-debt-report > main,
  body.printing-debt-report > .toast {
    display: none;
  }

  body.printing-debt-report .print-report {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: visible;
  }
}

@media (max-width: 980px) {
  .auth-screen {
    padding: 18px;
  }

  .auth-shell {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .auth-showcase {
    min-height: 360px;
    padding: 36px;
  }

  .auth-showcase-copy h2 {
    font-size: 34px;
  }

  .auth-feature-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
    gap: 18px;
  }

  .auth-feature {
    align-items: start;
  }

  .auth-card {
    width: min(620px, calc(100% - 36px));
    max-height: none;
    margin: 24px 0;
  }

  .auth-footer {
    padding: 0 12px;
  }

  .summary-grid,
  .debt-summary-grid,
  .work-grid,
  .apartment-detail-grid,
  .apartment-form-grid,
  .bank-balance-form,
  .resident-status-grid,
  .resident-form-grid,
  .status-grid,
  .month-grid {
    grid-template-columns: 1fr 1fr;
  }

  .apartment-detail-grid {
    grid-template-columns: 1fr;
  }

  .work-grid {
    align-items: stretch;
  }
}

@media (min-width: 981px) and (max-height: 900px) {
  .auth-screen {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .auth-shell {
    height: calc(100vh - 40px);
  }

  .auth-showcase {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .auth-showcase-copy h2 {
    font-size: clamp(30px, 3.2vw, 40px);
  }

  .auth-showcase-copy p {
    margin-top: 14px;
    font-size: 16px;
  }

  .auth-feature-list {
    gap: 14px;
  }

  .auth-feature > span {
    width: 44px;
    height: 44px;
  }

  .auth-card {
    height: calc(100% - 24px);
    gap: 7px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .auth-logo {
    width: min(112px, 42%);
    max-height: 112px;
  }

  .auth-card h1 {
    font-size: 23px;
  }

  .auth-card input,
  .auth-card .primary-btn,
  .auth-switch .ghost-btn {
    min-height: 42px;
  }

  .auth-security-note {
    padding: 8px 10px;
  }
}

@media (max-width: 680px) {
  .app-shell {
    display: block;
  }

  .side-bar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    padding: 8px 12px;
    gap: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
  }

  .nav-stack {
    display: flex;
    gap: 6px;
    width: auto;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .icon-button {
    width: 46px;
    height: 44px;
    flex: 0 0 auto;
  }

  .icon-button::before,
  .icon-button span {
    display: none;
  }

  .auth-screen {
    padding: 18px;
  }

  .auth-shell {
    width: 100%;
    display: block;
    border-radius: 12px;
  }

  .auth-showcase {
    display: none;
  }

  .auth-card {
    width: 100%;
    margin: 0;
    padding: 24px;
    gap: 15px;
    border-radius: 12px;
    box-shadow: none;
  }

  .auth-logo {
    width: min(220px, 78%);
  }

  .auth-card h1 {
    font-size: 23px;
  }

  .resident-apply-fields {
    grid-template-columns: 1fr;
  }

  .auth-security-note {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .auth-security-note > span {
    margin: 0 auto;
  }

  .auth-footer {
    display: grid;
    justify-items: center;
    text-align: center;
    padding: 0 4px;
  }

  .auth-footer nav {
    justify-content: center;
    gap: 10px 14px;
  }

  .topbar,
  main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .summary-grid,
  .debt-summary-grid,
  .work-grid,
  .apartment-detail-grid,
  .apartment-form-grid,
  .bank-balance-form,
  .resident-status-grid,
  .resident-form-grid,
  .status-grid,
  .month-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

  .list-head,
  .filters {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filters input,
  .filters select {
    width: 100%;
    min-width: 0;
  }

  .pdf-btn {
    width: 100%;
  }

  .plate-entry {
    grid-template-columns: 1fr;
  }

  .wide-field {
    grid-column: span 1;
  }

  .resident-form-grid .form-actions {
    grid-column: span 1;
  }
}
