:root {
  font-family: Tahoma, Arial, sans-serif;
  color: #20383e;
  background: #f3f6f5;
  line-height: 1.8;
  --green: #19766c;
  --navy: #102e36;
  --line: #d9e4e1;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  border: 0;
  border-radius: 10px;
  padding: 9px 17px;
  background: var(--green);
  color: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover,
.button:hover {
  filter: brightness(1.1);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.secondary,
.button.secondary {
  background: #e6efec;
  color: var(--navy);
}
button.danger {
  background: #9f403f;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #becdca;
  border-radius: 8px;
  background: white;
  color: #20383e;
  padding: 10px;
  min-height: 44px;
}
textarea {
  min-height: 110px;
}
input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
}
label {
  display: grid;
  gap: 5px;
  font-size: 13px;
}
small,
.muted {
  color: #637a7f;
  font-size: 12px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 28px;
}
h2 {
  font-size: 20px;
}
h3 {
  font-size: 16px;
}
header {
  background: var(--navy);
  color: #fff;
  padding: 18px 30px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}
.brand {
  font-size: 26px;
  font-weight: bold;
}
.brand small {
  display: block;
  color: #aed4ce;
  font-size: 11px;
  font-weight: normal;
}
header a {
  color: white;
}
.layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: calc(100vh - 90px);
}
aside {
  padding: 24px 16px;
  background: #fff;
  border-left: 1px solid var(--line);
}
aside button,
aside a {
  display: block;
  text-align: right;
  width: 100%;
  margin-bottom: 7px;
  font-size: 13px;
  background: transparent;
  color: #36565c;
}
aside button.active {
  background: #e0efea;
  color: #116959;
  font-weight: bold;
}
main {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
}
.hero {
  background: var(--navy);
  color: white;
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.hero:after {
  content: "ق";
  position: absolute;
  left: 35px;
  top: -70px;
  font-size: 220px;
  color: #ffffff0b;
}
.hero p {
  color: #c6dfd9;
  max-width: 660px;
  margin: 0;
}
.eyebrow {
  color: #a8d6c6;
  font-size: 12px;
  letter-spacing: 1px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}
.grid .card {
  margin: 0;
}
.module {
  cursor: pointer;
  text-align: right;
  min-height: 156px;
  background: white;
  color: #23434a;
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: space-between;
}
.module .symbol {
  font-size: 25px;
}
.module h3 {
  margin: 8px 0;
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.toolbar input {
  max-width: 330px;
}
.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tabs button {
  background: #e6eeec;
  color: #385e62;
}
.tabs button.active {
  background: var(--green);
  color: white;
}
.table-wrap {
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
td,
th {
  text-align: right;
  padding: 13px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  background: #eaf1ee;
  font-size: 12px;
}
tr:hover td {
  background: #f8fbfa;
}
.badge {
  background: #e7eeec;
  color: #315c55;
  border-radius: 30px;
  font-size: 11px;
  padding: 3px 10px;
  display: inline-block;
}
.badge.approved,
.badge.paid,
.badge.issued {
  background: #d8efe1;
  color: #1a6f4b;
}
.badge.manager,
.badge.central,
.badge.supervisor {
  background: #fff0cf;
  color: #7a5b16;
}
.empty {
  text-align: center;
  padding: 55px;
  color: #647d7e;
}
.hint {
  border-right: 4px solid #daa647;
  background: #fff8e7;
  padding: 13px 18px;
  font-size: 13px;
  margin-bottom: 18px;
  border-radius: 6px;
}
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
dialog {
  border: 0;
  border-radius: 16px;
  padding: 26px;
  max-width: 900px;
  width: 94%;
  max-height: 90vh;
  box-shadow: 0 16px 70px #102e3650;
}
dialog::backdrop {
  background: #061d2b88;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .wide {
  grid-column: 1/-1;
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 25px;
  position: sticky;
  bottom: -26px;
  background: white;
  padding: 15px 0;
}
.auth {
  max-width: 500px;
  margin: 7vh auto;
}
.auth form {
  display: grid;
  gap: 15px;
}
.auth .brand {
  color: var(--green);
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: #102e36;
  color: white;
  box-shadow: 0 5px 20px #0003;
  border-radius: 12px;
  padding: 14px 22px;
  max-width: 90%;
  display: none;
  z-index: 9999;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}
.stat strong {
  display: block;
  font-size: 27px;
  color: var(--green);
}
.kv {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0;
  border-bottom: 1px solid #edf1ef;
  padding: 9px 0;
}
.kv span {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}
.bar i {
  display: block;
  background: #2e9481;
  min-width: 3px;
  height: 14px;
  border-radius: 7px;
}
.print-only {
  display: none;
}
a {
  color: #177268;
}
footer {
  padding: 22px;
  text-align: center;
  color: #678181;
  font-size: 11px;
}
@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .layout {
    grid-template-columns: 1fr;
  }
  aside {
    display: flex;
    overflow: auto;
    gap: 8px;
    padding: 12px;
    border: 0;
  }
  aside button,
  aside a {
    width: auto;
    white-space: nowrap;
    margin: 0;
  }
  main {
    padding: 18px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 520px) {
  header {
    padding: 15px;
    align-items: flex-start;
  }
  .brand {
    font-size: 22px;
  }
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .module {
    padding: 14px;
    min-height: 150px;
  }
  .module h3 {
    font-size: 14px;
  }
  .hero {
    padding: 22px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .wide {
    grid-column: auto;
  }
  .kv {
    grid-template-columns: 1fr;
  }
  .toolbar input {
    max-width: 100%;
  }
  dialog {
    padding: 18px;
  }
  .actions button {
    font-size: 12px;
  }
}
@media print {
  body > * {
    display: none !important;
  }
  dialog[open] {
    display: block !important;
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    box-shadow: none;
    overflow: visible;
  }
  .no-print {
    display: none !important;
  }
  .print-only {
    display: block;
  }
  .kv {
    break-inside: avoid;
  }
  button {
    display: none !important;
  }
}

/* Checkbox choices: stable row alignment and generous touch targets. */
.selection-wrap {
  margin: 12px 0 24px;
  border: 1px solid #ccdcd7;
  border-radius: 10px;
  overflow: hidden;
  background: white;
}
.selection-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.selection-table th:first-child,
.selection-table td:first-child {
  width: 76px;
  text-align: center;
}
.selection-table th,
.selection-table td {
  padding: 0 12px;
  white-space: normal;
  overflow-wrap: anywhere;
  height: 46px;
  border-bottom: 1px solid #e0e9e5;
}
.selection-table th {
  background: #eaf1ee;
  padding: 12px;
  font-weight: bold;
}
.selection-table tr:last-child td {
  border-bottom: 0;
}
.selection-table tbody tr:nth-child(even) {
  background: #f7faf9;
}
.selection-table td label {
  display: flex;
  align-items: center;
  min-height: 46px;
  margin: 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.7;
}
.selection-table input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: #177268;
  vertical-align: middle;
}
.selection-table tr:has(input:checked) {
  background: #eaf6f1;
}
@media (max-width: 520px) {
  .selection-table th:first-child,
  .selection-table td:first-child {
    width: 60px;
  }
  .selection-table td label {
    font-size: 14px;
  }
}

.dialog-message {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #102e36;
  color: white;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: 0 3px 12px #0003;
  overflow-wrap: anywhere;
}
.dialog-message span,
#toast span {
  white-space: pre-wrap;
}
.dialog-message.message-error,
#toast.message-error {
  background: #fff0ee;
  color: #8b2520;
  border: 2px solid #bd443c;
}
.dialog-message button,
#toast button {
  flex-shrink: 0;
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
  font-size: 12px;
  padding: 5px 9px;
}
#toast button {
  margin-inline-start: 12px;
}

.person-portrait {
  display: block;
  width: 56px;
  height: 56px;
  margin-top: 8px;
  border-radius: 14px;
  overflow: hidden;
  background: #e7f2f3;
  color: #086879;
  text-align: center;
  flex-shrink: 0;
}
.person-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.person-portrait span {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 24px;
}
.person-portrait.large {
  width: 112px;
  height: 112px;
}
.portrait-editor {
  max-width: 460px;
  margin-top: 12px;
}
.portrait-preview {
  max-width: 160px;
  max-height: 160px;
  border-radius: 14px;
  margin: 10px 0;
}
.portrait-editor input {
  max-width: 100%;
}

.identity-print-sheet {
  overflow: auto;
  margin: 20px 0;
  padding: 4px;
}
.identity-card {
  box-sizing: border-box;
  width: 85.6mm;
  height: 54mm;
  border: 0.25mm solid #ccd7d8;
  border-radius: 3mm;
  background: #fff;
  color: #183842;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: Tahoma, Arial, sans-serif;
  break-inside: avoid;
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
.identity-head {
  background: #123c48;
  color: #fff;
  padding: 2mm 4mm;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9pt;
}
.identity-head span {
  font-size: 6pt;
  color: #c6e3e6;
}
.identity-body {
  display: flex;
  gap: 3mm;
  padding: 2.5mm 3.5mm;
  flex: 1;
  min-height: 0;
}
.identity-info {
  flex: 1;
  min-width: 0;
}
.identity-info h2 {
  font-size: 11pt;
  margin: 0 0 1.3mm;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.identity-info dl {
  margin: 0;
}
.identity-info dl > div {
  display: grid;
  grid-template-columns: 17mm 1fr;
  gap: 1mm;
  margin: 0.6mm 0;
  font-size: 7pt;
  line-height: 1.5;
}
.identity-info dt {
  color: #587078;
}
.identity-info dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.identity-photo {
  width: 21mm;
  flex-shrink: 0;
}
.identity-photo .person-portrait.large {
  margin: 0;
  width: 21mm;
  height: 27mm;
  border-radius: 2mm;
  background: #eef4f4;
}
.identity-photo img {
  object-fit: contain;
}
.identity-foot {
  background: #e6f2ef;
  color: #20675e;
  font-size: 6pt;
  padding: 0.8mm 4mm;
  border-top: 0.7mm solid #238b79;
}
@media print {
  body.printing-identity dialog[open] {
    padding: 0;
    margin: 0;
    inset: auto;
    border-radius: 0;
  }
  body.printing-identity .identity-print-sheet {
    overflow: visible;
    margin: 0;
    padding: 0;
  }
  .identity-card {
    box-shadow: none;
  }
  body.printing-identity .identity-card img {
    max-width: none;
  }
}

.identity-photo:has(svg) .person-portrait.large {
  height: 18mm;
  width: 18mm;
  margin: auto;
}
.identity-photo svg {
  display: block;
  margin: 1mm auto 0;
  width: 17mm;
  height: 17mm;
}
.checks {
  max-height: 320px;
  overflow: auto;
}
.checks label {
  display: block;
  padding: 8px;
}
fieldset > label {
  display: inline-block;
  margin: 8px;
}
[data-error] {
  color: #b42318;
}

/* Let grid/flex children shrink: wide tables must scroll locally, never
   enlarge the mobile document and trigger browser viewport scaling. */
.layout > main,
.layout > aside,
.form-grid > *,
header > *,
.toolbar > *,
.card {
  min-width: 0;
}
.table-wrap {
  max-width: 100%;
  min-width: 0;
}
@media screen and (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .layout > aside {
    max-width: 100%;
    min-width: 0;
  }
  .layout > aside button,
  .layout > aside a {
    flex-shrink: 0;
  }
}
@media screen and (max-width: 600px) {
  header {
    flex-wrap: wrap;
    padding: 14px;
    gap: 14px;
  }
  header > div {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  main {
    padding: 14px;
  }
  h1 {
    font-size: 24px;
    overflow-wrap: anywhere;
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-grid .wide {
    grid-column: 1;
  }
  .toolbar {
    align-items: stretch;
  }
  .toolbar > *,
  .toolbar input {
    width: 100%;
    max-width: 100%;
  }
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px;
    max-width: 100%;
    min-width: 0;
  }
  .actions {
    gap: 8px;
  }
  .actions button,
  .tabs button {
    min-height: 44px;
    white-space: normal;
  }
  fieldset {
    min-width: 0;
  }
  .checks label {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .checks input[type="checkbox"] {
    flex: 0 0 20px;
  }
}

/* Keep checkbox text beside the control on every screen size. */
.checks label,
fieldset > label,
form label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-align: right;
}
label > input[type="checkbox"] {
  flex: 0 0 20px;
  height: 20px;
  margin: 0;
}
fieldset > label {
  margin: 6px 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.person-choice {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 8px 0;
  padding: 10px !important;
}
.person-choice span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.person-choice small {
  display: block;
}
.person-choice[hidden] {
  display: none !important;
}
.remember-choice {
  display: flex;
  align-items: center;
  gap: 10px;
}
[data-picker-error] {
  color: #b42318;
}

.mobile-nav-toggle {
  display: none;
}
@media screen and (max-width: 900px) {
  .mobile-nav-toggle {
    display: block;
  }
  #main-navigation {
    display: none;
  }
  .layout.nav-open #main-navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-height: 55vh;
    overflow: auto;
  }
  #main-navigation button,
  #main-navigation a {
    white-space: normal;
    width: 100%;
  }
}

/* Account identity: separate name, role and controls at every viewport width. */
header .account-header { display:grid; grid-template-columns:minmax(0,1fr) 56px; gap:6px 12px; align-items:center; min-width:0; }
header .account-name {grid-column:1; overflow-wrap:anywhere;}
header .account-header > small, header .account-header > label {grid-column:1; display:block; color:#d8eeea; margin:0; line-height:1.6;}
header .account-header > .person-portrait {grid-column:2; grid-row:1 / 3; width:56px; height:56px; margin:0;}
header .account-header .actions {grid-column:1 / -1; display:flex; flex-wrap:wrap; gap:8px;}
header .account-header select {max-width:100%;}
@media(max-width:700px) {header {padding:12px 16px; gap:12px;} header .account-header {width:100%;} header .brand {font-size:22px;} header .account-header .actions button {padding:7px 12px;}}

/* Finance forms remain compact while history uses full page width. */
#treasury-root form.card {width:min(100%,760px);box-sizing:border-box;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-items:start;margin-inline-start:0;}
#treasury-root form.card label {min-width:0;display:flex;flex-direction:column;gap:6px;}
#treasury-root form.card input:not([type=checkbox]),#treasury-root form.card select {height:44px;box-sizing:border-box;}
#treasury-root form.card select[multiple] {height:120px;}
#treasury-root form.card h3,#treasury-root [data-allocations],#treasury-root form.card p {grid-column:1/-1;}
#treasury-root .table-wrap {margin-block:18px;}
@media(max-width:700px){#treasury-root form.card{grid-template-columns:1fr;} }

/* Compact maintenance forms; full-width dialogs on phones. */
.maintenance-dialog{width:min(960px,94vw);max-height:90vh;border:0;border-radius:16px;padding:20px;overflow:auto}
.maintenance-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;align-items:start}
.maintenance-form label{display:flex;flex-direction:column;gap:5px;min-width:0}
.maintenance-form input,.maintenance-form select{min-height:42px;height:auto}
.maintenance-form fieldset,.maintenance-form [data-photo-editor]{grid-column:1/-1}
.maintenance-form input[type=checkbox]{min-height:20px;align-self:flex-start}
@media(max-width:700px){.maintenance-form{grid-template-columns:1fr}.maintenance-dialog{width:96vw;max-height:94vh;padding:12px}}

/* beta40: front is unchanged; back has distinct English layout and print page. */
.identity-card-back { direction:ltr; margin-top:8mm; }
.identity-card-back .identity-info { width:100%; }
.identity-card-back .identity-info dl > div { grid-template-columns:23mm 1fr; }
@media print { .identity-card-back { break-before:page; margin-top:0; } }

/* Mobile workspace shell: the current account and its work stay in view;
   secondary account controls open on demand. Scope keeps /scaling independent. */
body.portal-app .mobile-account-toggle,
body.portal-app .mobile-account-link { display:none; }
body.portal-app #portal-main:focus { outline:none; }
body.portal-app #app > header { background:var(--card,#fff); color:var(--ink,#20384a); }
body.portal-app #app > header .brand { color:var(--ink,#20384a); }
body.portal-app .portal-theme-slot { grid-column:1/-1; min-width:0; }
body.portal-app .portal-theme-slot .theme-control { margin:0; padding:4px 0; border:0; background:transparent; justify-content:space-between; }
body.portal-app #main-navigation [hidden] { display:none!important; }
body.portal-app #workspace-home .ph-shortcut > span:nth-child(2) { min-width:0; }
body.portal-app #workspace-home .ph-shortcut b,
body.portal-app #workspace-home .ph-shortcut small { overflow-wrap:anywhere; }
@media screen and (max-width:900px) {
  body.portal-app #app button, body.portal-app #app .button { min-height:44px; }
  body.portal-app #app input:not([type="checkbox"]):not([type="radio"]),
  body.portal-app #app select, body.portal-app #app textarea { font-size:16px; }
  body.portal-app #app > header {
    display:grid; grid-template-columns:44px minmax(0,1fr) auto;
    grid-template-areas:"menu brand inbox" "account account account" "details details details";
    align-items:center; gap:4px 10px; min-height:0; padding:10px 12px 6px;
  }
  body.portal-app #app > header .mobile-nav-toggle {
    grid-area:menu; display:inline-flex!important; align-items:center; justify-content:center;
    width:44px; height:44px; padding:0; border:1px solid var(--line);
    background:var(--card,#fff); color:var(--ink,#20384a); font-size:23px;
  }
  body.portal-app #app > header .brand {
    grid-area:brand; min-width:0; font-size:20px; line-height:1.4; gap:7px; white-space:nowrap;
  }
  body.portal-app #app > header .brand > .ph-icon { width:29px; height:29px; border-radius:8px; padding:5px; }
  body.portal-app #app > header .brand small { display:none; }
  body.portal-app #app > header > .work-inbox { grid-area:inbox; margin:0; }
  body.portal-app #app > header .work-toggle { min-height:44px; padding:7px 10px; font-size:12px; border-radius:9px; }
  body.portal-app #app > header .mobile-account-toggle {
    grid-area:account; display:flex; align-items:center; justify-content:space-between;
    width:100%; min-width:0; min-height:44px; padding:5px 0; gap:10px;
    background:transparent; color:var(--ink,#20384a); box-shadow:none; text-align:start;
  }
  body.portal-app .mobile-account-toggle > span:first-child { display:flex; flex-wrap:wrap; align-items:center; gap:2px 9px; min-width:0; }
  body.portal-app .mobile-account-toggle b { max-width:100%; font-size:12px; font-weight:600; line-height:1.7; overflow-wrap:anywhere; white-space:normal; }
  body.portal-app .mobile-account-toggle small { max-width:100%; font-size:11px; font-weight:400; line-height:1.7; overflow-wrap:anywhere; white-space:normal; }
  body.portal-app .account-chevron { font-size:20px; line-height:1; flex-shrink:0; }
  body.portal-app .account-open .account-chevron { transform:rotate(180deg); }
  body.portal-app #app > header .account-header {
    grid-area:details; display:none; width:100%; max-width:none; margin:0; padding:12px 0 6px;
    border-top:1px solid var(--line); grid-template-columns:minmax(0,1fr) 44px; gap:8px 12px;
  }
  body.portal-app #app > header.account-open .account-header { display:grid; }
  body.portal-app #app > header .account-header > .person-portrait { width:44px; height:44px; }
  body.portal-app #app > header .account-header select { max-width:none; min-width:0; width:100%; font-size:16px; }
  body.portal-app #app > header .account-header .actions { width:100%; }
  body.portal-app #app > header .account-header .actions > button { flex:1; }
  body.portal-app #app > header .mobile-account-link { display:block; width:100%; font-size:12px; text-align:center; }
  body.portal-app #portal-account .theme-control { grid-column:1/-1; display:flex; flex-wrap:wrap; justify-content:space-between; gap:8px; padding:8px 0 0; margin:0; background:transparent; }
  body.portal-app #portal-account .theme-control select { width:auto; max-width:65%; min-height:44px; font-size:16px; }
  body.portal-app #app > .layout { min-height:0; }
  body.portal-app #main-navigation { display:none; }
  body.portal-app .layout.nav-open #main-navigation {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px 8px;
    max-height:55vh; max-height:55dvh; overflow-y:auto; overscroll-behavior:contain;
    margin:0; padding:12px; border-radius:0 0 12px 12px;
  }
  body.portal-app #main-navigation:before { display:none; }
  body.portal-app #main-navigation .nav-search { grid-column:1/-1; padding:0 0 8px; font-size:12px; }
  body.portal-app #main-navigation .nav-search input { font-size:16px; min-height:44px; }
  body.portal-app #main-navigation button,
  body.portal-app #main-navigation a { width:100%; margin:0; padding:9px 10px; font-size:12px; line-height:1.7; white-space:normal; overflow-wrap:anywhere; }
  body.portal-app #main-navigation .ph-icon { width:18px; height:18px; }
  body.portal-app #app .layout > main { padding:16px 14px 28px!important; }
  body.portal-app .workspace-toolbar { margin-bottom:14px; }
  body.portal-app .workspace-toolbar > div { display:flex; align-items:center; gap:8px; min-width:0; width:100%; }
  body.portal-app .workspace-toolbar > div > small { white-space:nowrap; margin:0; font-size:11px; }
  body.portal-app .workspace-toolbar > div > select { flex:1; min-width:0; width:0; max-width:none; font-size:16px; }
  body.portal-app .workspace-toolbar > div > strong { min-width:0; font-size:13px; overflow-wrap:anywhere; }
  body.portal-app .workspace-toolbar > a { display:none; }
  body.portal-app #workspace-home .ph-welcome { padding:0 0 14px; gap:12px; }
  body.portal-app #workspace-home .ph-welcome h1 { margin:2px 0 5px; font-size:22px; line-height:1.6; }
  body.portal-app #workspace-home .ph-welcome p { font-size:12px; line-height:1.8; }
  body.portal-app #workspace-home .ph-eyebrow { margin-bottom:3px; font-size:10px; }
  body.portal-app #workspace-home .ph-kpis { gap:8px; margin-bottom:14px; }
  body.portal-app #workspace-home .ph-kpi { padding:10px 12px; gap:2px 7px; }
  body.portal-app #workspace-home .ph-kpi > strong { font-size:24px; }
  body.portal-app #workspace-home .ph-kpi > .ph-icon { width:29px; height:29px; padding:6px; }
  body.portal-app #workspace-home .ph-home-grid { gap:14px; }
  body.portal-app #workspace-home .ph-panel { padding:14px; }
  body.portal-app #workspace-home .ph-panel-head { margin-bottom:10px; gap:8px; }
  body.portal-app #workspace-home .ph-panel-head h2 { font-size:16px; line-height:1.7; }
  body.portal-app #workspace-home .ph-task { display:grid; grid-template-columns:7px minmax(0,1fr) 18px; gap:2px 9px; padding:12px 0; }
  body.portal-app #workspace-home .ph-task > .ph-task-dot { grid-column:1; grid-row:1; }
  body.portal-app #workspace-home .ph-task > span:nth-child(2) { grid-column:2; grid-row:1; }
  body.portal-app #workspace-home .ph-task > .ph-pill { grid-column:2; grid-row:2; justify-self:start; max-width:100%; }
  body.portal-app #workspace-home .ph-task > svg { grid-column:3; grid-row:1/3; width:18px; }
  body.portal-app #workspace-home .ph-task b { font-size:13px; }
  body.portal-app #workspace-home .ph-task small { font-size:11px; }
  body.portal-app #workspace-home .ph-empty { padding:16px 6px; }
  body.portal-app #workspace-home .ph-intelligence .ph-ai-mark { display:none; }
  body.portal-app #workspace-home .ph-intelligence h2 { font-size:18px; margin:5px 0; }
  body.portal-app #workspace-home .ph-intelligence p { font-size:12px; line-height:1.9; margin-bottom:12px; }
  body.portal-app #workspace-home .ph-ai-links { margin-top:12px; padding-top:8px; }
  body.portal-app #workspace-home .ph-shortcuts { gap:8px; }
  body.portal-app #workspace-home .ph-shortcut { padding:10px 12px; }
}
@media screen and (max-width:540px) {
  body.portal-app #workspace-home .ph-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.portal-app #workspace-home .ph-kpi > span { font-size:11px; }
  body.portal-app #workspace-home .ph-kpi > small { font-size:10px; }
  body.portal-app #workspace-home .ph-shortcuts { grid-template-columns:minmax(0,1fr); }
  body.portal-app #app .tabs { gap:6px; margin-bottom:14px; }
  body.portal-app #app .tabs button { padding:7px 10px; font-size:12px; }
  body.portal-app #editor { width:calc(100% - 20px); max-width:100%; max-height:90vh; max-height:90dvh; padding:16px; }
}

.mobile-account-toggle .mobile-header-portrait {width:36px;height:36px;border-radius:50%;object-fit:cover;flex:0 0 36px;margin-inline-start:auto;}

/* Keep rarely used attachment choices and native file controls out of the form. */
[data-attachment] [hidden] { display: none !important; }
