:root {
  --color-bg: #faf8f4;
  --color-bg-transparent: rgba(250, 248, 244, 0);
  --color-bg-alt: #f4f1ea;
  --color-surface: #ffffff;
  --color-text: #1a1f26;
  --color-text-muted: #566073;
  --color-primary: #1a4d3a;
  --color-primary-light: #256b50;
  --color-primary-soft: #e7f0ea;
  --color-accent: #1a4d3a;
  --color-accent-dark: #143d2d;
  --color-accent-soft: #e7f0ea;
  --color-urgent: #d64545;
  --color-urgent-soft: #fbe2e2;
  --color-warning: #d99a2b;
  --color-warning-soft: #fbedd2;
  --color-success: #2f9e6b;
  --color-success-soft: #dcf0e6;
  --color-info: #3b6fd4;
  --color-info-soft: #dde8fb;
  --color-border: #e8e4da;
  --color-border-strong: #d6d0c2;
  --color-input-bg: #ffffff;
  --color-sidebar-bg: #faf8f4;
  --badge-open-text: #b23d3d;
  --badge-progress-text: #b3711f;
  --badge-resolved-text: #1c7048;
  --alert-success-text: #1c7048;
  --alert-success-border: #b8e3cd;
  --alert-info-text: #26489a;
  --alert-info-border: #c2d5f5;
  --alert-error-border: #f2c4c0;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(26, 31, 38, 0.05), 0 1px 3px rgba(26, 31, 38, 0.04);
  --shadow-md: 0 4px 14px rgba(26, 31, 38, 0.07);
  --shadow-lg: 0 14px 34px rgba(26, 31, 38, 0.12);
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --sidebar-width: 290px;
}

[data-theme="dark"] {
  --color-bg: #10140f;
  --color-bg-transparent: rgba(16, 20, 15, 0);
  --color-bg-alt: #161b13;
  --color-surface: #1a2119;
  --color-text: #e9ede6;
  --color-text-muted: #b0bbaa;
  --color-primary: #4caf7d;
  --color-primary-light: #63c092;
  --color-primary-soft: rgba(76, 175, 125, 0.16);
  --color-accent: #4caf7d;
  --color-accent-dark: #3d9868;
  --color-accent-soft: rgba(76, 175, 125, 0.16);
  --color-urgent: #ef6259;
  --color-urgent-soft: rgba(239, 98, 89, 0.16);
  --color-warning: #e0ac4c;
  --color-warning-soft: rgba(224, 172, 76, 0.16);
  --color-success: #4cbb87;
  --color-success-soft: rgba(76, 187, 135, 0.16);
  --color-info: #7d9df2;
  --color-info-soft: rgba(125, 157, 242, 0.16);
  --color-border: #262e22;
  --color-border-strong: #37412f;
  --color-input-bg: #141a11;
  --color-sidebar-bg: #131810;
  --badge-open-text: #f0908a;
  --badge-progress-text: #e0ac4c;
  --badge-resolved-text: #7ad4a8;
  --alert-success-text: #7ad4a8;
  --alert-success-border: rgba(76, 187, 135, 0.35);
  --alert-info-text: #9db8f5;
  --alert-info-border: rgba(125, 157, 242, 0.35);
  --alert-error-border: rgba(239, 98, 89, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-size: 18px; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  margin: 0;
  min-height: 100vh;
  line-height: 1.6;
  transition: background-color 0.2s, color 0.2s;
}

h1, h2, h3, .brand {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
  color: var(--color-text);
}
h1 { font-size: 1.9rem; margin: 0 0 0.3rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; margin: 1.5rem 0 0.6rem; }
a { color: var(--color-primary); }

/* ================= App shell: sidebar layout ================= */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  border-inline-end: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--color-text);
  text-decoration: none;
  padding: 0.4rem 0.6rem 1.6rem;
}
.sidebar-brand .icon { font-size: 1.5rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 600;
  min-height: 3rem;
  transition: background 0.12s;
}
.sidebar-link:hover { background: var(--color-bg-alt); }
.sidebar-link.active { background: var(--color-primary-soft); color: var(--color-primary); font-weight: 700; }
.sidebar-link .sidebar-icon { font-size: 1.2rem; width: 1.5rem; text-align: center; }
.sidebar-link .sidebar-badge {
  margin-left: auto;
  background: var(--color-urgent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
}

.sidebar-footer {
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem;
  border-radius: var(--radius-sm);
}
.sidebar-user .avatar {
  width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--color-primary-soft); color: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.sidebar-user .name { font-size: 1.02rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-utility-row { display: flex; gap: 0.5rem; padding: 0.3rem 0.6rem 0.6rem; }

.app-main { flex: 1; min-width: 0; padding: 2rem 2.5rem 4rem; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: relative;
    flex-direction: row; align-items: center; padding: 0.8rem 1rem;
    overflow-x: auto;
  }
  .sidebar-brand { padding: 0 0.75rem 0 0; }
  .sidebar-nav { flex-direction: row; flex: 0; }
  .sidebar-link.active { }
  .sidebar-footer { border-top: none; margin: 0 0 0 auto; padding: 0; flex-direction: row; align-items: center; }
  .sidebar-user .name { display: none; }
  .app-main { padding: 1.25rem 1rem 3rem; }
}

/* ================= Centered auth shell (login/register/etc) ================= */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-topbar {
  position: fixed;
  top: 1rem;
  inset-inline-end: 1.25rem;
  display: flex;
  gap: 0.4rem;
}

.container-app { max-width: 920px; margin: 0 auto; padding: 0; }
.eyebrow { text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.09em; color: var(--color-text-muted); font-weight: 700; }
.page-subtitle { color: var(--color-text-muted); margin: 0 0 1.25rem; }

.card-surface {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm);
}
.card-narrow { max-width: 460px; }

/* ================= Buttons ================= */
.btn-sonneneck, .btn-accent, .btn-outline, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  border-radius: var(--radius-sm); padding: 0.75rem 1.35rem; font-weight: 600;
  font-size: 1rem; cursor: pointer; border: 1px solid transparent;
  min-height: 3rem;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  text-decoration: none; font-family: var(--font-body);
}
.btn-sonneneck:active, .btn-accent:active, .btn-outline:active, .btn-danger:active { transform: translateY(1px); }
.btn-sonneneck { background: var(--color-primary); color: #fff; }
.btn-sonneneck:hover { background: var(--color-primary-light); }
.btn-accent { background: var(--color-primary); color: #fff; }
.btn-accent:hover { background: var(--color-primary-light); }
.btn-outline { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg-alt); }
.btn-danger { background: transparent; border-color: var(--color-urgent-soft); color: var(--color-urgent); }
.btn-danger:hover { background: var(--color-urgent-soft); }
.btn-sm { padding: 0.5rem 0.9rem; font-size: 0.88rem; min-height: 2.4rem; }
.btn-block { width: 100%; }

/* ================= Badges ================= */
.badge-status {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  padding: 0.22rem 0.65rem; border-radius: var(--radius-pill);
  text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap;
}
.badge-OPEN { background: var(--color-urgent-soft); color: var(--badge-open-text); }
.badge-IN_PROGRESS { background: var(--color-warning-soft); color: var(--badge-progress-text); }
.badge-RESOLVED { background: var(--color-success-soft); color: var(--badge-resolved-text); }

.badge-category {
  font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 6px;
  background: var(--color-bg-alt); color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-category.URGENT { background: var(--color-urgent-soft); color: var(--color-urgent); }
.badge-category.MAINTENANCE { background: var(--color-info-soft); color: var(--badge-progress-text); }

.badge-count {
  display: inline-block; min-width: 1.3rem; text-align: center; font-size: 0.75rem;
  font-weight: 700; padding: 0.1rem 0.4rem; border-radius: var(--radius-pill);
  background: var(--color-urgent); color: #fff; margin-left: 0.3rem;
}
.badge-count.neutral { background: var(--color-primary); }

.filter-tabs { display: flex; gap: 0.4rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.filter-tab {
  padding: 0.4rem 0.85rem; border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-strong); background: var(--color-surface);
  color: var(--color-text-muted); text-decoration: none; font-size: 0.85rem; font-weight: 600;
}
.filter-tab:hover { background: var(--color-bg-alt); }
.filter-tab.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ================= Dashboard: stat cards ================= */
.dash-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.dash-header .actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.9rem; }
.stat-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1.2rem 1.3rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-sm); text-decoration: none; color: inherit;
  transition: box-shadow 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
  width: 3rem; height: 3rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem; flex-shrink: 0;
}
.stat-icon.red { background: var(--color-urgent-soft); }
.stat-icon.orange { background: var(--color-warning-soft); }
.stat-icon.yellow { background: var(--color-accent-soft); }
.stat-icon.green { background: var(--color-success-soft); }
.stat-card .stat-num { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.stat-card .stat-lbl { font-size: 0.92rem; color: var(--color-text-muted); }

/* ================= Dashboard: two-column attention lists ================= */
.dash-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
@media (max-width: 780px) { .dash-columns { grid-template-columns: 1fr; } }

.dash-panel {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1.5rem;
}
.dash-panel-title { display: flex; align-items: center; gap: 0.45rem; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; margin: 0 0 0.25rem; }
.dash-panel-subtitle { color: var(--color-text-muted); font-size: 0.95rem; margin: 0 0 1.1rem; }

.attn-item { display: flex; align-items: center; gap: 0.85rem; padding: 0.9rem 0; }
.attn-item + .attn-item { border-top: 1px solid var(--color-border); }
.attn-icon {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.attn-icon.red { background: var(--color-urgent-soft); }
.attn-icon.orange { background: var(--color-warning-soft); }
.attn-icon.blue { background: var(--color-info-soft); }
.attn-body { flex: 1; min-width: 0; }
.attn-title { font-weight: 700; font-size: 1.03rem; }
.attn-sub { font-size: 0.9rem; color: var(--color-text-muted); margin-top: 0.15rem; }
.attn-action { font-size: 0.95rem; font-weight: 700; color: var(--color-primary); text-decoration: none; white-space: nowrap; }
.attn-action:hover { text-decoration: underline; }

.dash-panel-footer { text-align: center; margin-top: 1rem; padding-top: 0.9rem; border-top: 1px solid var(--color-border); }
.dash-panel-footer a { font-size: 0.88rem; font-weight: 700; color: var(--color-primary); text-decoration: none; }
.dash-panel-footer a:hover { text-decoration: underline; }

.dash-empty { text-align: center; color: var(--color-text-muted); padding: 1.5rem 0.5rem; font-size: 0.9rem; }

/* ================= Thread / ticket rows ================= */
.thread-row {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  padding: 0.95rem 0.75rem; border-radius: var(--radius-sm);
  text-decoration: none; color: inherit; transition: background 0.12s;
}
.thread-row + .thread-row { border-top: 1px solid var(--color-border); }
.thread-row:hover { background: var(--color-bg-alt); }
.thread-row.is-waiting { background: linear-gradient(90deg, var(--color-accent-soft), transparent 60%); }
.thread-main { min-width: 0; }
.thread-name { font-weight: 600; }
.thread-preview { color: var(--color-text-muted); font-size: 0.86rem; margin-top: 0.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 44ch; }
.thread-meta-line { color: var(--color-text-muted); font-size: 0.78rem; margin-top: 0.2rem; }
.unread-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--color-urgent);
  display: inline-block; margin-right: 0.45rem;
}

/* ================= Ticket cards (tenant list view) ================= */
.ticket-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 0.65rem;
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  text-decoration: none; color: inherit; transition: box-shadow 0.15s, border-color 0.15s;
}
.ticket-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-border-strong); }
.ticket-card.urgent { border-inline-start: 4px solid var(--color-urgent); }
.ticket-card.is-waiting { background: linear-gradient(90deg, var(--color-accent-soft), transparent 70%); }
.ticket-subject { font-weight: 600; font-family: var(--font-display); }
.ticket-meta { font-size: 0.82rem; color: var(--color-text-muted); margin-top: 0.2rem; }

.btn-delete {
  background: var(--color-urgent); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 0.45rem 0.9rem; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.btn-delete:hover { background: #b93a33; }

/* ================= Chat ================= */
.chat-window {
  max-height: 55vh; min-height: 220px; overflow-y: auto; display: flex;
  flex-direction: column; gap: 0.15rem; padding: 0.5rem; background: var(--color-bg-alt);
  border-radius: var(--radius-sm); border: 1px solid var(--color-border);
}
.msg {
  max-width: 80%; padding: 0.6rem 0.85rem; border-radius: 14px; margin-bottom: 0.5rem;
  font-size: 0.94rem; line-height: 1.45; word-wrap: break-word; box-shadow: var(--shadow-sm);
}
.msg-tenant { background: var(--color-surface); margin-inline-end: auto; border-end-start-radius: 4px; }
.msg-landlord { background: var(--color-primary); color: #fff; margin-inline-start: auto; border-end-end-radius: 4px; }
.msg-meta { font-size: 0.7rem; opacity: 0.7; margin-top: 0.25rem; }
.msg img { max-width: 100%; max-height: 320px; width: auto; height: auto; object-fit: contain; border-radius: 8px; margin-top: 0.45rem; display: block; cursor: pointer; }
.chat-empty { text-align: center; color: var(--color-text-muted); padding: 2rem 1rem; }

.composer { margin-top: 1rem; border-top: 1px solid var(--color-border); padding-top: 1rem; }
.composer-row { display: flex; gap: 0.6rem; align-items: flex-start; flex-wrap: wrap; }
.composer-row .grow { flex: 1 1 60%; min-width: 200px; }

.nudge-bar {
  margin-top: 0.75rem; padding: 0.6rem 0.85rem; background: var(--color-accent-soft);
  border-radius: var(--radius-sm); display: flex; align-items: center; gap: 0.5rem;
}

/* ================= Forms ================= */
.form-control-sonneneck,
input[type="text"], input[type="password"], input[type="tel"],
input[type="email"], input[type="number"], textarea, select {
  width: 100%; padding: 0.8rem 0.9rem; border: 1.5px solid var(--color-border-strong);
  border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 1.05rem;
  min-height: 3rem;
  background: var(--color-input-bg); color: var(--color-text); transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
textarea { resize: vertical; }
label { font-size: 0.95rem; font-weight: 700; color: var(--color-text); display: block; margin-bottom: 0.4rem; }
.field { margin-bottom: 1.3rem; }
.field-error { color: var(--color-urgent); font-size: 0.92rem; margin-top: 0.35rem; }
.field-help { font-size: 0.88rem; color: var(--color-text-muted); margin-top: 0.3rem; }
.form-row { display: flex; gap: 1rem; }
.form-row > * { flex: 1; }

/* ================= Announcements ================= */
.announcement {
  border-inline-start: 4px solid var(--color-primary); padding: 0.85rem 1rem;
  background: var(--color-primary-soft);
  border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm); margin-bottom: 0.85rem;
}
.announcement strong { font-family: var(--font-display); }

/* ================= Flash messages ================= */
.alert-flash {
  padding: 0.7rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem;
  font-size: 0.9rem; border: 1px solid transparent; display: flex; align-items: center; gap: 0.5rem;
}
.alert-flash.success { background: var(--color-success-soft); color: var(--alert-success-text); border-color: var(--alert-success-border); }
.alert-flash.info { background: var(--color-info-soft); color: var(--alert-info-text); border-color: var(--alert-info-border); }
.alert-flash.error { background: var(--color-urgent-soft); color: var(--color-urgent); border-color: var(--alert-error-border); }

.empty-state { text-align: center; color: var(--color-text-muted); padding: 2.5rem 1rem; }
.empty-state .big { font-size: 2rem; margin-bottom: 0.5rem; }

.roster-item { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.7rem 0; }
.roster-item + .roster-item { border-top: 1px solid var(--color-border); }

.auth-wrap { max-width: 440px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 0.75rem; font-size: 0.88rem; color: var(--color-text-muted); text-decoration: none; }
.back-link:hover { color: var(--color-text); }

.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--color-text-muted); }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* ================= Landing page ================= */
.landing-wrap {
  display: flex; flex-direction: column;
  align-items: center; padding: 1.75rem 1rem 3rem;
  text-align: center;
}
/* ================= Landing page hero ================= */
.landing-hero {
  position: relative;
  width: 100%;
  height: 42vh;
  min-height: 260px;
  max-height: 420px;
  background-size: cover;
  background-position: center 55%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.landing-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--color-bg-transparent) 0%, var(--color-bg-transparent) 42%, var(--color-bg) 88%);
}
.landing-hero-text {
  position: relative;
  z-index: 1;
  text-align: center;
  padding-bottom: 1.5rem;
}
.landing-title { font-size: 2.5rem; margin-bottom: 0.4rem; }
/* Dark mode only: the hero photo has both bright walls and a dark
   doorway right where this title sits, so no single flat color is
   reliably readable against both. A dark glow around the (still
   light-colored) text keeps it legible either way, without touching
   any other dark-mode color in the app. */
[data-theme="dark"] .landing-title {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75), 0 0 3px rgba(0, 0, 0, 0.9);
}
.landing-subtitle { color: var(--color-text-muted); margin-bottom: 2.5rem; font-size: 1rem; }
.landing-cards { display: flex; gap: 1.25rem; flex-wrap: wrap; justify-content: center; }
.landing-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 2.5rem 3rem; width: 260px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.1s;
}
.landing-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.landing-card .landing-icon {
  width: 3.6rem; height: 3.6rem; border-radius: 50%; background: var(--color-primary-soft);
  color: var(--color-primary); display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; margin: 0 auto 1rem;
}
.landing-card .landing-role { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; margin-bottom: 0.35rem; }
.landing-card .landing-name { color: var(--color-text-muted); font-size: 0.92rem; }

/* Language selector (used in sidebar footer and auth topbar) + theme toggle */
.lang-select {
  width: 100%;
  background: var(--color-bg-alt); color: var(--color-text);
  border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-pill);
  padding: 0.55rem 1rem; font-size: 0.92rem; font-weight: 600;
  cursor: pointer; font-family: var(--font-body); transition: background 0.15s;
  min-height: 2.75rem;
}
.lang-select:hover { background: var(--color-border); }
.lang-select:focus { outline: none; box-shadow: 0 0 0 3px var(--color-primary-soft); }
.auth-topbar .lang-select { width: auto; }

.theme-toggle {
  background: var(--color-bg-alt); color: var(--color-text);
  border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-pill);
  width: 2.75rem; height: 2.75rem; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.2rem; cursor: pointer; transition: background 0.15s; padding: 0;
}
.theme-toggle:hover { background: var(--color-border); }

.file-link { transition: background 0.15s; }
.file-link:hover { background: rgba(0,0,0,0.08) !important; }
.msg-landlord .file-link { background: rgba(255,255,255,0.15) !important; color: #fff !important; }
.msg-landlord .file-link:hover { background: rgba(255,255,255,0.25) !important; }

@media (max-width: 560px) {
  .msg { max-width: 88%; }
  .form-row { flex-direction: column; gap: 0; }
  h1 { font-size: 1.4rem; }
  .landing-title { font-size: 1.9rem; }
  .landing-cards { flex-direction: column; align-items: center; }
  .landing-hero { height: 34vh; min-height: 200px; }
}

/* ================= Ticket list v2: tabs, search bar, rows ================= */
.tab-bar {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 0 1.25rem; margin-bottom: 1rem;
  display: flex; gap: 1.75rem; overflow-x: auto;
}
.tab-item {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 1.1rem 0 1rem; border-bottom: 3px solid transparent;
  color: var(--color-text-muted); text-decoration: none; font-weight: 700;
  font-size: 1.02rem; white-space: nowrap;
}
.tab-item:hover { color: var(--color-text); }
.tab-item.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.filter-bar {
  display: flex; gap: 0.7rem; margin-bottom: 1.4rem; flex-wrap: wrap;
}
.filter-bar .search-input-wrap { position: relative; flex: 1 1 260px; }
.filter-bar .search-input-wrap .search-icon {
  position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%);
  color: var(--color-text-muted); pointer-events: none; font-size: 1.05rem;
}
.filter-bar .search-input-wrap input {
  padding-left: 2.4rem;
}
.filter-select {
  border: 1.5px solid var(--color-border-strong); background: var(--color-surface);
  color: var(--color-text); border-radius: var(--radius-sm); padding: 0.75rem 0.9rem;
  font-size: 1rem; font-family: var(--font-body); cursor: pointer; min-height: 3rem;
}

.ticket-list { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.ticket-row-v2 {
  display: flex; align-items: center; gap: 1.1rem;
  padding: 1.25rem 1.4rem; text-decoration: none; color: inherit;
}
.ticket-row-v2 + .ticket-row-v2 { border-top: 1px solid var(--color-border); }
.ticket-row-v2:hover { background: var(--color-bg-alt); }
.ticket-row-v2 .cat-icon {
  width: 3.2rem; height: 3.2rem; border-radius: 50%; flex-shrink: 0;
  background: var(--color-info-soft); display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
}
.ticket-row-v2 .row-main { flex: 1; min-width: 0; }
.ticket-row-v2 .row-title { font-weight: 700; font-family: var(--font-display); font-size: 1.15rem; }
.ticket-row-v2 .row-sub { font-size: 0.95rem; color: var(--color-text-muted); margin-top: 0.2rem; }
.ticket-row-v2 .row-tenant { font-size: 0.95rem; color: var(--color-text-muted); margin-top: 0.15rem; display: flex; align-items: center; gap: 0.35rem; }
.ticket-row-v2 .row-right { text-align: end; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 0.45rem; }
.ticket-row-v2 .row-time { font-size: 0.9rem; color: var(--color-text-muted); }
.ticket-row-v2 .row-handler { font-size: 0.9rem; color: var(--color-text-muted); }
.ticket-row-v2 .row-badge-chevron { display: flex; align-items: center; gap: 0.6rem; }
.ticket-row-v2 .chevron { color: var(--color-text-muted); font-size: 1.3rem; }

.status-pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.4rem 0.85rem; border-radius: var(--radius-pill);
  font-size: 0.92rem; font-weight: 700; white-space: nowrap;
}
.status-pill.NEW { background: var(--color-info-soft); color: var(--alert-info-text); }
.status-pill.IN_PROGRESS { background: var(--color-warning-soft); color: var(--badge-progress-text); }
.status-pill.NEEDS_REPLY { background: var(--color-urgent-soft); color: var(--color-urgent); }
.status-pill.RESOLVED { background: var(--color-success-soft); color: var(--badge-resolved-text); }

/* Announcement image attachments - same treatment as chat images */
.announcement-thumb { max-width: 100%; max-height: 320px; width: auto; height: auto; object-fit: contain; border-radius: 8px; margin-top: 0.5rem; display: block; cursor: pointer; }

/* Directional arrows (back/forward links) -- flip visually in RTL so
   "back" still points toward where the reading direction actually
   goes back to, without needing separate arrow characters per language */
[dir="rtl"] .dir-arrow { display: inline-block; transform: scaleX(-1); }
