/* SOS Palestine PMS — screen presentation refresh.
   This layer is intentionally screen-only; the established A4 print contracts remain in app.css. */
@media screen {
  :root {
    --maincolor: #009ee0;
    --mainColor: var(--maincolor);
    --mc: var(--maincolor);
    --sos-blue: #009ee0;
    --sos-blue-deep: #00648f;
    --sos-blue-ink: #004d70;
    --org-navy: #17405e;
    --sos-sky: #e9f4f6;
    --ink: #193746;
    --ink-soft: #526b75;
    --line: #d0e0e2;
    --paper: #fffefa;
    --rose: #e74361;
    --rose-soft: #fff0f1;
    --pink: #ec6981;
    --coral-action: #a93250;
    --green: #5fd47c;
    --green-ink: #23653a;
    --amber: #efb828;
    --amber-ink: #765200;
    --radius-s: 7px;
    --radius-m: 13px;
    --sidebar-width: 264px;
    --page-pad: clamp(16px, 2.4vw, 38px);
    --shadow-card: 0 2px 4px rgba(20, 63, 78, .035), 0 12px 34px rgba(20, 63, 78, .055);
  }

  html { scroll-behavior: smooth; }
  body {
    color: var(--ink);
    background: #f2f7f5;
    line-height: 1.58;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  html[lang="ar"] body { line-height: 1.75; }
  body, button, input, textarea, select { font-family: var(--font); }
  html[lang="ar"] body, html[lang="ar"] button, html[lang="ar"] input,
  html[lang="ar"] textarea, html[lang="ar"] select { font-family: var(--font-ar); }
  a { color: #00577e; text-underline-offset: .18em; }
  :focus-visible { outline: 3px solid #bc7b00; outline-offset: 3px; }
  /* Route headings receive programmatic focus; retain visible focus on controls and skip links. */
  h1[tabindex="-1"]:focus { outline: none; }
  .skip { top: 0; transform: translateY(calc(-100% - 2px)); }
  .skip:focus { top: 8px; transform: none; }

  /* Persistent workspace chrome */
  .top {
    background: rgba(255, 254, 250, .97);
    border: 0;
    border-bottom: 1px solid #d9e5e3;
    box-shadow: 0 4px 18px rgba(23, 64, 94, .045);
    min-height: 72px;
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(12px);
  }
  .top-inner { min-height: 72px; gap: 16px; }
  .top-title {
    color: #19495f;
    font-size: .96rem;
    letter-spacing: .005em;
  }
  .who { color: #526b75; }
  .who b { color: #193746; font-weight: 700; }
  .top-tools { gap: 8px; }
  .lang {
    background: #fffefa;
    border: 1px solid #c9dadd;
    border-radius: 9px;
    color: #17405e;
    min-height: 44px;
    padding-inline: 13px;
    font-weight: 650;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
  }
  .lang:hover { background: #e8f4f4; border-color: #80bac7; }

  .sidebar {
    color: #f4fbfb;
    background: #075b7d;
    border: 0;
    border-right: 1px solid rgba(255,255,255,.12);
    box-shadow: 6px 0 26px rgba(17, 59, 78, .10);
    padding: max(22px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  }
  .sidebar-head { padding: 0 4px 24px; }
  .brand.has-logo { gap: 11px; }
  .brand-plate {
    padding: 8px 9px;
    border-radius: 9px;
    background: #00648f;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
  }
  .brand .brand-plate .brand-logo { width: 164px; }
  .brand-text strong, .brand-text span { color: #f4fbfb; }
  .brand-text span { font-size: .77rem; opacity: .86; }
  .nav { gap: 4px; }
  .nav-group {
    color: #b8dce5;
    padding: 15px 11px 5px;
    font-size: .66rem;
    font-weight: 750;
    letter-spacing: .105em;
    text-transform: uppercase;
  }
  html[dir="rtl"] .nav-group { letter-spacing: 0; }
  .nav a {
    min-height: 44px;
    gap: 11px;
    padding: 9px 11px;
    border-radius: 9px;
    border-inline-start: 3px solid transparent;
    color: #e7f4f6;
    font-size: .88rem;
    font-weight: 560;
    transition: background-color .16s ease, color .16s ease, transform .16s ease;
  }
  .nav a:hover {
    color: #fff;
    background: rgba(255,255,255,.12);
    transform: translateX(2px);
  }
  html[dir="rtl"] .nav a:hover { transform: translateX(-2px); }
  .nav a[aria-current="page"] {
    color: #fff;
    background: rgba(255,255,255,.16);
    border-inline-start-color: #f28a98;
    font-weight: 750;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.045);
  }
  .nav-icon { color: #c5e6ec; }
  .nav a[aria-current="page"] .nav-icon { color: #fff; }
  .sidebar-foot { border-color: rgba(255,255,255,.17); }
  .sidebar-collapse { color: #e7f4f6; border-radius: 9px; }
  .sidebar-collapse:hover { background: rgba(255,255,255,.12); }
  body.sidebar-compact .brand-plate { background: #fffefa; }
  .nav-tooltip { background: #173f56; color: #fff; border: 1px solid rgba(255,255,255,.14); }
  .nav-backdrop { background: rgba(13, 43, 58, .56); backdrop-filter: blur(2px); }

  main { padding-block: 34px 88px; }
  body.signed-in main { min-height: calc(100dvh - 72px); }
  body.signed-in main > div { padding-inline: clamp(0px, .5vw, 8px); }
  h1, h2, h3 { letter-spacing: -.022em; }
  h1 { color: #153f54; font-weight: 720; line-height: 1.2; }
  h2 { color: #19495f; font-weight: 700; }
  h3 { color: #214c5e; font-weight: 680; }
  .lede { color: #506b74; line-height: 1.72; }
  .muted, .small { color: #536d76; }

  /* Quietly tactile surfaces, with blue and coral reserved for hierarchy and action. */
  .panel, .cycle, .stat, .metric-card, .lead, .cycles-item, .cycles-toolbar {
    background: var(--paper);
    border-color: #d6e3e2;
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-card);
  }
  .panel { padding: clamp(18px, 2vw, 26px); margin-bottom: 22px; }
  .panel-head { margin-bottom: 16px; }
  .cycle { border-top: 3px solid #009ee0; }
  .cycle-year { color: #00648f; font-weight: 500; letter-spacing: -.04em; }
  .track li::before { background: #d5e4e5; }
  .track li.done::before, .track li.now::before { background: #0082b8; }
  .track li.done::after { background: #00648f; border-color: #00648f; }
  .track li.now::after { border-color: #00648f; color: #00577e; box-shadow: 0 0 0 4px rgba(0,158,224,.14); }
  .stat, .metric-card { transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
  .stat:hover, button.metric-card:hover, .insight-metric:hover {
    transform: translateY(-2px);
    border-color: #8bbdca;
    box-shadow: 0 9px 25px rgba(20, 63, 78, .09);
  }
  .metric-card { border-top-color: #009ee0; }
  .metric-card.metric-good { border-top-color: #35844c; }
  .metric-card.metric-alert { border-top-color: #c23551; }

  /* Accessible action tones. SOS coral is retained as identity, with deep ink for text contrast. */
  .btn {
    min-height: 44px;
    padding: 10px 17px;
    border: 1px solid #00648f;
    border-radius: 9px;
    background: #00648f;
    color: #fff;
    font-weight: 680;
    line-height: 1.3;
    box-shadow: 0 1px 1px rgba(13, 54, 74, .08);
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
  }
  .btn:hover:not([disabled]) {
    background: #17405e;
    border-color: #17405e;
    box-shadow: 0 4px 12px rgba(23,64,94,.16);
    transform: translateY(-1px);
  }
  .btn:active:not([disabled]) { transform: translateY(0); }
  .btn[disabled] { opacity: .55; box-shadow: none; }
  .btn-ghost {
    background: #f4faf9;
    color: #005479;
    border-color: #a9cbd1;
    box-shadow: none;
  }
  .btn-ghost:hover:not([disabled]) { background: #e5f3f3; color: #17405e; border-color: #73adba; }
  .btn-warm { background: #a93250; border-color: #a93250; color: #fff; border-inline-start: 4px solid #ec6981; }
  .btn-warm:hover:not([disabled]) { background: #84253e; border-color: #84253e; }
  .btn-small { min-height: 40px; padding: 7px 12px; }
  .btn-ms {
    min-height: 48px;
    background: #fffefa;
    border: 1px solid #a9c0c5;
    color: #193746;
    border-radius: 9px;
    box-shadow: none;
  }
  .btn-ms:hover:not([disabled]) { background: #f1f7f6; border-color: #7099a4; color: #193746; }
  a.btn-ms { display: inline-flex; }
  .lang, .iconbtn, .reminder-icon-button { border-radius: 9px; }

  label.field { margin-bottom: 16px; }
  label.field > span { color: #284c5a; font-size: .88rem; font-weight: 700; margin-bottom: 6px; }
  input[type="text"], input[type="email"], input[type="password"], input[type="date"],
  input[type="search"], input[type="number"], input[type="time"], textarea, select {
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #b9cdd0;
    border-radius: 8px;
    background: #fffefa;
    color: #193746;
    font-size: 1rem;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  }
  textarea { min-height: 96px; line-height: 1.6; }
  input:focus, textarea:focus, select:focus {
    border-color: #007cae;
    outline: 3px solid rgba(0,126,174,.2);
    outline-offset: 0;
    box-shadow: none;
  }
  input[readonly], textarea[readonly] { background: #f2f7f6; color: #435e67; }
  .otp { max-width: 250px; min-height: 56px !important; font-size: 1.5rem !important; border-radius: 10px !important; }

  /* Login is an unmistakable work portal: official wordmark on SOS blue, not a public-facing campaign page. */
  body:not(.signed-in) main {
    display: grid;
    place-items: center;
    width: 100%;
    max-width: none;
    min-height: 100dvh;
    padding: 28px 24px;
    margin: 0;
  }
  .login-wrap {
    width: min(1120px, 100%);
    max-width: 1120px;
    min-height: min(740px, calc(100dvh - 56px));
    grid-template-columns: minmax(0, 1.04fr) minmax(350px, .88fr);
    gap: 0;
    padding: 0;
    align-items: stretch;
    border-radius: 21px;
    overflow: hidden;
    box-shadow: 0 22px 70px rgba(19, 61, 81, .15);
    background: #fffefa;
  }
  .login-intro {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(30px, 5.6vw, 76px);
    background: #075b7d;
    color: #fff;
  }
  .login-intro::before {
    content: "";
    position: absolute;
    z-index: -1;
    width: 460px;
    height: 460px;
    inset-inline-end: -225px;
    bottom: -245px;
    border: 1px solid rgba(226,246,247,.19);
    border-radius: 50%;
    box-shadow: 0 0 0 32px rgba(226,246,247,.035), 0 0 0 72px rgba(226,246,247,.025);
  }
  .login-intro::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset-inline-start: 0;
    top: 16%;
    width: 4px;
    height: 74px;
    background: #ec6981;
    border-radius: 0 4px 4px 0;
  }
  .login-brand { margin: 0 0 clamp(38px, 6vw, 82px); align-items: flex-start; }
  .login-brand .brand-plate {
    background: #00648f;
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  }
  .login-brand .brand-logo { width: min(250px, 100%); }
  .login-brand .brand-text span { color: #d9eff2; font-size: .82rem; }
  .login-intro h1 { color: #fff; font-size: clamp(2rem, 3.4vw, 3.35rem); line-height: 1.08; font-weight: 620; max-width: 17ch; margin-bottom: 16px; }
  .login-intro p { color: #e1f0f2; font-size: 1.03rem; line-height: 1.78; max-width: 43ch; margin: 0 0 24px; }
  .login-intro > .lang { width: fit-content; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.38); }
  .login-intro > .lang:hover { background: rgba(255,255,255,.2); }
  .login-card {
    align-self: center;
    width: calc(100% - 64px);
    margin: 32px;
    padding: clamp(22px, 3vw, 38px);
    border: 1px solid #d8e5e2;
    border-top: 4px solid #ec6981;
    border-radius: 15px;
    background: #fffefa;
    box-shadow: 0 8px 28px rgba(22,68,86,.07);
  }
  .login-card h2 { font-size: 1.45rem; margin: 0 0 24px; color: #19495f; }
  .login-card form > .btn { width: 100%; min-height: 48px; margin-top: 4px; }
  .login-card .btn-ms { margin-bottom: 2px; }
  .login-card .divider { margin: 20px 0; color: #61767d; }
  .login-card .divider::before, .login-card .divider::after { background: #d7e3e2; }
  .login-card .msg { border-radius: 8px; padding: 12px 14px; line-height: 1.55; }
  .login-card .row { gap: 9px; }
  .login-card .row .btn { flex: 1 1 auto; }
  .login-card .qr { padding: 8px; background: #fff; border-radius: 10px; }
  .ms-logo { flex: none; }

  /* Data-rich screens: keep structure clear, tables locally scrollable and forms calm. */
  .table-wrap {
    max-width: 100%;
    border: 1px solid #d5e2e1;
    border-radius: 10px;
    background: #fffefa;
    scrollbar-color: #8eb4bc transparent;
  }
  .table-wrap:focus-visible { outline: 3px solid #bc7b00; outline-offset: 3px; }
  table { font-size: .9rem; }
  th {
    padding: 11px 10px;
    color: #355a67;
    background: #edf5f3;
    border-bottom: 1px solid #cadbd9;
    font-size: .77rem;
    font-weight: 750;
    letter-spacing: .015em;
  }
  td { padding: 11px 10px; border-bottom-color: #e1eae8; }
  tbody tr:hover { background: #f7faf8; }
  td input, td textarea, td select { font-size: 1rem; }
  .table-wrap table.tracker-table { border-radius: 10px; }
  .status {
    border: 1px solid transparent;
    padding: 4px 10px;
    font-size: .76rem;
    line-height: 1.4;
    font-weight: 700;
  }
  .status-draft, .status-returned, .status-not_started { background: #edf1f1; color: #4c6269; }
  .status-submitted, .status-coworker_submitted, .status-in_progress { background: #fff1d4; color: #765200; }
  .status-agreed, .status-supervisor_signed, .status-midpoint_done { background: #e3f2f5; color: #00577e; }
  .status-closed, .status-completed { background: #e7f5eb; color: #23653a; }
  .status-returned { background: #fff0f1; color: #a3203a; }
  .msg { border-radius: 8px; line-height: 1.55; }
  .msg-error { background: #fff0f1; border-color: #c73550; color: #742137; }
  .msg-ok { background: #eaf7ed; border-color: #35844c; color: #205a34; }
  .msg-warn { background: #fff4d9; border-color: #b77900; color: #674900; }
  .msg-info { background: #e8f4f6; border-color: #007cae; color: #174b60; }
  .toast { border: 1px solid rgba(255,255,255,.15); border-radius: 10px; background: #17405e; box-shadow: 0 12px 34px rgba(15,48,65,.24); }
  .actions {
    background: rgba(255,254,250,.98);
    border-color: #d4e2e0;
    box-shadow: 0 -8px 24px rgba(20,63,78,.075);
    backdrop-filter: blur(10px);
  }
  .q { border-color: #d8e4e2; }
  .levels { border-radius: 9px; border-color: #c8d9d8; }
  .levels label { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .levels label:has(input:checked) { background: #00648f; color: #fff; }
  .levels label:has(input:focus-visible) { outline-color: #bc7b00; }
  .lead { border-inline-start-color: #ec6981; }
  .lead-grid { gap: 18px; }

  /* Tune existing purpose-built pages to one visual language without altering their semantics. */
  .hr-overview-header, .cycles-header { border-color: #d1e1df; }
  .hr-eyebrow, .cycles-eyebrow { color: #00648f; }
  .hr-hero, .cycles-report { border-top-color: #009ee0; border-radius: 14px; }
  .hr-kpi, .cycles-stat { border-radius: 10px; }
  .cycles-item { border-inline-start-color: #009ee0; }
  .cycles-empty { background: #f5faf8; border-color: #b7cece; }
  .cycles-actions .btn { min-height: 42px; }
  .team-stat, .tfu-stat { border-radius: 10px; background: #fffefa; }
  .team-stat, .tfu-stat { min-height: 44px; }
  .team-search input, .tfu-member-filter select, .tfu-form select, .tfu-form input,
  .tfu-form textarea, .team-actions .btn { min-height: 44px; }
  .team-stat:hover, .team-stat[aria-pressed="true"], .tfu-stat:hover { background: #eaf5f4; }
  .team-filter { min-height: 44px; border-radius: 999px; }
  .team-filter[aria-pressed="true"] { background: #00648f; border-color: #00648f; }
  .team-grid tr { background: #fffefa; }
  .team-grid tr.team-review td:first-child { box-shadow: inset 3px 0 0 #009ee0; }
  html[dir="rtl"] .team-grid tr.team-review td:first-child { box-shadow: inset -3px 0 0 #009ee0; }
  .tfu-card { border-radius: 12px; background: #fffefa; }
  .tfu-card, .workflow-form { border-inline-start-color: #009ee0; }
  .workflow-form { background: #fffefa; }
  .ap-tab { border-radius: 8px 8px 0 0; }
  .ap-tab.is-active { background: #e7f3f3; border-bottom-color: #00648f; }
  .ap-inline-form { background: #f5faf8; border-color: #a9cbd1; }
  .ap-status-active, .ap-case-open { color: #00577e; }
  .attention-panel { border-inline-start-color: #d19100; }
  .reminder-icon-button { width: 44px; height: 44px; border-radius: 9px; }
  .reminder-dialog { border-radius: 14px; }

  @media (max-width: 1023px) {
    :root { --sidebar-width: 264px; }
    .top { position: sticky; top: 0; }
    .sidebar { width: min(320px, calc(100vw - 24px)); }
    body.sidebar-compact .brand-plate { background: #00648f; }
    .sidebar-head { padding-inline: 4px; }
    .top-inner { min-height: 68px; }
    .btn-small, .cycles-actions .btn { min-height: 44px; }
  }
  @media (max-width: 767px) {
    body:not(.signed-in) main { display: block; padding: 0; }
    main { padding-block: 22px 60px; }
    .top-inner { padding-inline: 14px; }
    .top-title { font-size: .86rem; }
    .menu-toggle { min-height: 44px; }
    .top-tools { gap: 7px; }
    .panel, .cycle { padding: 17px; border-radius: 11px; }
    .panel-head { align-items: flex-start; }
    .actions {
      position: static;
      margin-inline: -17px;
      margin-bottom: -17px;
      border-radius: 0 0 11px 11px;
      box-shadow: none;
      backdrop-filter: none;
    }
    .actions .btn { flex: 1 1 140px; }
    .table-wrap { border-radius: 8px; }
    .table-wrap table { font-size: .85rem; }
    .team-grid tr { border-radius: 10px; }
    .login-wrap {
      width: min(100% - 24px, 560px);
      min-height: 0;
      display: flex;
      flex-direction: column;
      margin: 12px auto;
      padding: 0;
      border-radius: 16px;
    }
    .login-intro { min-height: 245px; padding: 24px 25px 28px; }
    .login-brand { margin-bottom: 22px; }
    .login-brand .brand-logo { width: 202px; }
    .login-intro h1 { font-size: clamp(1.75rem, 8vw, 2.35rem); max-width: 17ch; margin-bottom: 9px; }
    .login-intro p { font-size: .94rem; line-height: 1.62; margin-bottom: 15px; }
    .login-card { width: auto; align-self: stretch; margin: 0; padding: 25px; border: 0; border-top: 3px solid #ec6981; border-radius: 0; box-shadow: none; }
  }
  @media (max-width: 420px) {
    .top-inner { gap: 7px; }
    .top-title { flex: 1 1 110px; }
    .top-tools { width: 100%; }
    .who { max-width: 46%; font-size: .78rem; }
    .login-wrap { width: calc(100% - 16px); margin: 8px auto; }
    .login-intro { min-height: 228px; padding: 22px 20px 24px; }
    .login-intro h1 { font-size: 1.8rem; }
    .login-intro p { font-size: .88rem; }
    .login-card { padding: 21px 19px 24px; }
    .login-card h2 { margin-bottom: 20px; }
    .panel, .cycle { padding: 14px; }
    .actions { margin-inline: -14px; margin-bottom: -14px; padding-inline: 14px; }
    .stats, .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .team-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .team-stat { padding: 8px 6px; }
    .track { grid-template-columns: 1fr 1fr; }
    .btn { padding-inline: 12px; }
  }
  @media (min-width: 1440px) {
    body.signed-in main > div { max-width: 1560px; }
    .top-inner { padding-inline: clamp(28px, 3vw, 54px); }
  }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  }
}
