:root {
  color-scheme: light;
  --navy: #0b1f33;
  --teal: #0b7c8f;
  --teal-strong: #08697a;
  --teal-soft: #ecfafc;
  --bg: #f4f7fa;
  --surface: #fff;
  --line: #e0e7ef;
  --line-strong: #c9d4e0;
  --text: #0b1f33;
  --text-2: #4a5b70;
  --ok: #157a3f; --ok-bg: #e7f6ed;
  --warn: #a35a00; --warn-bg: #fff3e0;
  --bad: #c0322b; --bad-bg: #fdeceb;
  --btn-text: #fff;
  --shadow: 0 4px 16px rgba(11, 31, 51, .07), 0 1px 3px rgba(11, 31, 51, .05);
  --font: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --teal: #42cce2;
  --teal-strong: #7fdded;
  --teal-soft: #10303a;
  --bg: #0a1622;
  --surface: #122232;
  --line: #24384c;
  --line-strong: #35506a;
  --text: #e8eef4;
  --text-2: #a9b8c7;
  --ok: #6fd69b; --ok-bg: #123427;
  --warn: #f2b866; --warn-bg: #38280f;
  --bad: #f49a94; --bad-bg: #3c1a19;
  --btn-text: #0b1f33;
  --shadow: 0 4px 16px rgba(0, 0, 0, .3);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.7;
}
[hidden] { display: none !important; }
a { color: var(--teal-strong); }
h1 { font-size: 1.6rem; line-height: 1.3; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 14px; }
.muted { color: var(--text-2); margin: 0 0 18px; }
.ltr, .ltr-text { direction: ltr; unicode-bidi: plaintext; }
input.ltr { text-align: left; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; text-decoration: none; }
.brand img { border-radius: 8px; }
.topnav { display: flex; align-items: center; gap: 16px; font-size: .95rem; }
.topnav a { color: var(--text-2); text-decoration: none; }
.topnav a:hover { color: var(--text); }
.topnav form { margin: 0; }
.link { background: none; border: 0; padding: 0; color: var(--text-2); font: inherit; cursor: pointer; }
.link:hover { color: var(--text); }
.theme { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text-2); cursor: pointer; }
.theme svg { width: 18px; height: 18px; fill: currentColor; }
.page { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 28px 20px; }
.page-auth { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.foot { padding: 16px 20px; text-align: center; color: var(--text-2); font-size: .85rem; }
.auth { width: 100%; max-width: 420px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.auth-wide { max-width: 500px; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 5px; font-weight: 500; font-size: .95rem; }
.form small { color: var(--text-2); font-weight: 400; }
.label-row { display: flex; align-items: baseline; gap: 6px; }
.opt { color: var(--text-2); font-weight: 400; font-size: .82rem; }
input[type=text], input[type=url], textarea, input[type=search], input[type=date], input[type=email], input[type=password], input[type=tel], select {
  width: 100%; min-height: 44px; padding: 9px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid rgba(66, 204, 226, .55); outline-offset: 1px; }
.choices { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices legend { padding: 0; margin-bottom: 5px; font-weight: 500; font-size: .95rem; }
.choice { position: relative; display: block !important; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: block; height: 100%; padding: 12px; border: 1px solid var(--line-strong); border-radius: 12px; }
.choice small { display: block; }
.choice input:checked + span { border-color: var(--teal); background: var(--teal-soft); box-shadow: inset 0 0 0 1px var(--teal); }
.choice input:focus-visible + span { outline: 3px solid rgba(66, 204, 226, .55); }
.org-fields { display: grid; gap: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 20px;
  background: var(--teal); color: var(--btn-text); border: 1px solid transparent; border-radius: 10px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--teal-strong); }
.btn-quiet { background: transparent; color: var(--teal-strong); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--teal-soft); }
.btn-sm { min-height: 38px; padding: 4px 14px; font-size: .9rem; }
.links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 16px 0 0; font-size: .92rem; }
.alert { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; width: 100%; padding: 11px 14px; margin-bottom: 16px; border-radius: 10px; font-size: .95rem; }
.alert form { margin: 0; }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-info { background: var(--teal-soft); color: var(--teal-strong); }
.alert-warning { background: var(--warn-bg); color: var(--warn); }
.alert-error { background: var(--bad-bg); color: var(--bad); }
.page-auth > .alert { max-width: 420px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .muted { margin: 0; }
.switch { display: flex; align-items: flex-end; gap: 8px; margin: 0; }
.switch label { display: grid; gap: 3px; font-size: .85rem; color: var(--text-2); }
.card, .services { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); }
.services, .invites { margin-bottom: 18px; }
.empty { padding: 26px 16px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; }
.empty p { margin: 4px 0 0; color: var(--text-2); font-size: .95rem; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: .95rem; }
dt { color: var(--text-2); }
dd { margin: 0; text-align: left; overflow-wrap: anywhere; }
.rows { list-style: none; margin: 0 0 12px; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows small { display: block; color: var(--text-2); }
.badge { padding: 1px 10px; border-radius: 999px; font-size: .8rem; background: var(--teal-soft); color: var(--teal-strong); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.page-center { margin: 8px auto; }
h3 { font-size: 1rem; margin: 20px 0 6px; }
.inline { display: inline; margin: 0; }
.member-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.member-actions select { min-height: 36px; width: auto; padding: 3px 8px; }
.link-danger { color: var(--bad); }
.link-danger:hover { color: var(--bad); text-decoration: underline; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: var(--bad); filter: brightness(.92); }
.form-row { grid-template-columns: 1fr 1fr auto; align-items: end; }
.rows a { color: var(--text); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 6px 12px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: .93rem; }
.tabs a:hover { background: var(--teal-soft); }
.tabs a[aria-current] { background: var(--teal-soft); color: var(--teal-strong); font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { display: grid; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.stat span { color: var(--text-2); font-size: .88rem; }
.stat b { font-size: 1.5rem; }
.stack { display: grid; gap: 18px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.form-inline { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.table-wrap { overflow-x: auto; padding: 8px 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: start; color: var(--text-2); font-weight: 500; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.block { display: block; color: var(--text-2); }
.muted-inline { color: var(--text-2); font-weight: 400; }
.order-head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.price { text-align: left; }
.cancel-form { margin: 10px 0 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.list-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0 0 16px; }
.list-tools label { display: grid; gap: 3px; flex: 1 1 170px; font-size: .85rem; color: var(--text-2); }
.list-tools label:first-of-type { flex: 3 1 240px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; color: var(--text-2); }
.payment { padding: 10px 0; border-top: 1px solid var(--line); }
.payment details { margin-top: 8px; }
.payment summary { cursor: pointer; color: var(--text-2); font-size: .9rem; }
.payment details .form { margin-top: 8px; }
.feature-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }
.feature-row .limit { width: 110px; min-height: 38px; padding: 4px 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; }
.checks { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks legend { padding: 0; margin-bottom: 6px; font-size: .93rem; }
.checks .check { flex: none; min-width: 0; font-weight: 400; }
input[type=number], input[type=date] { width: 100%; min-height: 44px; padding: 9px 12px; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; }
.plan-price { font-size: 1.7rem; font-weight: 700; margin: 0; }
.plan-price small { font-size: .9rem; font-weight: 400; }
.plan-list { margin: 0 0 12px; padding-inline-start: 18px; font-size: .93rem; }
.qr-box { display: flex; justify-content: center; margin: 12px 0; }
.qr { width: 220px; height: 220px; max-width: 100%; border-radius: 8px; }
.secret { font-family: monospace; font-size: .95rem; text-align: center; user-select: all; }
.recovery-codes { list-style: none; margin: 14px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; font-family: monospace; text-align: center; }
.recovery-codes li { padding: 8px; border-radius: 8px; background: var(--teal-soft); color: var(--teal-strong); }
.audit-details { font-size: .85rem; word-break: break-word; }
@media (max-width: 800px) {
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .grid, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
}
@media (max-width: 480px) {
  .topbar { padding: 10px 16px; }
  .topnav { gap: 10px; font-size: .85rem; }
  .brand span { display: none; }
  .page { padding: 18px 16px; }
  .auth { padding: 20px; }
  .switch { width: 100%; }
  .switch label { flex: 1; }
}
