* { box-sizing: border-box; }
body.php-app { margin: 0; min-height: 100vh; color: #172b43; background: #f5f7fa; font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.php-header { display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 12px clamp(18px, 5vw, 72px); border-bottom: 1px solid #e5ebf1; background: #fff; }
.php-brand { display: block; }
.php-brand img { display: block; width: 170px; height: auto; }
.php-brand-dark { display: none !important; }
.php-header-user { color: #63778b; font-size: 13px; }
.php-main { width: min(1100px, calc(100% - 32px)); margin: 38px auto; }
.php-heading { margin-bottom: 22px; }
.php-kicker { margin: 0 0 8px; color: #39878b; font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.php-heading h1 { margin: 0; color: #102542; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.04em; }
.php-heading p { margin: 8px 0 0; color: #708296; }
.php-card { margin-bottom: 18px; padding: 23px; border: 1px solid #e3eaf0; border-radius: 13px; background: #fff; box-shadow: 0 8px 24px rgba(16,37,66,.045); }
.php-card h2 { margin: 0 0 6px; color: #183752; font-size: 17px; }
.php-muted { margin: 0; color: #7b8c9d; font-size: 13px; }
.php-notice { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border: 1px solid #d8e9e7; border-radius: 10px; color: #4c6f73; background: #f0f8f6; font-size: 13px; }
.php-notice strong { color: #26777b; }
.php-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.php-gap-top { margin-top: 18px; }
.php-status-line { margin: 14px 0 0; }
.php-stat { padding: 15px; border: 1px solid #edf1f4; border-radius: 9px; background: #fbfcfd; }
.php-stat span { display: block; color: #8796a5; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.php-stat strong { display: block; margin-top: 5px; color: #29445f; font-size: 14px; overflow-wrap: anywhere; }
.php-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.php-button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 9px; padding: 0 15px; border: 1px solid #dce5ec; border-radius: 8px; color: #405a70; background: #fff; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; }
.php-button:hover { border-color: #a9c8cd; background: #f8fbfb; }
.php-button.primary { border-color: #102f4b; color: #fff; background: #102f4b; }
.php-button.primary:hover { background: #1c4666; }
.php-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.php-footer { margin-top: 32px; color: #94a1ae; font-size: 11px; text-align: center; }
.php-error { padding: 12px 14px; border: 1px solid #f0d7d7; border-radius: 8px; color: #8f4545; background: #fff7f7; }
.php-header-actions { display: flex; align-items: center; gap: 14px; }
.php-admin-grid { display: grid; grid-template-columns: minmax(270px, .8fr) minmax(0, 1.5fr); align-items: start; gap: 18px; }
.tenant-form { display: grid; gap: 9px; margin-top: 19px; }
.tenant-form label { color: #536b7e; font-size: 12px; font-weight: 700; }
.tenant-form input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #dce5ec; border-radius: 7px; color: #263f56; background: #fff; font: inherit; font-size: 13px; }
.tenant-form input:focus { border-color: #55aeb0; outline: 3px solid rgba(72,181,184,.15); }
.tenant-field-help, .php-field-help { margin: 0 0 8px; color: #8594a3; font-size: 11px; }
.tenant-form button { justify-self: start; }
.tenant-list-card { min-width: 0; }
.tenant-list-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.recording-count { display: inline-grid; min-width: 24px; height: 23px; place-items: center; padding: 0 7px; border-radius: 7px; color: #507185; background: #eef3f6; font-size: 11px; font-weight: 700; }
.tenant-list-heading h2 { margin: 0 0 5px; color: #183752; font-size: 17px; }
.tenant-list-heading p { margin: 0; }
.tenant-table-wrap { overflow-x: auto; border: 1px solid #e9eef2; border-radius: 8px; }
.tenant-table { width: 100%; border-collapse: collapse; text-align: left; }
.tenant-table th { padding: 10px 11px; background: #f8fafb; color: #8493a2; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.tenant-table td { padding: 11px; border-top: 1px solid #edf1f4; color: #566d81; font-size: 12px; vertical-align: top; }
.tenant-table td strong { display: block; color: #29445b; font-size: 12px; }
.tenant-table td small { display: block; margin-top: 4px; color: #96a2ae; font-size: 10px; }
.tenant-table code { color: #557086; font-size: 10px; overflow-wrap: anywhere; }
.tenant-empty { padding: 28px 14px; border: 1px dashed #dce5eb; border-radius: 8px; color: #8493a1; font-size: 12px; text-align: center; }
.php-flash { margin-bottom: 16px; padding: 12px 14px; border: 1px solid; border-radius: 9px; font-size: 12px; }
.php-flash ul { margin: 7px 0 0; padding-left: 19px; }
.php-flash.success { border-color: #cfe8dc; color: #28735f; background: #f0f8f4; }
.php-flash.error { border-color: #efd6d6; color: #8a4444; background: #fff7f7; }
.php-pill { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 20px; color: #287f6c; background: #ebf7f2; font-size: 11px; font-weight: 700; }
.php-pill.warn { color: #966d15; background: #fff6e1; }
.php-form-inline { display: inline; margin: 0; }
@media (max-width: 760px) { .php-admin-grid { grid-template-columns: 1fr; } }
@media (max-width: 650px) { .php-header { min-height: 64px; padding: 10px 16px; } .php-brand img { width: 145px; } .php-header-actions { gap: 7px; } .php-header-user { font-size: 11px; } .php-main { margin-top: 24px; } .php-card { padding: 18px; } .php-grid { grid-template-columns: 1fr; } }

/* Shared role-gated top navigation */
.php-header { gap: 18px; }
.php-top-nav { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 5px; margin: 0 auto; }
.php-nav-link { display: inline-flex; min-height: 38px; align-items: center; gap: 7px; padding: 0 12px; border: 0; border-radius: 8px; color: #62768a; background: transparent; font: inherit; font-size: 13px; font-weight: 650; text-decoration: none; white-space: nowrap; cursor: pointer; }
.php-nav-link:hover, .php-nav-link.is-current { color: #155e70; background: #eaf5f4; }
.php-nav-dropdown { position: relative; }
.php-nav-dropdown > summary { list-style: none; }
.php-nav-dropdown > summary::-webkit-details-marker { display: none; }
.php-nav-dropdown > summary::after { content: ""; width: 7px; height: 7px; margin-top: -4px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.php-nav-dropdown[open] > summary::after { margin-top: 3px; transform: rotate(225deg); }
.php-nav-menu { position: absolute; top: calc(100% + 7px); left: 0; z-index: 40; display: grid; min-width: 190px; gap: 3px; padding: 7px; border: 1px solid #e3eaf0; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(16,37,66,.12); }
.php-nav-menu a { display: block; padding: 9px 10px; border-radius: 7px; color: #53697d; font-size: 12px; text-decoration: none; white-space: nowrap; }
.php-nav-menu a:hover, .php-nav-menu a[aria-current="page"] { color: #155e70; background: #edf6f5; }
@media (max-width: 850px) {
  .php-header { flex-wrap: wrap; }
  .php-top-nav { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; margin: 4px 0 0; padding-bottom: 2px; }
  .php-nav-link { padding-right: 10px; padding-left: 10px; font-size: 12px; }
  .php-nav-menu { position: fixed; top: auto; }
}

/* Primary navigation: menu visibility is rendered by the server from scoped roles. */
.php-header { gap: 18px; }
.php-top-nav { display: flex; min-width: 0; flex: 1; align-items: center; justify-content: center; gap: 5px; margin: 0 auto; }
.php-nav-link { display: inline-flex; min-height: 38px; align-items: center; gap: 8px; padding: 0 12px; border: 0; border-radius: 8px; color: #62768a; background: transparent; font: inherit; font-size: 13px; font-weight: 650; text-decoration: none; white-space: nowrap; cursor: pointer; }
.php-nav-link:hover, .php-nav-link.is-current { color: #155e70; background: #eaf5f4; }
.php-nav-dropdown { position: relative; }
.php-nav-dropdown > summary { list-style: none; }
.php-nav-dropdown > summary::-webkit-details-marker { display: none; }
.php-nav-dropdown > summary::after { content: ""; width: 7px; height: 7px; margin-top: -4px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.php-nav-dropdown[open] > summary::after { margin-top: 3px; transform: rotate(225deg); }
.php-nav-menu { position: absolute; top: calc(100% + 7px); left: 0; z-index: 40; display: grid; min-width: 190px; gap: 3px; padding: 7px; border: 1px solid #e3eaf0; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(16,37,66,.12); }
.php-nav-menu a { display: block; padding: 9px 10px; border-radius: 7px; color: #53697d; font-size: 12px; text-decoration: none; white-space: nowrap; }
.php-nav-menu a:hover, .php-nav-menu a[aria-current="page"] { color: #155e70; background: #edf6f5; }
.recordings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.recordings-heading h2 { margin: 0 0 5px; color: #183752; font-size: 17px; }
.recordings-heading p { margin: 0; }
.recordings-table { min-width: 720px; }
.recordings-footnote { margin-top: 14px; }
.management-card { min-width: 0; }
@media (max-width: 850px) {
  .php-header { flex-wrap: wrap; }
  .php-top-nav { order: 3; width: 100%; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; margin: 4px 0 0; padding-bottom: 2px; }
  .php-nav-link { padding-right: 10px; padding-left: 10px; font-size: 12px; }
  .php-nav-menu { position: fixed; top: 110px; left: 12px; }
}

.php-nav-logout { display: inline-flex; margin: 0; }
.php-nav-logout button { font-family: inherit; }

/* User preferences */
.preferences-form { display: grid; max-width: 560px; gap: 9px; margin-top: 20px; }
.preferences-form label { color: #536b7e; font-size: 12px; font-weight: 700; }
.preferences-form select, .preferences-form input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #dce5ec; border-radius: 7px; color: #263f56; background: #fff; font: inherit; font-size: 13px; }
.preferences-form select:focus, .preferences-form input:focus { border-color: #55aeb0; outline: 3px solid rgba(72,181,184,.15); }
.preferences-form .php-field-help { margin: 0 0 8px; }
.preferences-form button { justify-self: start; }

/* Dark palette applies for an explicit override or a dark operating-system preference. */
html[data-effective-theme="dark"] body.php-app { color-scheme: dark; color: #e5edf5; background: #0d1724; }
html[data-effective-theme="dark"] .php-header { border-color: #293a4c; background: #132235; }
html[data-effective-theme="dark"] .php-brand-light { display: none; }
html[data-effective-theme="dark"] .php-brand-dark { display: block !important; }
html[data-effective-theme="dark"] .php-header-user { color: #b4c2d0; }
html[data-effective-theme="dark"] .php-heading h1 { color: #edf3f8; }
html[data-effective-theme="dark"] .php-heading p,
html[data-effective-theme="dark"] .php-muted { color: #a1b1c0; }
html[data-effective-theme="dark"] .php-kicker { color: #69c4c2; }
html[data-effective-theme="dark"] .php-card { border-color: #2b3d50; background: #152438; box-shadow: none; }
html[data-effective-theme="dark"] .php-card h2 { color: #e3edf5; }
html[data-effective-theme="dark"] .php-stat { border-color: #2b3c4e; background: #192b40; }
html[data-effective-theme="dark"] .php-stat span,
html[data-effective-theme="dark"] .php-footer { color: #9aabba; }
html[data-effective-theme="dark"] .php-stat strong { color: #e1eaf2; }
html[data-effective-theme="dark"] .php-button { border-color: #405469; color: #d7e2eb; background: #1b2d42; }
html[data-effective-theme="dark"] .php-button:hover { border-color: #5c8995; background: #223a51; }
html[data-effective-theme="dark"] .php-button.primary { border-color: #2d7781; color: #fff; background: #286c79; }
html[data-effective-theme="dark"] .php-button.primary:hover { background: #32818d; }
html[data-effective-theme="dark"] .php-nav-link { color: #b2c0ce; }
html[data-effective-theme="dark"] .php-nav-link:hover,
html[data-effective-theme="dark"] .php-nav-link.is-current { color: #a6e3df; background: #1c3a4c; }
html[data-effective-theme="dark"] .php-nav-menu { border-color: #35495d; background: #17283b; box-shadow: 0 12px 30px rgba(0,0,0,.32); }
html[data-effective-theme="dark"] .php-nav-menu a { color: #c4d0db; }
html[data-effective-theme="dark"] .php-nav-menu a:hover,
html[data-effective-theme="dark"] .php-nav-menu a[aria-current="page"] { color: #a6e3df; background: #203d4f; }
html[data-effective-theme="dark"] .php-notice { border-color: #315256; color: #bdd6d5; background: #172f36; }
html[data-effective-theme="dark"] .php-notice strong { color: #83d2ca; }
html[data-effective-theme="dark"] .php-flash.success { border-color: #2b5747; color: #a7dbc4; background: #17352d; }
html[data-effective-theme="dark"] .php-flash.error { border-color: #654047; color: #f0b6b8; background: #3a252d; }
html[data-effective-theme="dark"] .php-pill { color: #a8dfca; background: #1c4138; }
html[data-effective-theme="dark"] .php-pill.warn { color: #edd08d; background: #493b22; }
html[data-effective-theme="dark"] .tenant-form label,
html[data-effective-theme="dark"] .preferences-form label { color: #c3d0db; }
html[data-effective-theme="dark"] .tenant-form input,
html[data-effective-theme="dark"] .preferences-form input,
html[data-effective-theme="dark"] .preferences-form select { border-color: #405469; color: #e0e8ef; background: #101e2e; color-scheme: dark; }
html[data-effective-theme="dark"] .tenant-form input:focus,
html[data-effective-theme="dark"] .preferences-form input:focus,
html[data-effective-theme="dark"] .preferences-form select:focus { border-color: #58aeb1; outline-color: rgba(72,181,184,.22); }
html[data-effective-theme="dark"] .php-field-help { color: #9babb9; }
html[data-effective-theme="dark"] .tenant-table-wrap { border-color: #304358; }
html[data-effective-theme="dark"] .tenant-table th { color: #a8b6c3; background: #1b2c40; }
html[data-effective-theme="dark"] .tenant-table td { border-color: #2c3d50; color: #c2ced8; }
html[data-effective-theme="dark"] .tenant-table td strong { color: #e0e9f0; }
html[data-effective-theme="dark"] .tenant-table td small,
html[data-effective-theme="dark"] .tenant-table code { color: #9dafbe; }
html[data-effective-theme="dark"] .tenant-empty { border-color: #3a4c60; color: #a6b5c2; }
html[data-effective-theme="dark"] .recording-count { color: #b3d5d6; background: #254454; }
html[data-effective-theme="dark"] .php-error { border-color: #654047; color: #f0b6b8; background: #3a252d; }

.php-heading-actions { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.tenant-title-link { display: block; color: #246b80; font-size: 12px; font-weight: 700; text-decoration: none; }
.tenant-title-link:hover { color: #174e63; text-decoration: underline; }
.tenant-admin-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.tenant-admin-option { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid #e8edf1; border-radius: 8px; cursor: pointer; }
.tenant-admin-option:hover { border-color: #b7d5d5; background: #fbfdfd; }
.tenant-admin-option input { width: 16px; height: 16px; accent-color: #237e83; }
.tenant-admin-option span { display: grid; gap: 3px; }
.tenant-admin-option strong { color: #344b61; font-size: 12px; }
.tenant-admin-option small { color: #8796a5; font-size: 10px; }
html[data-effective-theme="dark"] .tenant-title-link { color: #7fcbd0; }
html[data-effective-theme="dark"] .tenant-title-link:hover { color: #a4e2e3; }
html[data-effective-theme="dark"] .tenant-admin-option { border-color: #304459; background: #17283a; }
html[data-effective-theme="dark"] .tenant-admin-option:hover { border-color: #477a83; background: #1b3144; }
html[data-effective-theme="dark"] .tenant-admin-option strong { color: #dce6ed; }
html[data-effective-theme="dark"] .tenant-admin-option small { color: #9eafbd; }
@media (max-width: 650px) {
  .php-heading-actions { align-items: flex-start; flex-direction: column; }
  .tenant-admin-list { grid-template-columns: 1fr; }
}
