:root {
  --ink: #201d1a;
  --ink-soft: #6b6560;
  --ink-faint: #9b948d;
  --line: #e6e0d6;
  --line-soft: #efe9df;
  --bg: #f7f4ee;
  --panel: #ffffff;

  --accent: #a9692f;      /* copper — District 2C brand */
  --accent-dark: #8a5423;
  --accent-soft: #f4e6d5;
  --accent-ink: #ffffff;

  --navy: #1c2430;        /* topbar / brand surface */
  --navy-soft: #2a3341;
  --navy-line: #34404f;

  --free: #1a7a46;
  --free-bg: #e6f5ec;
  --reserved: #a06a00;
  --reserved-bg: #fbf1dc;
  --occupied: #9c3131;
  --occupied-bg: #fbeaea;

  --radius-sm: 6px;
  --radius: 9px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(32, 29, 26, 0.05);
  --shadow: 0 2px 10px rgba(32, 29, 26, 0.06), 0 1px 2px rgba(32, 29, 26, 0.05);

  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-dark); }

h1, h2, h3 {
  font-family: "Manrope", "Source Sans 3", sans-serif;
  line-height: 1.25;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h1 { font-size: 1.55rem; font-weight: 800; }
h2 { font-size: 1.08rem; font-weight: 700; }

/* ---------- topbar ---------- */

.topbar {
  background: var(--navy);
  border-bottom: 1px solid var(--navy-line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 58px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  color: #fff;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; opacity: 0.92; }
.brand::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent) 0%, #d8934f 100%);
  flex: none;
}
.mainnav { display: flex; gap: 2px; flex: 1; }
.mainnav a {
  color: #b9c0cc;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  position: relative;
}
.mainnav a:hover { background: var(--navy-soft); text-decoration: none; color: #fff; }
.mainnav a.active { color: #fff; background: var(--navy-soft); }
.mainnav a.active::after {
  content: "";
  position: absolute;
  left: 13px; right: 13px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 0.88rem; color: #b9c0cc; }
.topbar-user span { font-weight: 600; color: #fff; }
.logout-link { color: #b9c0cc; }
.logout-link:hover { color: #fff; }

/* ---------- page shell ---------- */

.page {
  max-width: 1140px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head .sub { color: var(--ink-soft); font-size: 0.93rem; }

.flash {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.flash-success { background: var(--free-bg); color: var(--free); border-color: rgba(26,122,70,0.15); }
.flash-error { background: var(--occupied-bg); color: var(--occupied); border-color: rgba(156,49,49,0.15); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.panel > h2:first-child,
.panel > h2 {
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.panel > h2:only-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0.5em; }

details.panel { padding: 16px 24px; }
details.panel > summary { list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  color: var(--accent-dark);
  font-size: 0.95rem;
  padding: 4px 0;
}
details.panel > summary::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  margin-right: 9px;
  transition: transform 0.15s ease;
}
details.panel[open] > summary::before { transform: rotate(45deg); }

/* ---------- auth screens ---------- */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 780px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}
.auth-brand {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  position: relative;
  overflow: hidden;
}
.auth-brand::after {
  content: "";
  position: absolute;
  right: -80px; bottom: -80px;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(169,105,47,0.35) 0%, rgba(169,105,47,0) 70%);
}
.auth-brand .mark {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, #d8934f 100%);
  margin-bottom: 28px;
}
.auth-brand h1 {
  color: #fff;
  font-size: 1.9rem;
  max-width: 360px;
  margin-bottom: 14px;
}
.auth-brand p {
  color: #b9c0cc;
  font-size: 0.98rem;
  max-width: 340px;
  line-height: 1.6;
}
.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}
.auth-card h1 { font-size: 1.3rem; margin-bottom: 4px; }
.auth-card .sub { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 24px; }

/* ---------- forms ---------- */

form .field { margin-bottom: 16px; }
label { display: block; font-size: 0.83rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 70px; }
.field .hint { color: var(--ink-faint); font-size: 0.8rem; margin-top: 4px; font-weight: 400; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}
.btn:hover { background: var(--bg); text-decoration: none; border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); width: auto; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-block { width: 100%; text-align: center; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-danger { color: var(--occupied); border-color: rgba(156,49,49,0.3); }
.btn-danger:hover { background: var(--occupied-bg); border-color: var(--occupied); }

/* ---------- stat tiles ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.stat .num { font-family: "Manrope", sans-serif; font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat .label { font-size: 0.82rem; color: var(--ink-soft); margin-top: 2px; font-weight: 600; }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
thead th {
  font-family: "Manrope", sans-serif;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 700;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
thead th:first-child { border-top-left-radius: var(--radius-sm); }
thead th:last-child { border-top-right-radius: var(--radius-sm); }
tbody tr:hover { background: #fbfaf7; }
tbody tr:last-child td { border-bottom: none; }
tfoot td { border-top: 2px solid var(--line); border-bottom: none; background: var(--bg); }
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- pills / status ---------- */

.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.pill-free { background: var(--free-bg); color: var(--free); }
.pill-reserved { background: var(--reserved-bg); color: var(--reserved); }
.pill-occupied { background: var(--occupied-bg); color: var(--occupied); }
.pill-new { background: #e8edfb; color: #2a4bb0; }
.pill-viewing { background: var(--reserved-bg); color: var(--reserved); }
.pill-offer { background: #f1e6fb; color: #6a2fa0; }
.pill-won { background: var(--free-bg); color: var(--free); }
.pill-lost { background: #ececec; color: #6b6b6b; }
.pill-upcoming { background: #e8edfb; color: #2a4bb0; }
.pill-active { background: var(--free-bg); color: var(--free); }
.pill-ended { background: #ececec; color: #6b6b6b; }
.pill-success { background: var(--free-bg); color: var(--free); }
.pill-failed { background: var(--occupied-bg); color: var(--occupied); }

.status-select {
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  background: #fff;
}

/* ---------- misc ---------- */

.property-group { margin-bottom: 32px; }
.property-group h2 { margin-bottom: 2px; border-bottom: none; padding-bottom: 0; }
.property-group .addr { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 14px; }

.filters { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filters a {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 700;
}
.filters a.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.filters a:hover { text-decoration: none; border-color: var(--ink-faint); }

.notes-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notes-list li { background: var(--bg); border-radius: var(--radius-sm); padding: 11px 13px; font-size: 0.9rem; }
.notes-list .note-text { white-space: pre-wrap; }
.notes-list .meta { color: var(--ink-soft); font-size: 0.78rem; margin-top: 4px; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 7px 12px; font-size: 0.92rem; }
.kv dt { color: var(--ink-soft); font-weight: 600; }
.kv dd { margin: 0; }

.empty { color: var(--ink-faint); font-style: italic; padding: 22px 0; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

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

.checkbox-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; }
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); font-size: 0.9rem; }
.checkbox-list input { width: auto; }

.eyebrow {
  font-family: "Manrope", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
  margin-bottom: 6px;
  display: block;
}

.badge-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 2.0: zákaznícka zóna, požiadavky, zasadačky ---------- */

.mainnav { overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { white-space: nowrap; }
.nav-badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.hint { color: var(--ink-faint); font-size: 0.8rem; }
code { font-size: 0.85em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

.link-btn {
  background: none;
  border: none;
  padding: 0 4px;
  color: var(--ink-faint);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.link-btn:hover { color: var(--occupied); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.invite-box {
  background: var(--accent-soft);
  border: 1px solid rgba(169,105,47,0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.copy-row { display: flex; gap: 8px; width: 100%; }
.copy-row input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; }

.user-list, .doc-list { list-style: none; margin: 0 0 16px; padding: 0; }
.user-list li, .doc-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.user-list li:last-child, .doc-list li:last-child { border-bottom: none; }
.user-list .pill { margin-left: 6px; font-size: 0.7rem; padding: 1px 8px; }
.row-actions { display: flex; gap: 6px; flex: none; }
.invite-form { border-top: 1px solid var(--line-soft); padding-top: 16px; }

.pill-ticket-new { background: #e8edfb; color: #2a4bb0; }
.pill-ticket-in_progress { background: var(--reserved-bg); color: var(--reserved); }
.pill-ticket-waiting { background: #f1e6fb; color: #6a2fa0; }
.pill-ticket-resolved { background: var(--free-bg); color: var(--free); }
.pill-ticket-closed { background: #ececec; color: #6b6b6b; }
.pill-urgent { background: var(--occupied-bg); color: var(--occupied); }

.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.subnav a {
  padding: 9px 14px;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.subnav a.active { color: var(--ink); border-bottom-color: var(--accent); }
.subnav a:hover { text-decoration: none; color: var(--ink); }

/* conversation thread on a požiadavka */
.thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.msg { border-radius: var(--radius); padding: 12px 14px; max-width: 86%; background: var(--bg); border: 1px solid var(--line-soft); }
.msg .meta { font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 4px; font-weight: 600; }
.msg .body { white-space: pre-wrap; font-size: 0.93rem; overflow-wrap: anywhere; }
.msg .attachment { margin-top: 8px; font-size: 0.85rem; }
.msg .attachment img { display: block; max-width: 260px; max-height: 200px; border-radius: var(--radius-sm); margin-top: 6px; border: 1px solid var(--line); }
.msg-mine { align-self: flex-end; background: #fff; border-color: var(--line); }
.msg-staff { background: var(--accent-soft); border-color: rgba(169,105,47,0.2); }
.msg-internal { background: #fff8e1; border: 1px dashed #d9b44a; }
.msg-internal .meta::after { content: " · interná poznámka (nájomca ju nevidí)"; color: #8a6d12; }

/* day timeline for zasadačky */
.day-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.day-nav input[type=date] { width: auto; }
.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.timeline-row .room { font-weight: 700; font-size: 0.9rem; }
.timeline-row .room .hint { display: block; font-weight: 400; }
.timeline-track {
  position: relative;
  height: 34px;
  background: repeating-linear-gradient(90deg, var(--bg) 0, var(--bg) calc(100% / var(--hours) - 1px), var(--line-soft) calc(100% / var(--hours) - 1px), var(--line-soft) calc(100% / var(--hours)));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.timeline-block {
  position: absolute;
  top: 3px; bottom: 3px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 6px;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
}
.timeline-block.is-mine { background: var(--navy); }
.timeline-hours { display: grid; grid-template-columns: 150px 1fr; gap: 12px; font-size: 0.7rem; color: var(--ink-faint); }
.timeline-hours .scale { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .timeline-row, .timeline-hours { grid-template-columns: 1fr; gap: 4px; }
  .timeline-hours > span:first-child { display: none; }
}

.form-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-inline .field { margin-bottom: 0; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink); font-size: 0.9rem; }
.checkbox-line input { width: auto; }

/* back-office menu has 10 items since 2.0 — give the bar the full width */
.topbar-inner { max-width: 1340px; gap: 20px; }
.mainnav a { padding: 8px 10px; font-size: 0.88rem; }
.mainnav a.active::after { left: 10px; right: 10px; }

/* portal users on the tenant page sit in a narrow column: stack the actions */
.user-list li { flex-direction: column; align-items: flex-start; gap: 8px; }
.user-list .row-actions { flex-wrap: wrap; }

/* wide tables scroll inside their panel instead of stretching the page */
.detail-grid > * { min-width: 0; }
.detail-grid.wide-right { grid-template-columns: minmax(290px, 1fr) 2.4fr; }
@media (max-width: 900px) { .detail-grid.wide-right { grid-template-columns: 1fr; } }
.detail-grid.wide-left { grid-template-columns: 1.3fr 1fr; }
@media (max-width: 800px) { .detail-grid.wide-left { grid-template-columns: 1fr; } }
