:root {
  --ink: #121416;
  --ink-2: #1c2023;
  --ink-3: #2d3135;
  --paper: #f7f5f1;
  --surface: #ffffff;
  --surface-soft: #f1eee8;
  --line: #e2ddd3;
  --muted: #6c6860;
  --gold: #a07a4b;
  --gold-dark: #74502a;
  --gold-soft: #e7dccb;
  --bordeaux: #8f283f;
  --bordeaux-soft: #f6dce2;
  --success: #2d7353;
  --success-soft: #dff0e8;
  --blue: #2f6f9f;
  --blue-soft: #dcebf3;
  --shadow: 0 20px 48px rgba(28, 24, 19, 0.11);
  --shadow-soft: 0 10px 28px rgba(28, 24, 19, 0.07);
  --radius: 8px;
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 70% 12%, rgba(160, 122, 75, 0.18), transparent 30%),
    linear-gradient(135deg, #101214 0%, #1c2023 42%, #efebe3 42%, #f7f5f1 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

button:focus {
  outline: none;
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.login-shell {
  padding: 0;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(500px, 1fr) minmax(520px, 0.92fr);
  background: #0d1012;
  overflow: hidden;
}

.login-brand {
  position: relative;
  min-height: 100vh;
  color: #fff;
  padding: clamp(34px, 6vw, 88px);
  isolation: isolate;
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    url("/assets/login-building-bg.webp") center center / cover no-repeat,
    linear-gradient(145deg, #080a0b 0%, #151719 48%, #08090a 100%);
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 23% 28%, rgba(247, 220, 176, 0.3), transparent 26%),
    linear-gradient(90deg, rgba(8, 10, 11, 0.88), rgba(8, 10, 11, 0.62) 44%, rgba(8, 10, 11, 0.48)),
    linear-gradient(180deg, rgba(8, 10, 11, 0.1), rgba(8, 10, 11, 0.86));
  background-size:
    auto,
    auto,
    auto;
}

.brand-lockup,
.brand-copy {
  position: relative;
  z-index: 1;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(160, 122, 75, 0.35));
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
}

.brand-mark svg {
  width: 42px;
  height: 42px;
}

.brand-mark img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
}

.brand-name span {
  color: #cfb486;
}

.brand-copy h1 {
  margin: 0 0 12px;
  max-width: 520px;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand-copy p {
  margin: 0;
  max-width: 520px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.65;
}

.login-brand-content {
  min-height: calc(100vh - clamp(68px, 12vw, 176px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  gap: 36px;
}

.login-logo-stack {
  width: min(620px, 100%);
  justify-self: center;
  margin-top: 2vh;
  text-align: center;
}

.login-brand-markframe {
  width: min(760px, 100%);
  max-width: 760px;
  margin: 0 auto;
}

.login-brand-markimg {
  display: block;
  width: 100%;
  height: auto;
  filter: brightness(1.03) contrast(1.01);
}

.feature-list {
  width: min(520px, 100%);
  align-self: end;
  display: grid;
  gap: 28px;
  margin-bottom: 26px;
}

.feature-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.feature-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: #c7a577;
  box-shadow: inset 0 0 0 1px rgba(160, 122, 75, 0.16);
}

.feature-icon .icon-svg {
  width: 30px;
  height: 30px;
}

.feature-item strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.feature-item span {
  display: block;
  max-width: 350px;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.45;
}

.login-footer-links {
  width: min(520px, 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
}

.login-footer-links span {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, 0.24);
}

.login-panel {
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.86), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 238, 232, 0.82));
  padding: clamp(28px, 5vw, 70px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 640px;
  min-height: min(760px, calc(100vh - 80px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(18, 20, 22, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92)),
    #fff;
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.2);
  padding: clamp(34px, 5vw, 68px);
}

.eyebrow {
  color: var(--gold-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-card h2,
.page-title h1,
.section-title h2,
.modal-title h2 {
  margin: 8px 0 8px;
  letter-spacing: 0;
}

.auth-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 3vw, 48px);
  line-height: 1.05;
  text-align: center;
}

.auth-card p,
.page-title p,
.muted {
  color: var(--muted);
  line-height: 1.55;
}

.auth-copy {
  margin-bottom: 34px;
  text-align: center;
}

.auth-copy p {
  max-width: 330px;
  margin: 12px auto 0;
  font-size: 17px;
}

.auth-tabs,
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  margin: 24px 0;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-tab,
.segment {
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 10px 15px;
  color: var(--muted);
  font-weight: 700;
}

.auth-tab.active,
.segment.active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 18px rgba(18, 20, 22, 0.18);
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #37322c;
  font-size: 13px;
  font-weight: 800;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--ink);
  line-height: 1.5;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--gold);
  flex: 0 0 auto;
}

.checkbox-row span {
  display: block;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: 0;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.field textarea {
  resize: vertical;
  min-height: 104px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(160, 122, 75, 0.82);
  box-shadow: 0 0 0 4px rgba(160, 122, 75, 0.14);
}

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

.auth-form .form-grid {
  gap: 22px;
}

.auth-form .field label {
  color: #171717;
  font-size: 15px;
  font-weight: 850;
}

.input-shell {
  min-height: 58px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #d9d4cc;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0 16px;
  color: #8f8b84;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.input-shell:focus-within {
  border-color: rgba(160, 122, 75, 0.82);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(160, 122, 75, 0.12);
}

.input-shell input {
  min-height: 56px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.input-shell input:focus {
  box-shadow: none;
}

.input-shell input::placeholder {
  color: #a6a19a;
}

.input-action {
  display: grid;
  place-items: center;
  color: #77736d;
}

.input-action .icon-svg {
  width: 21px;
  height: 21px;
}

.forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -8px;
}

.forgot-row button,
.auth-switch button,
.demo-strip button {
  border: 0;
  background: transparent;
  color: var(--gold-dark);
  padding: 0;
  font-weight: 750;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 15px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible,
.nav button:focus-visible,
.card-link:focus-visible,
.mail-folder:focus-visible,
.mail-row:focus-visible {
  outline: 2px solid rgba(160, 122, 75, 0.34);
  outline-offset: 2px;
}

.btn.primary {
  background: linear-gradient(135deg, #1b1d1f, #050607);
  color: #fff;
  box-shadow: 0 18px 34px rgba(18, 20, 22, 0.18);
}

.btn.gold {
  background: linear-gradient(135deg, #b58b56, #76532d);
  color: #fff;
  box-shadow: 0 16px 30px rgba(116, 80, 42, 0.2);
}

.btn.ghost {
  border-color: var(--line);
  color: var(--gold-dark);
  background: rgba(255, 255, 255, 0.68);
}

.btn.ghost.danger {
  border-color: rgba(143, 40, 63, 0.18);
  color: var(--bordeaux);
  background: rgba(246, 220, 226, 0.5);
}

.btn.icon {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.btn.wide {
  width: 100%;
  min-height: 60px;
  font-size: 20px;
}

.btn.tenant-login {
  border-color: rgba(160, 122, 75, 0.68);
  background: rgba(255, 255, 255, 0.7);
  color: #181818;
  box-shadow: none;
}

.login-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  color: #8a857e;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.auth-switch {
  margin: 2px 0 0;
  text-align: center;
  color: var(--muted);
}

.auth-switch button {
  margin-left: 8px;
  font-size: inherit;
}

.demo-strip {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 20px;
  font-size: 12px;
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.demo-login {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  text-align: left;
}

.demo-login strong {
  display: block;
  font-size: 14px;
}

.demo-login span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.workspace {
  min-height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  overflow: hidden;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 36%),
    #121619;
  color: #fff;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar .brand-lockup {
  margin: 0;
}

.sidebar .brand-mark {
  width: 50px;
  height: 50px;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.sidebar .brand-name {
  font-size: 28px;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(160, 122, 75, 0.18);
  color: #e8d4b2;
  font-size: 12px;
  font-weight: 800;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  padding: 10px 13px;
  text-align: left;
  font-weight: 750;
}

.nav button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav button.active {
  background: linear-gradient(135deg, rgba(176, 136, 83, 0.94), rgba(108, 78, 42, 0.94));
  color: #fff;
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.22);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.account-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #b58b56, #76532d);
  color: #fff;
  font-weight: 900;
}

.account-card strong,
.account-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-card span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 30px;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-title h1 {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.alert-button {
  position: relative;
}

.alert-button .count {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

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

.card,
.metric-card,
.panel,
.table-panel {
  border: 1px solid rgba(226, 221, 211, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  min-height: 158px;
  padding: 22px;
  display: grid;
  align-content: space-between;
  gap: 22px;
}

.metric-main {
  display: flex;
  gap: 16px;
  align-items: center;
}

.metric-icon,
.soft-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--gold-dark);
}

.metric-value {
  font-size: 32px;
  line-height: 1;
  font-weight: 900;
}

.metric-label {
  margin-top: 5px;
  font-weight: 850;
}

.metric-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-dark);
  padding: 0;
  width: fit-content;
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.panel,
.table-panel {
  min-width: 0;
  padding: 22px;
}

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

.section-title h2 {
  font-size: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--surface-soft);
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.badge.danger,
.badge.dringend,
.badge.neu {
  background: var(--bordeaux-soft);
  color: var(--bordeaux);
}

.badge.normal,
.badge.pruefung,
.badge.beauftragt,
.badge.reserviert,
.badge.renovierung {
  background: #f7ead9;
  color: #85572d;
}

.badge.low,
.badge.niedrig,
.badge.erledigt,
.badge.vermietet,
.badge.active,
.badge.frei {
  background: var(--success-soft);
  color: var(--success);
}

.badge.abgelehnt,
.badge.inactive,
.badge.gesperrt {
  background: #ece8e3;
  color: #635d55;
}

.list {
  display: grid;
}

.row-item,
.doc-item,
.activity-item {
  display: grid;
  gap: 10px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.row-item-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
}

.row-item-button:hover {
  background: rgba(160, 122, 75, 0.08);
}

.row-item:first-child,
.doc-item:first-child,
.activity-item:first-child {
  border-top: 0;
}

.defect-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
}

.doc-item {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
}

.doc-link {
  color: inherit;
  text-decoration: none;
}

.doc-link:hover {
  background: rgba(255, 255, 255, 0.68);
}

.file-type {
  width: 38px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(135deg, #d84955, #b72938);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.file-type.docx {
  background: linear-gradient(135deg, #4c9ad2, #2f6f9f);
}

.file-type.img {
  background: linear-gradient(135deg, #6d8a74, #44614c);
}

.file-type.defect {
  background: linear-gradient(135deg, #a07a4b, #74502a);
}

.file-type.defect .icon-svg {
  width: 18px;
  height: 18px;
}

.item-title {
  font-weight: 850;
}

.item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.item-side {
  text-align: right;
  color: var(--gold-dark);
  font-size: 13px;
  font-weight: 800;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

.data-table th {
  color: #5e594f;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.data-table td.actions-cell {
  text-align: right;
  white-space: nowrap;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.documents-shell {
  display: grid;
  gap: 16px;
}

.documents-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.document-filters {
  display: grid;
  gap: 14px;
}

.document-search {
  min-width: 0;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(241, 238, 232, 0.78);
  color: var(--muted);
  padding: 0 16px;
}

.document-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  outline: none;
}

.document-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.documents-stage {
  min-height: calc(100vh - 300px);
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.18fr);
  border: 1px solid rgba(226, 221, 211, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.document-list,
.document-detail {
  min-height: 0;
  overflow: auto;
}

.document-list {
  border-right: 1px solid var(--line);
  background: rgba(252, 251, 248, 0.78);
}

.document-list-empty {
  padding: 20px;
}

.document-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 16px 18px;
  text-align: left;
}

.document-row:hover {
  background: rgba(255, 255, 255, 0.78);
}

.document-row.active {
  background: rgba(160, 122, 75, 0.14);
}

.document-row-main {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.document-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.document-detail {
  padding: 24px;
  background: rgba(255, 255, 255, 0.9);
}

.document-detail.empty {
  display: grid;
  place-items: center;
}

.document-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.document-detail-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.document-detail-head p {
  margin: 8px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.inline-select {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.inline-select select {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
}

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

.document-preview-shell {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(241, 238, 232, 0.4);
  overflow: hidden;
}

.document-preview-object {
  display: block;
  width: 100%;
  min-height: 680px;
  background: #fff;
}

.defect-description {
  margin-top: 20px;
}

.defect-photo-section,
.defect-history {
  margin-top: 24px;
}

.defect-photo-section h3,
.defect-history h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.defect-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.defect-photo-card {
  display: grid;
  gap: 8px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-soft);
}

.defect-photo-card img {
  width: 100%;
  aspect-ratio: 1.25;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: rgba(241, 238, 232, 0.7);
}

.defect-photo-card span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.document-preview-frame {
  width: 100%;
  min-height: 680px;
  border: 0;
  background: #fff;
}

.document-preview-image {
  display: block;
  width: 100%;
  max-height: 720px;
  object-fit: contain;
  background: #fff;
}

.document-preview-empty {
  padding: 22px;
}

.mail-app {
  min-height: calc(100vh - 215px);
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  border: 1px solid rgba(226, 221, 211, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.mail-nav {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 20px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent 32%),
    rgba(244, 240, 233, 0.92);
  border-right: 1px solid var(--line);
}

.mail-compose {
  width: 100%;
  justify-content: flex-start;
  min-height: 48px;
}

.mail-folder-group {
  display: grid;
  gap: 4px;
}

.mail-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
}

.mail-folder:hover {
  background: rgba(255, 255, 255, 0.72);
}

.mail-folder.active {
  background: linear-gradient(135deg, rgba(176, 136, 83, 0.18), rgba(116, 80, 42, 0.16));
  color: var(--gold-dark);
}

.mail-folder-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mail-folder-count {
  min-width: 24px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mailbox-summary {
  display: grid;
  gap: 6px;
  padding: 16px 14px;
  border-radius: 8px;
  border: 1px solid rgba(160, 122, 75, 0.16);
  background: rgba(255, 255, 255, 0.72);
}

.mailbox-summary-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.mailbox-summary strong {
  overflow-wrap: anywhere;
}

.mailbox-summary span {
  color: var(--muted);
  font-size: 13px;
}

.mail-content {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.mail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.mail-search {
  min-width: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(241, 238, 232, 0.78);
  color: var(--muted);
  padding: 0 16px;
}

.mail-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  outline: none;
}

.mail-search input::placeholder {
  color: #858178;
}

.mail-toolbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mail-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.18fr);
}

.mail-list,
.mail-reader {
  min-height: 0;
  overflow: auto;
}

.mail-list {
  border-right: 1px solid var(--line);
  background: rgba(252, 251, 248, 0.78);
}

.mail-list-empty {
  padding: 20px;
}

.mail-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 16px 18px;
  text-align: left;
  transition: background 0.15s ease;
}

.mail-row:hover {
  background: rgba(255, 255, 255, 0.78);
}

.mail-row.active {
  background: rgba(160, 122, 75, 0.14);
}

.mail-row.unread strong,
.mail-row.unread .mail-row-subject > span:first-child {
  font-weight: 900;
}

.mail-row-top,
.mail-row-subject {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.mail-row-top strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.mail-row-top span,
.mail-row-preview {
  color: var(--muted);
  font-size: 13px;
}

.mail-row-subject {
  margin-top: 4px;
}

.mail-row-subject > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.mail-row-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.mail-row-preview {
  margin-top: 6px;
  line-height: 1.45;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.mail-reader {
  padding: 24px;
  background: rgba(255, 255, 255, 0.9);
}

.mail-reader.empty {
  display: grid;
  place-items: center;
}

.mail-reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mail-reader-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.mail-reader-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.mail-reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.mail-meta-chip {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(241, 238, 232, 0.56);
  padding: 12px 14px;
}

.mail-meta-chip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.mail-reader-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 14px;
  margin-top: 20px;
}

.mail-reader-controls .field {
  gap: 8px;
}

.mail-reader-controls .field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.mail-reader-body {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.mail-reader-body p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.7;
}

.mail-reader-modebar {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(241, 238, 232, 0.7);
}

.mail-reader-mode {
  min-width: 112px;
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}

.mail-reader-mode.active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 24px rgba(18, 20, 22, 0.16);
}

.mail-html-view {
  display: grid;
  gap: 14px;
  color: var(--ink);
  line-height: 1.7;
}

.mail-html-view div,
.mail-html-view section,
.mail-html-view article,
.mail-html-view span {
  display: contents;
}

.mail-html-view > :first-child {
  margin-top: 0;
}

.mail-html-view > :last-child {
  margin-bottom: 0;
}

.mail-html-view p,
.mail-html-view div,
.mail-html-view blockquote,
.mail-html-view ul,
.mail-html-view ol,
.mail-html-view pre,
.mail-html-view table,
.mail-html-view h1,
.mail-html-view h2,
.mail-html-view h3,
.mail-html-view h4,
.mail-html-view h5,
.mail-html-view h6 {
  margin: 0;
}

.mail-html-view a {
  color: var(--gold-dark);
  text-decoration: underline;
}

.mail-html-view blockquote {
  padding-left: 14px;
  border-left: 3px solid rgba(160, 122, 75, 0.28);
  color: var(--muted);
}

.mail-html-view ul,
.mail-html-view ol {
  padding-left: 20px;
}

.mail-html-view pre,
.mail-html-view code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.mail-html-view pre {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(241, 238, 232, 0.48);
  white-space: pre-wrap;
}

.mail-html-view table {
  width: 100%;
  border-collapse: collapse;
}

.mail-html-view th,
.mail-html-view td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.mail-html-view hr {
  width: 100%;
  height: 1px;
  margin: 0;
  border: 0;
  background: var(--line);
}

.mail-reader-note {
  margin-top: 18px;
  border: 1px dashed rgba(160, 122, 75, 0.35);
  border-radius: 8px;
  background: rgba(247, 234, 217, 0.46);
  padding: 14px 16px;
  color: #6f5f4f;
  font-size: 13px;
  line-height: 1.55;
}

.mail-attachments {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.mail-attachments-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.mail-attachment-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.mail-attachment {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(241, 238, 232, 0.48);
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
}

.mail-attachment strong,
.mail-attachment small {
  display: block;
}

.mail-attachment small {
  margin-top: 3px;
  color: var(--muted);
}

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.meter-groups {
  display: grid;
  gap: 18px;
}

.meter-group-meta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stack-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meter-detail {
  display: grid;
  gap: 18px;
}

.meter-detail-summary {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
}

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

.meter-kpis div {
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 14px;
}

.meter-kpis span,
.meter-kpis strong,
.meter-kpis small {
  display: block;
}

.meter-kpis span,
.meter-kpis small {
  color: var(--muted);
}

.meter-kpis strong {
  margin: 6px 0 4px;
  font-size: 20px;
}

.meter-notes {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.meter-notes strong {
  display: block;
  margin-bottom: 8px;
}

.meter-notes p {
  margin: 0;
  color: var(--muted);
}

.entity-card {
  min-height: 182px;
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: space-between;
}

.entity-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.entity-card h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

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

.entity-stats div {
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
}

.entity-stats strong,
.entity-stats span {
  display: block;
}

.entity-stats span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.filters .field {
  min-width: 190px;
}

.timeline {
  position: relative;
  display: grid;
  gap: 0;
}

.activity-item {
  position: relative;
  grid-template-columns: 24px minmax(0, 1fr);
  border-top: 0;
  padding: 8px 0 16px;
}

.activity-item::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 26px;
  bottom: -2px;
  width: 1px;
  background: var(--line);
}

.activity-item:last-child::before {
  display: none;
}

.timeline-dot {
  width: 15px;
  height: 15px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--gold);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 20, 22, 0.54);
}

.modal {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.modal-wide {
  width: min(1080px, 100%);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 0;
}

.modal-title h2 {
  font-size: 24px;
}

.modal-body {
  padding: 22px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 44px));
  border-radius: 8px;
  padding: 14px 16px;
  background: #14171a;
  color: #fff;
  box-shadow: var(--shadow);
  font-weight: 800;
}

.tenant-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.home-card {
  min-height: 250px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(18, 20, 22, 0.84), rgba(18, 20, 22, 0.56)),
    url("/assets/tenant-home-bg.webp") center right / cover;
  color: #fff;
}

.home-card h2 {
  margin: 0 0 10px;
  font-size: 30px;
  letter-spacing: 0;
}

.home-card p,
.home-card .item-meta {
  color: rgba(255, 255, 255, 0.74);
}

.home-card .entity-stats div {
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

.home-card .entity-stats strong {
  color: var(--ink);
}

.home-card .entity-stats span {
  color: rgba(71, 66, 58, 0.9);
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row span:first-child {
  color: var(--muted);
}

.detail-row strong {
  text-align: right;
}

.file-input {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.field-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.credentials-panel strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
}

.icon-svg {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-mark .icon-svg {
  width: 42px;
  height: 42px;
}

.mobile-only {
  display: none;
}

@media (max-width: 1180px) {
  .login-screen {
    grid-template-columns: minmax(420px, 0.95fr) minmax(470px, 1fr);
  }

  .login-brand {
    padding: 42px;
  }

  .feature-list {
    gap: 20px;
  }

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

  .content-grid,
  .tenant-hero,
  .split,
  .mail-stage {
    grid-template-columns: 1fr;
  }

  .mail-app {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .document-filter-grid,
  .mail-reader-meta,
  .mail-reader-controls {
    grid-template-columns: 1fr;
  }

  .documents-stage,
  .document-meta-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 0;
  }

  .login-screen {
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: auto;
    padding: 28px;
  }

  .login-brand-content {
    min-height: auto;
    display: grid;
    gap: 24px;
  }

  .login-logo-stack {
    justify-self: start;
    margin-top: 0;
    text-align: left;
  }

  .feature-list {
    grid-template-columns: 1fr;
    margin-bottom: 0;
  }

  .feature-item {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 13px;
  }

  .feature-icon {
    width: 50px;
    height: 50px;
  }

  .feature-icon .icon-svg {
    width: 23px;
    height: 23px;
  }

  .feature-item span {
    max-width: none;
  }

  .login-footer-links {
    display: none;
  }

  .brand-copy h1 {
    font-size: 32px;
  }

  .login-panel {
    padding: 30px 22px 44px;
  }

  .auth-card {
    max-width: none;
    min-height: auto;
    padding: 28px;
  }

  .workspace {
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 18px;
    gap: 16px;
  }

  .sidebar .brand-lockup {
    justify-content: space-between;
  }

  .role-pill {
    display: none;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .nav button {
    width: auto;
    white-space: nowrap;
  }

  .sidebar-footer {
    display: none;
  }

  .main {
    padding: 22px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .mail-app {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .documents-stage {
    min-height: auto;
  }

  .meter-detail-summary,
  .meter-kpis {
    grid-template-columns: 1fr;
  }

  .mail-nav {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mail-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .mail-stage {
    grid-template-columns: 1fr;
  }

  .mail-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 420px;
  }

  .document-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 420px;
  }
}

@media (max-width: 680px) {
  .form-grid,
  .dashboard-grid,
  .demo-grid {
    grid-template-columns: 1fr;
  }

  .auth-card h2 {
    font-size: 32px;
  }

  .auth-copy p {
    font-size: 15px;
  }

  .btn.wide {
    min-height: 54px;
    font-size: 17px;
  }

  .demo-strip {
    flex-wrap: wrap;
    gap: 10px 16px;
  }

  .defect-row,
  .doc-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .mail-row-top,
  .mail-row-subject,
  .mail-reader-head,
  .document-detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .item-side {
    text-align: left;
  }

  .auth-tabs,
  .segmented {
    width: 100%;
    grid-auto-flow: row;
  }

  .actions .btn {
    width: 100%;
  }

  .metric-card {
    min-height: 132px;
  }

  .mail-folder {
    padding-inline: 10px;
  }

  .mail-reader {
    padding: 18px;
  }

  .document-detail {
    padding: 18px;
  }

  .document-preview-frame {
    min-height: 460px;
  }
}
