/* Authenticated shell on Bulma.
   Bulma supplies buttons, fields, menus, and notifications.
   This file is the app frame, the Tabulator bridge, and a short map for
   pages that still use the previous class names. */

html {
  font-size: 15px;
}

/* #0F766E is hsl(175, 77%, 26%).
   Bulma compiles the shade scale for its default primary (lightness 41%).
   --bulma-primary-invert-l is var(--bulma-primary-05-l), a fixed 6%, so
   button text stays near-black unless invert-l is set as well. 100% lightness
   is white. Outlined buttons use primary-l for their text, not invert-l.
   Hyperlink text uses --bulma-link-on-scheme-l, not --bulma-link-l. */
:root {
  --bulma-primary-h: 175deg;
  --bulma-primary-s: 77%;
  --bulma-primary-l: 26%;
  --bulma-primary-invert-l: var(--bulma-primary-100-l);
  --bulma-link-h: 175deg;
  --bulma-link-s: 77%;
  --bulma-link-l: 26%;
  --bulma-link-on-scheme-l: 26%;
  --bulma-focus-h: 175deg;
  --bulma-focus-s: 77%;
  --bulma-focus-l: 18%;
}

/* Bulma draws button focus with a shadow and sets outline:none. That shadow
   does not replace the outline here, so restore the focus variables as an
   outline. Fading a dark primary button with opacity turns white text into
   pale text on a pale teal; keep full opacity and lower the saturation. */
.button:focus-visible,
.input:focus-visible,
.textarea:focus-visible,
.select select:focus-visible,
.checkbox input:focus-visible,
.ps-sidebar .menu-list a:focus-visible,
.dropdown-item:focus-visible {
  outline: var(--bulma-focus-width) var(--bulma-focus-style) hsl(var(--bulma-focus-h), var(--bulma-focus-s), var(--bulma-focus-l));
  outline-offset: 2px;
}

.button.is-primary[disabled],
fieldset[disabled] .button.is-primary {
  opacity: 1;
  background-color: hsl(var(--bulma-primary-h), 35%, var(--bulma-primary-l));
  border-color: transparent;
  color: hsl(var(--bulma-primary-h), var(--bulma-primary-s), var(--bulma-primary-invert-l));
}

.button.is-primary.is-outlined[disabled],
fieldset[disabled] .button.is-primary.is-outlined {
  opacity: 1;
  background-color: transparent;
  color: hsl(var(--bulma-primary-h), 35%, var(--bulma-primary-l));
  border-color: hsl(var(--bulma-primary-h), 35%, var(--bulma-primary-l));
}

/* Bulma sets section { display: block }, which beats the hidden attribute
   in this browser and leaves hidden steps on screen. */
[hidden] {
  display: none !important;
}

body.app-shell {
  margin: 0;
  background: #f4f6f8;
  color: #1a1d21;
  font-size: 15px;
  line-height: 1.5;
}

body.app-has-sidebar {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

body.app-has-sidebar.sidebar-collapsed {
  grid-template-columns: 56px minmax(0, 1fr);
}

.ps-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: #fff;
  border-right: 1px solid #e6e8eb;
  padding: 0.75rem 0.55rem 1.25rem;
}

.ps-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  min-height: 2rem;
}

.ps-brand a {
  color: #1a1d21;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.ps-sidebar .menu-label {
  color: #5c6570;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.ps-sidebar .menu-list a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  color: #1a1d21;
}

.ps-sidebar .menu-list a.is-active {
  background: hsl(var(--bulma-primary-h), 70%, 94%);
  color: hsl(var(--bulma-primary-h), var(--bulma-primary-s), var(--bulma-primary-l));
  font-weight: 650;
}

.nav-mark {
  display: none;
  width: 1.25rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.8rem;
}

body.sidebar-collapsed .ps-brand-name,
body.sidebar-collapsed .menu-label,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed #sidebar-toggle span {
  display: none;
}

body.sidebar-collapsed .nav-mark {
  display: inline-block;
}

body.sidebar-collapsed .ps-sidebar .menu-list a,
body.sidebar-collapsed .ps-brand {
  justify-content: center;
}

.ps-workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.ps-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.4rem;
  padding: 0.45rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid #e6e8eb;
}

.ps-topbar-title {
  min-width: 0;
  flex: 1;
}

.ps-topbar-title .title {
  line-height: 1.2;
}

.dropdown-trigger .button {
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 720px) {
  body.app-has-sidebar {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  body.app-has-sidebar .ps-brand-name,
  body.app-has-sidebar .menu-label,
  body.app-has-sidebar .nav-label,
  body.app-has-sidebar #sidebar-toggle span {
    display: none;
  }

  body.app-has-sidebar .nav-mark {
    display: inline-block;
  }

  body.app-has-sidebar .ps-sidebar .menu-list a,
  body.app-has-sidebar .ps-brand {
    justify-content: center;
  }

  .ps-topbar {
    padding: 0.4rem 0.6rem;
  }

  .ps-subtitle {
    display: none;
  }

  .ps-main {
    padding: 0.75rem 0.6rem 1.5rem;
  }
}

.ps-subtitle {
  margin: 0;
  color: #5c6570;
  font-size: 0.85rem;
}

.ps-main {
  flex: 1;
  min-width: 0;
  padding: 1.15rem 1.4rem 2rem;
}

.table-container {
  max-width: 100%;
}

.ps-form {
  max-width: 960px;
}

/* Bulma colours links and draws a focus outline, but does not underline them. */
.ps-main a:not(.button):hover,
.ps-main a:not(.button):focus-visible {
  color: var(--bulma-link-text-hover);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Tabulator, specialised. Bulma does not theme it.
   The stock sheet uses #EFEFEF stripes and #aaa cell rules. */
.propserve-table {
  background: #fff;
  border: 1px solid #e6e8eb;
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}

.propserve-table .tabulator {
  font-size: 14px;
  border: none;
  background: #fff;
}

.propserve-table .tabulator-header {
  background: #f7f8fa;
  border-bottom: 1px solid #e6e8eb;
  font-weight: 650;
  color: #5c6570;
}

.propserve-table.tabulator .tabulator-header .tabulator-col,
.propserve-table .tabulator .tabulator-header .tabulator-col {
  background: transparent;
  border-right: none;
}

.propserve-table.tabulator .tabulator-col-title {
  white-space: normal;
}

.propserve-table .tabulator-row {
  background-color: #fff;
  border-bottom: 1px solid #f3f4f6;
  min-height: 2.4rem;
}

.propserve-table .tabulator-row.tabulator-row-even {
  background-color: #f8f9fa;
}

.propserve-table .tabulator-row:hover,
.propserve-table .tabulator-row.tabulator-selectable:hover {
  background-color: #f3f6f6;
  cursor: default;
}

.propserve-table .tabulator-row .tabulator-cell {
  padding: 0.4rem 0.6rem;
  border-right: none;
}

.propserve-table .tabulator-cell[tabulator-field="id"],
.propserve-table .col-kn {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: right;
}

.propserve-table .tabulator-cell a {
  font-weight: 650;
}

.propserve-table .tabulator-cell[tabulator-field="actions"] {
  white-space: nowrap;
}

.propserve-table .tabulator-footer {
  background: #fff;
  border-top: 1px solid #e6e8eb;
  font-size: 13px;
}

.propserve-table .status-active,
.propserve-table .status-hidden {
  font-size: 13px;
  font-weight: 650;
}

.propserve-table .status-active { color: #067647; }
.propserve-table .status-hidden { color: #5c6570; }

.propserve-table .btn {
  display: inline-flex;
  align-items: center;
  height: auto;
  min-width: 0;
  margin: 0 0.35rem 0 0;
  padding: 0.15rem 0.55rem;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  color: #1a1d21;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: none;
  text-decoration: none;
}

.propserve-table .btn-danger {
  color: #b42318;
  border-color: #f3c2bc;
  background: #fff;
}

/* Pages not in this proof of concept still emit the previous class names. */
.page-header { margin: 0 0 0.75rem; }
.page-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.2;
}
.page-subtitle { margin: 0.15rem 0 0; color: #5c6570; font-size: 0.85rem; }
.page-panel, .box {
  background: #fff;
}
.propserve-toolbar, .form-actions, .page-related {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 0.75rem;
}
.btn,
a.btn,
button.btn,
input[type="submit"].btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 0.35rem 0.75rem;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff;
  color: #1a1d21;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
}
.btn-primary {
  background: hsl(var(--bulma-primary-h), var(--bulma-primary-s), var(--bulma-primary-l));
  border-color: transparent;
  color: #fff;
}
.btn-danger { color: #b42318; border-color: #f3c2bc; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem 1rem;
}
@media (min-width: 900px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .span-2 { grid-column: 1 / -1; }
}
.form-section {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem 1rem;
  margin: 0;
  padding: 1rem;
  border: 1px solid #e6e8eb;
  border-radius: 8px;
  background: #fff;
}
@media (min-width: 900px) {
  .form-section { grid-template-columns: 1fr 1fr; }
}
.form-section-title {
  grid-column: 1 / -1;
  font-size: 0.95rem;
  font-weight: 650;
}
.form-field label { display: block; font-weight: 650; font-size: 0.9rem; margin-bottom: 0.2rem; }
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  font: inherit;
  background: #fff;
}
.form-errors { color: #b42318; margin: 0 0 0.75rem; }

.propserve-table .tabulator-cell[tabulator-field="service_tags"] {
  white-space: normal;
}
.service-tag { margin: 0.1rem 0.25rem 0.1rem 0; }

.ts-wrapper { width: 100%; }
.ts-wrapper .ts-control {
  border-color: #d0d5dd;
  border-radius: 6px;
  min-height: 2.5rem;
  padding: 0.3rem 0.5rem;
}
.ts-wrapper.focus .ts-control,
.ts-wrapper .ts-control:focus-visible {
  outline: var(--bulma-focus-width) var(--bulma-focus-style) hsl(var(--bulma-focus-h), var(--bulma-focus-s), var(--bulma-focus-l));
  outline-offset: 2px;
}
.ts-wrapper .item {
  background: #f4f6f8;
  border-radius: 4px;
  color: #1a1d21;
}

.category-index { padding: 0.35rem 1rem; }
.category-row {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 0.1rem 1rem;
  align-items: baseline;
  padding: 0.28rem 0;
  border-bottom: 1px solid #f0f1f3;
}
.category-row:last-child { border-bottom: 0; }
.category-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
}
.category-names { margin: 0; }
.category-names a {
  display: inline-block;
  margin: 0 0.85rem 0.05rem 0;
}
@media (max-width: 720px) {
  .category-row { grid-template-columns: 1fr; }
}

.contractor-warning { color: #92400e; }
.contractor-contact {
  margin-top: 0.35rem;
  font-size: 0.9rem;
}

/* ---------- Public welcome / auth ---------- */

body.app-public .ps-topbar-title:empty {
  flex: 1;
}

body.app-public .ps-main {
  display: flex;
  flex-direction: column;
}

.ps-welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0 2.5rem;
}

.ps-welcome-card {
  width: min(36rem, 100%);
  background: #fff;
  border: 1px solid #e6e8eb;
  border-top: 4px solid hsl(var(--bulma-primary-h), var(--bulma-primary-s), var(--bulma-primary-l));
  border-radius: 10px;
  padding: 2rem 2.1rem 2.15rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.ps-welcome-kicker {
  margin: 0 0 0.55rem;
  color: hsl(var(--bulma-primary-h), var(--bulma-primary-s), var(--bulma-primary-l));
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ps-welcome-title {
  margin-bottom: 0.35rem !important;
  color: #10231f;
}

.ps-welcome-subtitle {
  margin-bottom: 1.15rem !important;
  color: #5c6570 !important;
  font-weight: 500 !important;
}

.ps-welcome-copy {
  color: #3a424b;
}

.ps-welcome-copy p:last-child {
  margin-bottom: 0;
}

.ps-auth {
  max-width: 28rem;
}

.ps-auth-card {
  padding: 1.35rem 1.4rem;
}

.ps-auth-card form {
  margin: 0;
}

.ps-auth-card label,
.ps-auth-card .py4web-validation-error {
  display: block;
  margin-bottom: 0.35rem;
}

.ps-auth-card input[type="text"],
.ps-auth-card input[type="email"],
.ps-auth-card input[type="password"] {
  width: 100%;
  max-width: 100%;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #d5d9de;
  border-radius: 6px;
}

.ps-auth-card input[type="submit"],
.ps-auth-card button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.4rem;
  padding: 0.45rem 1rem;
  border: 0;
  border-radius: 6px;
  background: hsl(var(--bulma-primary-h), var(--bulma-primary-s), var(--bulma-primary-l));
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}

/* ---------- Authenticated home ---------- */

.ps-preview-label {
  color: #92400e;
  font-weight: 650;
}

.ps-home-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ps-home-link {
  margin: 0;
  padding: 0.55rem 0;
  border-bottom: 1px solid #eef0f2;
  color: #3a424b;
  line-height: 1.45;
}

.ps-home-link:last-child {
  border-bottom: 0;
}

.ps-home-link a {
  font-weight: 650;
}

/* ---------- Help ---------- */

.ps-help-toc {
  position: static;
}

@media (min-width: 1024px) {
  .ps-help-toc {
    position: sticky;
    top: 4.2rem;
  }
}

.ps-help-section {
  margin: 0;
  padding: 0 0 1.75rem;
  scroll-margin-top: 4.5rem;
}

.ps-help-section + .ps-help-section {
  border-top: 1px solid #eef0f2;
  padding-top: 1.75rem;
}

.ps-help-body.content .ps-help-section .title {
  margin-top: 0;
  margin-bottom: 0.85rem;
}

.ps-help-flow {
  margin: 0.75rem 0 1rem;
  padding-left: 1.2rem;
}

.ps-help-flow li + li {
  margin-top: 0.35rem;
}

.ps-help-details {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  border: 1px solid #e6e8eb;
  border-radius: 8px;
  background: #fff;
}

.ps-help-details + .ps-help-details {
  margin-top: 0.65rem;
}

.ps-help-details summary {
  cursor: pointer;
  font-weight: 650;
  color: #1a1d21;
}

.ps-help-details[open] summary {
  margin-bottom: 0.45rem;
  color: hsl(var(--bulma-primary-h), var(--bulma-primary-s), var(--bulma-primary-l));
}

.ps-help-details p:last-child {
  margin-bottom: 0;
}

.ps-mail-dev-note {
  margin: 0.75rem 0 1rem;
}
