/* my.wateer web (login, signup, consents, privacy centre) — design system v2.
   Tokens: brand blue #075AA1 for text/links/borders, #0A4584 only behind white text
   (filled buttons, AA). Thmanyah Sans, Latin digits. Light + dark through html[data-theme].
   Everything is namespaced `.myw` / `.myw-*`; it never restyles the shared portal classes. */

@font-face { font-family: 'Thmanyah Sans'; src: url('../fonts/thmanyahsans-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Thmanyah Sans'; src: url('../fonts/thmanyahsans-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Thmanyah Sans'; src: url('../fonts/thmanyahsans-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --myw-bg: #f8f9fa;
  --myw-surface: #ffffff;
  --myw-text: #212529;
  --myw-muted: #545b62;
  --myw-border: #dee2e6;
  --myw-border-soft: #e9ecef;
  --myw-primary: #075aa1;      /* text, links, focus ring */
  --myw-fill: #0a4584;         /* behind white text */
  --myw-fill-hover: #083a70;
  --myw-soft: #e7f0f9;         /* info card */
  --myw-danger: #b42318;
  --myw-danger-bg: #fbeaea;
  --myw-danger-border: #e8b4b4;
  --myw-success: #0f6b3f;
  --myw-success-bg: #e6f4ec;
  --myw-warn: #8a5a00;
  --myw-warn-bg: #fff4dc;
  --myw-radius: 14px;
  --myw-font: 'Thmanyah Sans', 'IBM Plex Sans Arabic', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
html[data-theme="dark"] {
  --myw-bg: #101216;
  --myw-surface: #1a1d23;
  --myw-text: #f1f3f5;
  --myw-muted: #aeb6bd;
  --myw-border: #343a42;
  --myw-border-soft: #2a2f36;
  --myw-primary: #6db3ee;
  --myw-fill: #0a4584;
  --myw-fill-hover: #0d559f;
  --myw-soft: #16283a;
  --myw-danger: #ff9b8f;
  --myw-danger-bg: #3a1e1e;
  --myw-danger-border: #6b3030;
  --myw-success: #6fd3a0;
  --myw-success-bg: #14301f;
  --myw-warn: #f2c76b;
  --myw-warn-bg: #33290f;
}

/* ---------- page shell (login / signup) ---------- */
body.myw {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--myw-bg);
  color: var(--myw-text);
  font-family: var(--myw-font);
  font-size: 16px;
  line-height: 1.6;
  display: block;
  -webkit-font-smoothing: antialiased;
}
.myw *, .myw *::before, .myw *::after { box-sizing: border-box; }
.myw a { color: var(--myw-primary); }
.myw :focus-visible { outline: 2px solid var(--myw-primary); outline-offset: 2px; }
.myw-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; padding: 12px 20px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }

.myw-top { display: flex; align-items: center; gap: 10px; padding-top: 6px; }
.myw-top { justify-content: space-between; }
.myw-top-end { display: flex; align-items: center; gap: 10px; }
.myw-top .myw-logo { height: 40px; width: auto; display: block; }
html[data-theme="dark"] .myw-top .myw-logo { filter: brightness(1.7) saturate(.9); }
.myw-lang { display: inline-flex; border: 1px solid var(--myw-border); border-radius: 999px; background: var(--myw-surface); padding: 3px; }
.myw-lang button { min-height: 38px; min-width: 52px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--myw-muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.myw-lang button.active { background: var(--myw-soft); color: var(--myw-primary); font-weight: 700; }
.myw-theme { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--myw-border); background: var(--myw-surface); color: var(--myw-text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.myw-theme svg { width: 20px; height: 20px; }
html[data-theme="dark"] .myw-theme .i-moon, html:not([data-theme="dark"]) .myw-theme .i-sun { display: none; }

.myw-main { flex: 1; display: flex; flex-direction: column; padding-top: 28px; }
.myw-tile { width: 52px; height: 52px; border-radius: 16px; background: var(--myw-soft); color: var(--myw-primary); display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.myw-tile svg { width: 26px; height: 26px; }
.myw h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.3; font-weight: 700; color: var(--myw-text); }
.myw .myw-sub { margin: 0 0 24px; color: var(--myw-muted); font-size: 16px; }
.myw-ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; font-weight: 700; color: var(--myw-text); }

/* ---------- fields ---------- */
.myw-field { margin-bottom: 14px; }
.myw-field > label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 700; color: var(--myw-text); }
.myw-input, .myw-phone { width: 100%; min-height: 54px; border: 1.5px solid var(--myw-border); border-radius: 14px; background: var(--myw-surface); color: var(--myw-text); font: inherit; font-size: 17px; }
.myw-input { padding: 0 16px; }
.myw-phone { display: flex; align-items: stretch; overflow: hidden; direction: ltr; }
.myw-phone:focus-within, .myw-input:focus { border-color: var(--myw-primary); box-shadow: 0 0 0 3px var(--myw-soft); outline: 0; }
.myw .myw-phone .input-prefix { position: static; transform: none; inset: auto; pointer-events: none; display: flex; align-items: center; padding: 0 16px; background: var(--myw-bg); border-inline-end: 1px solid var(--myw-border-soft); color: var(--myw-text); font-size: 17px; font-weight: 700; }
.myw .myw-phone input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--myw-text); font: inherit; font-size: 17px; padding: 0 16px; text-align: left; direction: ltr; letter-spacing: .02em; }
.myw .myw-phone input::placeholder, .myw-input::placeholder { color: #8a929a; }
.myw-hint { margin: 6px 2px 0; font-size: 13px; color: var(--myw-muted); }
.myw-field.has-error .myw-input, .myw-field.has-error .myw-phone { border-color: var(--myw-danger); }

/* ---------- buttons ---------- */
.myw-btn { width: 100%; min-height: 54px; border: 0; border-radius: 14px; background: var(--myw-fill); color: #fff; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.myw-btn:hover:not(:disabled) { background: var(--myw-fill-hover); }
.myw-btn:disabled { opacity: .5; cursor: not-allowed; }
.myw-btn .spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: myw-spin .7s linear infinite; }
@keyframes myw-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .myw-btn .spin { animation-duration: 2s; } }
.myw-link { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--myw-primary); font: inherit; font-size: 15px; font-weight: 500; text-decoration: underline; cursor: pointer; }
.myw-link:disabled { color: var(--myw-muted); text-decoration: none; cursor: default; }
.myw-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; }
.myw-timer { color: var(--myw-muted); font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---------- code boxes ---------- */
.myw-code { display: flex; gap: 12px; justify-content: center; direction: ltr; margin: 4px 0 18px; }
.myw-code input { width: 64px; height: 68px; border: 1.5px solid var(--myw-border); border-radius: 14px; background: var(--myw-surface); color: var(--myw-text); font: inherit; font-size: 28px; font-weight: 700; text-align: center; padding: 0; }
.myw-code input:focus { border-color: var(--myw-primary); box-shadow: 0 0 0 3px var(--myw-soft); outline: 0; }
.myw-code.is-error input { border-color: var(--myw-danger); }
@media (max-width: 360px) { .myw-code { gap: 8px; } .myw-code input { width: 56px; height: 62px; } }
.myw-back { align-self: flex-start; background: none; border: 0; min-height: 44px; padding: 0; margin-bottom: 8px; color: var(--myw-primary); font: inherit; font-size: 15px; font-weight: 500; text-decoration: underline; cursor: pointer; }

/* ---------- banners & cards ---------- */
.myw-banner { display: none; gap: 10px; padding: 14px 16px; border-radius: 14px; margin: 0 0 16px; align-items: flex-start; font-size: 15px; }
.myw-banner.show { display: flex; }
.myw-banner svg { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 3px; }
.myw-banner strong { display: block; font-size: 16px; margin-bottom: 2px; }
.myw-banner.error { background: var(--myw-danger-bg); color: var(--myw-danger); border: 1px solid var(--myw-danger-border); }
.myw-banner.success { background: var(--myw-success-bg); color: var(--myw-success); }
.myw-banner.info { background: var(--myw-soft); color: var(--myw-text); }
.myw-banner.info svg { color: var(--myw-primary); }
.myw-banner.warn { background: var(--myw-warn-bg); color: var(--myw-warn); }
.myw-note { margin-top: auto; padding: 14px 16px; border-radius: 14px; background: var(--myw-soft); color: var(--myw-text); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.myw-note svg { flex: 0 0 20px; width: 20px; height: 20px; color: var(--myw-primary); margin-top: 2px; }
.myw-foot { margin-top: 22px; text-align: center; font-size: 15px; color: var(--myw-muted); }
.myw-foot p { margin: 0 0 4px; }
.myw-spacer { flex: 1; min-height: 24px; }

/* explicit consent card (.r-check, as in the invoice page's consent wall) */
.myw-check { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1.5px solid var(--myw-border); border-radius: 14px; background: var(--myw-surface); margin-bottom: 14px; cursor: pointer; }
.myw-check input { flex: 0 0 24px; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--myw-fill); cursor: pointer; }
.myw-check b { display: block; font-size: 16px; }
.myw-check span { color: var(--myw-muted); font-size: 14px; }
.myw-check:has(input:checked) { border-color: var(--myw-primary); }
.myw-check.has-error { border-color: var(--myw-danger); }
.myw-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.myw [hidden] { display: none !important; }

@media (min-width: 768px) {
  body.myw { display: flex; align-items: flex-start; justify-content: center; background: var(--myw-bg); }
  .myw-page { margin-top: 48px; min-height: 0; padding: 20px 36px 36px; background: var(--myw-surface); border: 1px solid var(--myw-border-soft); border-radius: 24px; box-shadow: 0 8px 32px rgba(18,17,59,.06); }
  .myw-note { margin-top: 28px; }
}

/* ================= consents + privacy centre =================
   Used on top of the portal shell (consents) and on the standalone privacy centre. */
.myw-consents { max-width: 720px; margin: 0 auto; font-family: var(--myw-font); color: var(--myw-text); }
.myw-consents h1 { font-size: 26px; font-weight: 700; margin: 0 0 6px; }
.myw-consents .myw-lede { color: var(--myw-muted); margin: 0 0 22px; font-size: 16px; }
.myw-consents h2 { font-size: 18px; font-weight: 700; margin: 28px 0 6px; color: var(--myw-text); }
.myw-consents .myw-lede-sm { color: var(--myw-muted); margin: 0 0 12px; font-size: 14px; }
.myw-cards { display: flex; flex-direction: column; gap: 10px; }
.myw-card { background: var(--myw-surface); border: 1px solid var(--myw-border); border-radius: 14px; padding: 14px 16px; }
.myw-card.consent-item { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.myw-card .consent-info { min-width: 0; flex: 1; }
.myw-card h5 { margin: 0 0 4px; font-size: 16px; font-weight: 700; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--myw-text); }
.myw-card p { margin: 0; font-size: 14px; color: var(--myw-muted); }
.myw-card .myw-doclink { display: inline-block; margin-top: 6px; font-size: 14px; }
.myw-consents .consent-badge { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; text-transform: none; letter-spacing: 0; }
.myw-consents .badge-active { background: var(--myw-success-bg); color: var(--myw-success); }
.myw-consents .badge-revoked { background: var(--myw-danger-bg); color: var(--myw-danger); }
.myw-consents .btn-revoke, .myw-consents .btn-grant { min-height: 44px; padding: 0 16px; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; flex-shrink: 0; background: transparent; }
.myw-consents .btn-revoke { color: var(--myw-danger); border: 1.5px solid var(--myw-danger-border); }
.myw-consents .btn-revoke:hover { background: var(--myw-danger-bg); }
.myw-consents .btn-grant { color: var(--myw-primary); border: 1.5px solid var(--myw-primary); }
.myw-consents .btn-grant:hover { background: var(--myw-soft); }
.myw-consents button:disabled { opacity: .5; cursor: not-allowed; }
.myw-empty { text-align: center; padding: 22px 16px; border: 1.5px dashed var(--myw-border); border-radius: 14px; color: var(--myw-muted); font-size: 15px; }
.myw-form select, .myw-form textarea { width: 100%; border: 1.5px solid var(--myw-border); border-radius: 12px; background: var(--myw-surface); color: var(--myw-text); font: inherit; font-size: 16px; padding: 12px 14px; }
.myw-form select { min-height: 48px; }
.myw-form { display: flex; flex-direction: column; gap: 12px; }
.myw-form .myw-btn { width: auto; align-self: flex-start; padding: 0 28px; min-height: 48px; }
.myw-status { font-size: 14px; margin-top: 10px; }
.myw-req { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; background: var(--myw-surface); border: 1px solid var(--myw-border-soft); border-radius: 12px; }
.myw-req small { color: var(--myw-muted); }
.myw-req .st { font-weight: 700; font-size: 14px; }
.myw-req .st.done { color: var(--myw-success); }
.myw-req .st.pending { color: var(--myw-warn); }
.myw-modal-bg { display: none; position: fixed; inset: 0; background: rgba(18,17,59,.5); z-index: 1000; align-items: flex-end; justify-content: center; }
.myw-modal-bg.open { display: flex; }
.myw-modal { background: var(--myw-surface); color: var(--myw-text); width: 100%; max-width: 440px; border-radius: 24px 24px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); font-family: var(--myw-font); }
@media (min-width: 600px) { .myw-modal-bg { align-items: center; } .myw-modal { border-radius: 24px; } }
.myw-modal h4 { margin: 0 0 8px; font-size: 20px; font-weight: 700; color: var(--myw-text); }
.myw-modal p { margin: 0 0 18px; color: var(--myw-muted); font-size: 15px; }
.myw-modal .acts { display: flex; gap: 10px; flex-direction: column-reverse; }
@media (min-width: 600px) { .myw-modal .acts { flex-direction: row; } .myw-modal .acts button { flex: 1; } }
.myw-modal .acts button { min-height: 50px; border-radius: 14px; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.myw-modal #revokeConfirmBtn { background: var(--myw-danger); color: #fff; border: 0; }
html[data-theme="dark"] .myw-modal #revokeConfirmBtn { background: #b42318; }
.myw-modal #revokeCancelBtn { background: transparent; color: var(--myw-primary); border: 1.5px solid var(--myw-border); }
.myw-modal .warn-ico { width: 44px; height: 44px; border-radius: 14px; background: var(--myw-danger-bg); color: var(--myw-danger); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; font-size: 20px; }

/* embedded (opened from the app inside a WebView): the app header is enough */
html[data-embed="1"] .sidebar, html[data-embed="1"] .topbar, html[data-embed="1"] .sidebar-overlay, html[data-embed="1"] .skip-to-main { display: none !important; }
html[data-embed="1"] .main-content { margin-inline-start: 0 !important; width: 100% !important; }
html[data-embed="1"] .content-area { padding: 16px !important; }

/* privacy centre */
.myw-centre { width: 100%; max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }
.myw-centre .hero { background: linear-gradient(135deg, #12113b 0%, #0a4584 60%, #075aa1 100%); color: #fff; border-radius: 24px; padding: 28px 22px; margin-bottom: 18px; }
.myw-centre .hero h1 { color: #fff; margin: 0 0 6px; font-size: 26px; }
.myw-centre .hero p { margin: 0; opacity: .92; font-size: 15px; }
.myw-links { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .myw-links { grid-template-columns: 1fr 1fr; } }
.myw .myw-linkcard, .myw-linkcard { display: flex; gap: 14px; align-items: center; min-height: 72px; padding: 14px 16px; background: var(--myw-surface); border: 1px solid var(--myw-border); border-radius: 14px; color: var(--myw-text); text-decoration: none; }
.myw-linkcard:hover { border-color: var(--myw-primary); }
.myw-linkcard .ic { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px; background: var(--myw-soft); color: var(--myw-primary); display: flex; align-items: center; justify-content: center; }
.myw-linkcard .ic svg { width: 22px; height: 22px; }
.myw-linkcard strong { display: block; font-size: 16px; }
.myw-linkcard small { color: var(--myw-muted); font-size: 14px; }
.myw-centre .myw-card { margin-top: 14px; padding: 18px; }
.myw-centre .myw-card h2 { margin: 0 0 6px; font-size: 18px; color: var(--myw-primary); }
.myw-centre .foot { text-align: center; color: var(--myw-muted); font-size: 14px; margin-top: 28px; }
.myw-centre .myw-theme-fixed { position: fixed; top: 14px; inset-inline-end: 14px; z-index: 50; }


/* wateer-portal.css still carries the old step rules (#verifyOtpBtn {display:none}, ...). */
.myw #verifyOtpBtn { display: inline-flex; }
.myw a.myw-linkcard { color: var(--myw-text); }

/* privacy centre: sign-in sheet + the consents / data pages (privacy_center*.html) */
.pc-sheet { position: relative; }
.pc-sheet .myw-code { margin-top: 8px; }
.pc-sheet .myw-field { margin-bottom: 16px; }
.pc-x { position: absolute; top: 8px; inset-inline-end: 8px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--myw-muted); font-size: 28px; line-height: 1; cursor: pointer; border-radius: 12px; }
.pc-x:hover { background: var(--myw-soft); color: var(--myw-text); }
.pc-sheet h4 { padding-inline-end: 40px; }
.pc-back { display: inline-flex; align-items: center; min-height: 44px; margin: 0 0 6px; color: var(--myw-primary); font-size: 15px; font-weight: 500; }
.myw-centre .pc-section h2 { margin: 0 0 6px; }
.myw-centre .pc-section h3 { margin: 22px 0 10px; font-size: 16px; color: var(--myw-text); }
.pc-section .myw-lede-sm { color: var(--myw-muted); margin: 0 0 14px; font-size: 14px; }
.myw-btn.pc-auto { width: auto; padding: 0 28px; min-height: 48px; }
.pc-btn-outline, .pc-btn-outline-danger, .pc-btn-danger, .pc-btn-ghost { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 14px; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; text-decoration: none; }
.pc-btn-outline { border: 1.5px solid var(--myw-primary); background: transparent; color: var(--myw-primary); }
.pc-btn-outline:hover { background: var(--myw-soft); }
.pc-btn-outline.pc-small { min-height: 40px; padding: 0 16px; font-size: 14px; }
.pc-btn-outline-danger { border: 1.5px solid var(--myw-danger-border); background: transparent; color: var(--myw-danger); }
.pc-btn-outline-danger:hover { background: var(--myw-danger-bg); }
.pc-btn-danger { border: 0; background: var(--myw-danger); color: #fff; }
html[data-theme="dark"] .pc-btn-danger { background: #b42318; }
.pc-btn-ghost { border: 1.5px solid var(--myw-border); background: transparent; color: var(--myw-primary); }
.pc-btn-danger:disabled, .myw-modal .acts button:disabled { opacity: .5; cursor: not-allowed; }
.myw-modal .acts .pc-btn-danger { background: var(--myw-danger); color: #fff; border: 0; }
html[data-theme="dark"] .myw-modal .acts .pc-btn-danger { background: #b42318; }
.myw-modal .acts .pc-btn-ghost { background: transparent; color: var(--myw-primary); border: 1.5px solid var(--myw-border); }
.pc-confirm { margin-top: 16px; padding: 16px; border: 1.5px solid var(--myw-danger-border); border-radius: 14px; background: var(--myw-danger-bg); color: var(--myw-text); }
.pc-confirm h3 { margin: 0 0 8px; color: var(--myw-danger); }
.pc-what { margin: 0 0 6px; font-weight: 700; }
.pc-steps { margin: 0 0 12px; padding-inline-start: 22px; font-size: 15px; list-style: decimal; }
.pc-steps li { margin-bottom: 8px; }
.pc-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.pc-req-end { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.myw-req .st.bad { color: var(--myw-danger); }
@media (max-width: 480px) { .pc-acts > * { flex: 1 1 100%; } }
/* «My rights» panel (templates/partials/rights_panel.html), shared by the portal and the privacy centre. */
.rp-item h3 { margin: 0 0 6px; font-size: 18px; color: var(--myw-text); }
.rp-item .pc-btn-outline-danger, .rp-item .pc-btn-outline { align-self: flex-start; }
.pc-confirm h4 { margin: 0 0 8px; font-size: 16px; color: var(--myw-danger); }
.pc-confirm.pc-calm { border-color: var(--myw-border); background: var(--myw-soft); }
.pc-confirm.pc-calm h4 { color: var(--myw-text); }
.pc-confirm .myw-form label { font-weight: 700; font-size: 15px; }
.pc-confirm[hidden] { display: none; }
