:root {
  font-family: Arial, sans-serif;
  color: #132b49;
  background: #f3f6fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(145deg, #102844, #254366);
}

.login-card {
  width: min(100%, 390px);
  padding: 30px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .2);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #142e4d;
  color: #d9b972;
  font-size: 19px;
  font-weight: 700;
}

.eyebrow {
  margin: 18px 0 5px;
  color: #a17d39;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
}

h1 {
  margin: 0;
  font-size: 24px;
}

.intro {
  margin: 9px 0 25px;
  color: #5b6b7f;
  font-size: 13px;
  line-height: 1.5;
}

label {
  display: block;
  margin: 16px 0 6px;
  font-size: 12px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  background: #fff;
  color: #132b49;
  font-size: 14px;
}

input:focus {
  outline: 2px solid #d9b972;
  outline-offset: 1px;
}

button {
  width: 100%;
  min-height: 43px;
  margin-top: 22px;
  border: 0;
  border-radius: 8px;
  background: #142e4d;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: #254d78; }
button:disabled { opacity: .65; cursor: wait; }

.form-error {
  margin: 14px 0 0;
  color: #a12632;
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 430px) {
  .login-card { padding: 24px 20px; }
}


.app-page {
  background: #f3f6fa;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(20px, calc((100vw - 1120px) / 2));
  background: #142e4d;
  color: #fff;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
}

.app-brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #fff;
  color: #142e4d;
  font-size: 13px;
}

.logout-button {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 7px 13px;
  border: 1px solid #b9a371;
  background: transparent;
  font-size: 12px;
}

.app-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px;
}

.app-main .intro {
  margin-bottom: 22px;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.app-nav a,
.app-nav span {
  padding: 9px 13px;
  border: 1px solid #d5dfe9;
  border-radius: 8px;
  background: #fff;
  color: #53677c;
  font-size: 12px;
  text-decoration: none;
}

.app-nav .selected {
  border-color: #c7a860;
  background: #f7f0df;
  color: #142e4d;
  font-weight: 700;
}

.content-card {
  padding: 22px;
  border: 1px solid #e1e8ef;
  border-radius: 12px;
  background: #fff;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 17px;
}

#owner-name,
.muted {
  color: #637487;
  font-size: 12px;
}

@media (max-width: 430px) {
  .app-header { padding: 10px 16px; }
  .app-main { padding: 20px 14px; }
  .content-card { padding: 18px 14px; }
  .section-heading { align-items: flex-start; }
}

@media (max-width: 900px) {
  .app-header {
    padding: 12px 24px;
  }

  .app-main {
    max-width: 720px;
    padding: 24px;
  }

  .app-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-nav a,
  .app-nav span {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 10px 14px;
  }

  .app-brand {
    gap: 7px;
    font-size: 12px;
  }

  .app-brand-mark {
    width: 30px;
    height: 30px;
  }

  .app-main {
    padding: 18px 14px;
  }

  .app-main h1 {
    font-size: 21px;
  }

  .app-nav {
    gap: 7px;
  }

  .app-nav a,
  .app-nav span {
    padding: 10px 6px;
    font-size: 11px;
  }

  .section-heading {
    flex-direction: column;
    gap: 6px;
  }

  .logout-button {
    padding: 7px 9px;
    font-size: 11px;
  }
}

.tenant-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.tenant-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid #dce5ed;
  border-radius: 10px;
  background: #fbfcfe;
}

.tenant-card strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.tenant-card p {
  margin: 8px 0 0;
  color: #607184;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.tenant-card .tenant-card-modules {
  margin-top: 10px;
  padding: 8px 10px;

  border-left: 3px solid #d9b972;
  border-radius: 6px;

  background: #f7f0df;
  color: #142e4d;

  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

@media (max-width: 480px) {
  .tenant-list { gap: 8px; }
  .tenant-card { padding: 10px; }
  .tenant-card strong { font-size: 12px; }
  .tenant-card p { font-size: 10px; }
}

[hidden] {
  display: none !important;
}

.action-button {
  width: auto;
  min-height: 38px;
  margin: 16px 0 0;
  padding: 8px 16px;
  background: #142e4d;
}

.tenant-card .action-button + .action-button {
  margin-left: 12px;
  background: #d9b972;
  color: #132b49;
}

@media (max-width: 480px) {
  .tenant-card .action-button {
    min-height: 36px;
    padding: 7px 5px;
    font-size: 11px;
    text-align: center;
  }

  .tenant-card .action-button + .action-button {
    margin: 10px 0 0;
  }
}

.tenant-form {
  max-width: 560px;
  margin-top: 16px;
  padding: 20px;
  border: 1px solid #dce5ed;
  border-radius: 10px;
  background: #fbfcfe;
}

.tenant-form h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.tenant-form select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  background: #fff;
  color: #132b49;
  font-size: 13px;
}

@media (max-width: 480px) {
  .action-button {
    display: block;
    width: 100%;
  }

  .tenant-form {
    padding: 14px;
  }
}

.tenant-form {
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
}

.tenant-form > h3 {
  margin: 22px 0 14px;
}

.tenant-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 18px;
}

.tenant-form-card {
  min-width: 0;
  padding: 22px;
  border: 1px solid #dce5ed;
  border-radius: 12px;
  background: #fbfcfe;
}

.tenant-form-card h4 {
  margin: 0 0 16px;
  font-size: 16px;
}

.tenant-form-card .form-subheading {
  margin: 30px 0 8px;
  padding-top: 20px;
  border-top: 1px solid #dce5ed;
}

.tenant-form-card > .muted {
  margin: 0 0 15px;
  line-height: 1.5;
}

.tenant-form-card label,
#tenant-url-fields label {
  margin-top: 17px;
}

.tenant-form-card label.required::after {
  content: " *";
  color: #bf2739;
  font-weight: 700;
}

.tenant-form-card input,
.tenant-form-card select {
  max-width: 100%;
}

.tenant-module-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.tenant-module-option {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 10px 12px;

  border: 1px solid #d9b972;
  border-radius: 9px;

  background: #fffaf0;
  color: #132b49;

  box-shadow:
    0 0 0 1px rgba(217, 185, 114, .20),
    0 0 10px rgba(217, 185, 114, .16);

  font-size: 12px;
  font-weight: 700;
  cursor: pointer;

  transition:
    background .18s ease,
    border-color .18s ease,
    box-shadow .18s ease,
    color .18s ease;
}

.tenant-module-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;

  flex: 0 0 18px;

  accent-color: #d9b972;

  box-shadow:
    0 0 0 2px rgba(217, 185, 114, .25);

  cursor: pointer;
}

.tenant-module-option:has(input:checked) {
  border-color: #2f7d42;

  background: #dff3e4;
  color: #205c30;

  box-shadow:
    0 0 0 1px rgba(47, 125, 66, .24),
    0 0 12px rgba(47, 125, 66, .22);
}

.tenant-module-option input[type="checkbox"]:checked {
  accent-color: #2f7d42;

  box-shadow:
    0 0 0 2px rgba(47, 125, 66, .22);
}

.tenant-module-option:has(input:disabled) {
  cursor: default;
  opacity: .82;
}

.tenant-modules-required-note {
  margin: 11px 0 0;

  color: #9a6b16;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

#tenant-modules-status {
  min-height: 18px;
  margin-top: 7px;
}


@media (max-width: 480px) {
  .tenant-module-options {
    grid-template-columns: 1fr;
  }
}
.tenant-url-input {
  display: flex;
  min-width: 0;
}

.tenant-url-input input {
  min-width: 0;
  flex: 1;
  border-radius: 8px 0 0 8px;
}

.tenant-url-input span {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #cbd5df;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #edf2f7;
  color: #344b65;
  font-size: 12px;
  white-space: nowrap;
}

.tenant-form-actions {
  max-width: 560px;
  padding: 16px 0;
}

.tenant-form-actions button {
  width: auto;
  min-width: 170px;
}

@media (max-width: 760px) {
  .tenant-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .tenant-form-card {
    padding: 16px;
  }

  .tenant-url-input {
    flex-direction: column;
  }

  .tenant-url-input input {
    border-radius: 8px 8px 0 0;
  }

  .tenant-url-input span {
    min-height: 36px;
    border: 1px solid #cbd5df;
    border-top: 0;
    border-radius: 0 0 8px 8px;
  }

  .tenant-form-actions button {
    width: 100%;
  }
}

.time-zone-picker {
  position: relative;
}

.time-zone-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #cbd5df;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(19, 43, 73, .14);
}

.time-zone-option {
  display: block;
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 5px;
  background: #fff;
  color: #132b49;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.time-zone-option:hover,
.time-zone-option:focus {
  background: #f7f0df;
  color: #132b49;
}

.time-zone-options > p {
  margin: 8px;
  color: #637487;
  font-size: 12px;
}

.conflict-dialog {
  width: min(92vw, 470px);
  padding: 24px;
  border: 1px solid #dce5ed;
  border-radius: 12px;
  color: #132b49;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .25);
}

.conflict-dialog::backdrop {
  background: rgba(10, 28, 48, .55);
}

.conflict-dialog h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

#email-conflict-details {
  padding: 12px;
  border-radius: 8px;
  background: #f3f6fa;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.conflict-dialog button {
  display: block;
  width: 140px;
  margin: 20px auto 0;
}

#contracts {
  margin-top: 18px;
  scroll-margin-top: 18px;
}

#contracts > .muted {
  line-height: 1.5;
}

#contracts > h3 {
  margin: 24px 0 4px;
  font-size: 15px;
}

#contract-customer-results {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

#contract-customer-results:empty {
  display: none;
}

#contract-customer-results .action-button {
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #dce5ed;
  background: #fff;
  color: #132b49;
  text-align: left;
  font-size: 12px;
  line-height: 1.4;
}

#contract-customer-results .action-button:hover {
  border-color: #c7a860;
  background: #f7f0df;
}

#contract-selected-customer {
  min-height: 18px;
  color: #142e4d;
  font-weight: 700;
}

#contract-documents,
#contract-history input[type="file"] {
  height: auto;
  font-size: 12px;
}

#contract-documents::file-selector-button,
#contract-history input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 9px 14px;
  border: 0;
  border-radius: 7px;
  background: #142e4d;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#contract-documents::file-selector-button:hover,
#contract-history input[type="file"]::file-selector-button:hover {
  background: #254d78;
}

#contract-history .tenant-card {
  overflow-wrap: anywhere;
}

#contract-history .tenant-card a {
  color: #173e69;
  font-size: 12px;
  font-weight: 700;
}

#contract-history .tenant-card a:hover {
  color: #9b762d;
}

#contract-history .tenant-card input[type="file"] {
  margin-top: 14px;
}

#contract-history .tenant-card .action-button {
  margin-top: 8px;
}

#contract-status,
#contract-history-status {
  line-height: 1.5;
}

@media (max-width: 480px) {
  #contract-history .tenant-card a {
    font-size: 10px;
  }

  #contract-history .tenant-card input[type="file"] {
    padding: 7px;
    font-size: 10px;
  }
}

#billing {
  margin-top: 18px;
  scroll-margin-top: 18px;
}

#billing > .muted {
  line-height: 1.5;
}

.billing-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #dce5ed;
  border-radius: 10px;
}

.billing-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  background: #fff;
}

.billing-table th,
.billing-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e6ecf2;
  text-align: left;
  vertical-align: top;
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.billing-table th {
  background: #142e4d;
  color: #fff;
  font-weight: 700;
}

.billing-table tr:last-child td {
  border-bottom: 0;
}

.billing-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.billing-detail-button {
  width: auto;
  min-width: 36px;
  min-height: 32px;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid #c7a860;
  background: #f7f0df;
  color: #142e4d;
}

.billing-detail-button:hover {
  background: #eaddbd;
}

#billing-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 12px;
}

#billing-pagination button {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 6px 12px;
}

#additional-employees-dialog {
  width: min(94vw, 720px);
  max-height: 85vh;
  overflow-y: auto;
}

.additional-employee {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #dce5ed;
  border-radius: 8px;
  background: #fbfcfe;
}

.additional-employee strong {
  font-size: 12px;
}

.additional-employee p {
  margin: 6px 0 0;
  color: #607184;
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 480px) {
  #billing-pagination {
    flex-wrap: wrap;
  }

  .billing-table th,
  .billing-table td {
    padding: 9px 7px;
    font-size: 10px;
  }
}

.audit-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 240px);
  gap: 14px;
  margin: 20px 0;
}

.audit-filters input {
  width: 100%;
  box-sizing: border-box;
}

.audit-details-content {
  max-height: 55vh;
  overflow: auto;
  padding: 16px;
  border: 1px solid #d7e1ef;
  border-radius: 10px;
  background: #f7f9fc;
  color: #182e4a;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.5;
}


#audit-details-dialog:has(.owner-activity-table:not([hidden])) {
  width: min(94vw, 1050px);
  max-height: 88vh;
  overflow-y: auto;
}

.owner-activity-table {
  width: 100%;
  max-height: 58vh;
  overflow: auto;
  border: 1px solid #d7e1ef;
  border-radius: 10px;
}

.owner-activity-table[hidden] {
  display: none;
}

.owner-activity-table table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 12px;
}

.owner-activity-table th,
.owner-activity-table td {
  padding: 10px;
  border-bottom: 1px solid #e6ecf2;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.owner-activity-table th {
  position: sticky;
  top: 0;
  background: #142e4d;
  color: #fff;
}

.owner-activity-table tr:nth-child(even) {
  background: #f8fafc;
}

.owner-activity-table td:nth-child(5),
.owner-activity-table td:nth-child(6) {
  min-width: 120px;
  max-width: 210px;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  .owner-activity-table th,
  .owner-activity-table td {
    padding: 8px;
    font-size: 11px;
  }
}

@media (max-width: 640px) {
  .audit-filters {
    grid-template-columns: 1fr;
  }
}