/* ============ منصة الفرق — نظام التصميم ============ */
:root {
  --bg: #f3f5fb; --surface: #ffffff; --surface-2: #f7f8fd; --line: #e4e8f3; --line-2: #d6dbec;
  --text: #171b3a; --muted: #6a7092; --faint: #9aa0bd;
  --primary: #2f3187; --primary-600: #25276f; --primary-soft: #ecedfb; --on-primary: #fff;
  --accent: #d62027; --gold: #f0a81b; --sky: #2a7fc4;
  --green: #12a150; --green-soft: #e3f6ec; --amber: #d98200; --amber-soft: #fff3dc;
  --red: #d62027; --red-soft: #fde9ea; --blue: #2a7fc4; --blue-soft: #e4f0fb; --violet: #7a4fd6; --violet-soft: #f0eafc; --gray-soft: #eceef6;
  --radius: 14px; --radius-sm: 10px; --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(23,27,58,.05), 0 4px 14px rgba(23,27,58,.05);
  --shadow-lg: 0 10px 40px rgba(23,27,58,.18);
  --sb-w: 268px; --top-h: 66px;
  --font: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  --sb-from: #1b1d55; --sb-to: #2f3187;
  --ring: 0 0 0 3px rgba(47,49,135,.18);
}
[data-theme="dark"] {
  --bg: #0e1020; --surface: #171a30; --surface-2: #1c2038; --line: #272b48; --line-2: #343959;
  --text: #eceefb; --muted: #9ba1c4; --faint: #6c7297;
  --primary: #8b8ef0; --primary-600: #a3a6f6; --primary-soft: #23274a; --on-primary: #0e1020;
  --green-soft: #12301f; --amber-soft: #382a0e; --red-soft: #3a1518; --blue-soft: #12293f; --violet-soft: #28204a; --gray-soft: #23274a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  --ring: 0 0 0 3px rgba(139,142,240,.28);
}
[data-area="team"] { --sb-from: #0c3558; --sb-to: #1f6ea8; }
[data-area="member"] { --sb-from: #4a1030; --sb-to: #a3262f; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0 0 .6em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.center { text-align: center; } .nowrap { white-space: nowrap; } .grow { flex: 1; } .w-full { width: 100%; }
.mt { margin-top: 16px; } .mt-l { margin-top: 24px; } .mb { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sb-w); background: linear-gradient(170deg, var(--sb-from), var(--sb-to)); color: #e9eafc; display: flex; flex-direction: column; z-index: 60; transition: transform .25s ease; }
.main { margin-inline-start: var(--sb-w); min-height: 100vh; display: flex; flex-direction: column; }
.sb-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; }
.sb-brand img { border-radius: 50%; background: #fff; padding: 2px; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.sb-brand-text { display: flex; flex-direction: column; min-width: 0; }
.sb-brand-text strong { font-size: 16px; color: #fff; }
.sb-brand-text span { font-size: 12px; color: #b9bcf0; }
.icon-btn.sb-close { display: none; margin-inline-start: auto; color: #fff; }
.icon-btn.sb-close:hover { background: rgba(255,255,255,.12); color: #fff; }
.sb-team { display: flex; gap: 10px; align-items: center; margin: 4px 14px 8px; padding: 10px 12px; background: rgba(255,255,255,.1); border-radius: 12px; border: 1px solid rgba(255,255,255,.12); }
.sb-team-ic { width: 36px; height: 36px; border-radius: 10px; background: var(--team); display: grid; place-items: center; color: #fff; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.sb-team div { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sb-team strong { font-size: 14px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-team span { font-size: 12px; color: #c4c7f3; }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
.sb-group { margin-bottom: 10px; }
.sb-label { font-size: 11.5px; letter-spacing: .04em; color: #9fa3dd; padding: 10px 12px 6px; font-weight: 600; }
.sb-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: #dfe1fb; font-weight: 500; transition: background .15s, color .15s; position: relative; }
.sb-link:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.sb-link.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.sb-link.active::before { content: ''; position: absolute; inset-inline-start: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 4px; background: var(--gold); }
.sb-link.is-soon { opacity: .55; cursor: default; }
.sb-link.is-soon:hover { background: none; color: #dfe1fb; }
.sb-link em { margin-inline-start: auto; font-style: normal; font-size: 10.5px; background: rgba(255,255,255,.15); padding: 1px 8px; border-radius: 20px; }
.sb-badge { margin-inline-start: auto; background: var(--accent); color: #fff; font-size: 11px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 20px; display: grid; place-items: center; }
.sb-foot { padding: 12px 18px 16px; font-size: 11.5px; color: #9fa3dd; border-top: 1px solid rgba(255,255,255,.1); }

.topbar { position: sticky; top: 0; z-index: 40; height: var(--top-h); display: flex; align-items: center; gap: 8px; padding: 0 22px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-spacer { flex: 1; }
.icon-btn.menu-btn { display: none; }
.search-btn { display: flex; align-items: center; gap: 10px; min-width: 260px; height: 42px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--faint); border-radius: 12px; cursor: pointer; }
.search-btn:hover { border-color: var(--line-2); }
.search-btn kbd { margin-inline-start: auto; font-family: inherit; font-size: 11px; border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; direction: ltr; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; position: relative; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.has-badge .dot-badge { position: absolute; top: 4px; inset-inline-end: 3px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 20px; display: grid; place-items: center; border: 2px solid var(--surface); }
.ic-light { display: none; } [data-theme="dark"] .ic-light { display: block; } [data-theme="dark"] .ic-dark { display: none; }

.content { padding: 26px 28px 60px; width: 100%; max-width: 1480px; margin-inline: auto; flex: 1; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; }
.page-sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--faint); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); } .crumb-sep { width: 14px; height: 14px; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; display: none; z-index: 70; }
.dropdown.open > .dropdown-menu { display: block; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 0; background: none; color: var(--text); cursor: pointer; text-align: start; }
.menu-item:hover { background: var(--primary-soft); text-decoration: none; }
.menu-item.danger { color: var(--red); } .menu-item.danger:hover { background: var(--red-soft); }
.menu-label { font-size: 11.5px; color: var(--faint); padding: 8px 12px 4px; font-weight: 600; }
.ctx-btn { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px 0 10px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); cursor: pointer; text-align: start; }
.ctx-btn:hover { border-color: var(--line-2); }
.ctx-dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; } .ctx-dot .ic { width: 17px; height: 17px; }
.ctx-dot.sm { width: 30px; height: 30px; }
.ctx-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; } .ctx-text strong { font-size: 13.5px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ctx-text small { font-size: 11.5px; color: var(--muted); }
.ctx-chev { width: 16px; height: 16px; color: var(--faint); }
.ctx-menu { min-width: 300px; max-height: 70vh; overflow-y: auto; }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 10px; cursor: pointer; text-align: start; }
.ctx-item:hover, .ctx-item.current { background: var(--primary-soft); }
.ctx-check { margin-inline-start: auto; color: var(--primary); }
.user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; padding: 4px 6px; border-radius: 12px; }
.user-btn:hover { background: var(--primary-soft); }
.user-name { font-weight: 600; font-size: 14px; }
.user-card { display: flex; gap: 12px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; } .user-card div { display: flex; flex-direction: column; min-width: 0; } .user-card small { color: var(--muted); }
.notif-menu { width: 380px; padding: 0; overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-foot { display: block; text-align: center; padding: 12px; border-top: 1px solid var(--line); font-weight: 600; background: var(--surface-2); }
.link-btn { border: 0; background: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 0; } .link-btn:hover { text-decoration: underline; }
.n-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--text); position: relative; }
.n-item:hover { background: var(--surface-2); text-decoration: none; }
.n-item.unread { background: var(--primary-soft); }
.n-item.unread::after { content: ''; position: absolute; inset-inline-end: 10px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.n-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: var(--blue); }
.n-ic.success { background: var(--green-soft); color: var(--green); } .n-ic.warning { background: var(--amber-soft); color: var(--amber); } .n-ic.danger { background: var(--red-soft); color: var(--red); }
.n-body { min-width: 0; } .n-body strong { display: block; font-size: 14px; } .n-body p { margin: 2px 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } .n-body small { color: var(--faint); font-size: 12px; }
.empty-sm { padding: 28px; text-align: center; color: var(--faint); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; background: var(--surface); color: var(--text); border-color: var(--line-2); }
.btn:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 4px 14px rgba(47,49,135,.28); }
.btn-primary:hover { background: var(--primary-600); color: var(--on-primary); border-color: var(--primary-600); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; } .btn-danger:hover { background: #b9151c; border-color: #b9151c; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); } .btn-ghost:hover { background: var(--primary-soft); border-color: transparent; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; } .btn-sm .ic { width: 16px; height: 16px; }
.btn-lg { height: 50px; font-size: 16px; padding: 0 26px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-icon { width: 34px; padding: 0; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 16.5px; }
.card-body { padding: 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.grid { display: grid; gap: 18px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stat { display: flex; align-items: center; gap: 16px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-ic { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); } .stat-ic .ic { width: 24px; height: 24px; }
.stat-ic.green { background: var(--green-soft); color: var(--green); } .stat-ic.amber { background: var(--amber-soft); color: var(--amber); } .stat-ic.red { background: var(--red-soft); color: var(--red); } .stat-ic.blue { background: var(--blue-soft); color: var(--blue); }
.stat-v { font-size: 28px; font-weight: 800; line-height: 1.1; } .stat-l { color: var(--muted); font-size: 13.5px; }
.hero { background: linear-gradient(120deg, var(--sb-from), var(--sb-to)); color: #fff; border-radius: var(--radius-lg); padding: 28px 30px; display: flex; align-items: center; gap: 22px; margin-bottom: 22px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; inset-inline-end: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); }
.hero h2 { font-size: 22px; color: #fff; } .hero p { margin: 4px 0 0; color: #d5d7f7; }
.hero .avatar { border: 3px solid rgba(255,255,255,.5); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }
.cell-user { display: flex; align-items: center; gap: 12px; min-width: 0; } .cell-user div { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; } .cell-user strong { font-size: 14.5px; } .cell-user small { color: var(--muted); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 22px; border-bottom: 1px solid var(--line); align-items: center; }
.toolbar .input { height: 40px; min-width: 150px; width: auto; }
.toolbar .search { flex: 1; min-width: 220px; }
.pager { display: flex; align-items: center; gap: 6px; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pg { min-width: 36px; height: 36px; display: inline-grid; place-items: center; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--text); font-size: 14px; background: var(--surface); }
.pg:hover { border-color: var(--primary); text-decoration: none; } .pg.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); } .pg.disabled { opacity: .45; }
.pager-info { margin-inline-start: auto; color: var(--muted); font-size: 13px; }

/* ---------- Badges & avatars ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 11px; border-radius: 30px; font-size: 12.5px; font-weight: 600; background: var(--gray-soft); color: var(--muted); white-space: nowrap; }
.badge-green { background: var(--green-soft); color: var(--green); } .badge-red { background: var(--red-soft); color: var(--red); } .badge-amber { background: var(--amber-soft); color: var(--amber); } .badge-blue { background: var(--blue-soft); color: var(--blue); } .badge-violet { background: var(--violet-soft); color: var(--violet); } .badge-primary { background: var(--primary-soft); color: var(--primary); }
.avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--gray-soft); }
.avatar-ini { display: inline-grid; place-items: center; font-weight: 700; color: hsl(var(--h) 55% 32%); background: hsl(var(--h) 80% 92%); }
[data-theme="dark"] .avatar-ini { color: hsl(var(--h) 80% 80%); background: hsl(var(--h) 35% 24%); }
.avatar-lg { border: 3px solid var(--surface); box-shadow: var(--shadow); }
.role-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 11px; border-radius: 30px; font-size: 12.5px; font-weight: 600; background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c); }
.role-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.tag { display: inline-block; padding: 2px 10px; background: var(--gray-soft); border-radius: 8px; font-size: 12.5px; margin: 2px; }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px 18px; }
.col-12 { grid-column: span 12; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-8 { grid-column: span 8; }
.field { display: flex; flex-direction: column; gap: 6px; grid-column: span 12; min-width: 0; }
.field > label { font-weight: 600; font-size: 14px; } .req { color: var(--red); margin-inline-start: 3px; }
.input { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 12px 14px; line-height: 1.7; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239aa0bd' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-inline-end: 14px; padding-inline-start: 38px; }
.input:focus { border-color: var(--primary); box-shadow: var(--ring); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.has-error .input { border-color: var(--red); }
.field-error { color: var(--red); font-size: 13px; } .field-hint { color: var(--faint); font-size: 12.5px; }
.input-icon { position: relative; } .input-icon .input { padding-right: 44px; padding-left: 14px; } .input-icon > .ic { position: absolute; right: 14px; top: 13px; color: var(--faint); width: 20px; pointer-events: none; }
.pw-wrap { position: relative; } .pw-wrap .input { padding-inline-end: 46px; } .pw-toggle { position: absolute; inset-inline-end: 6px; top: 4px; }
.form-section { grid-column: span 12; font-weight: 700; font-size: 15px; color: var(--primary); padding-top: 8px; border-bottom: 1px dashed var(--line-2); padding-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; line-height: 1.4; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box { width: 22px; height: 22px; border: 2px solid var(--line-2); border-radius: 7px; flex: none; display: grid; place-items: center; transition: all .15s; background: var(--surface); margin-top: 1px; }
.check input:checked + .check-box { background: var(--primary); border-color: var(--primary); }
.check input:checked + .check-box::after { content: ''; width: 5px; height: 10px; border: solid var(--on-primary); border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:focus-visible + .check-box { box-shadow: var(--ring); }
.check small { display: block; color: var(--faint); font-size: 12.5px; }
.photo-field { display: flex; align-items: center; gap: 16px; }
.photo-preview { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: var(--gray-soft); border: 3px solid var(--surface); box-shadow: var(--shadow); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; } .color-opt input { position: absolute; opacity: 0; } .color-opt span { display: block; width: 32px; height: 32px; border-radius: 10px; cursor: pointer; border: 3px solid transparent; box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); } .color-opt input:checked + span { border-color: var(--text); }
.icon-row { display: flex; gap: 8px; flex-wrap: wrap; } .icon-opt input { position: absolute; opacity: 0; } .icon-opt span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line-2); cursor: pointer; color: var(--muted); } .icon-opt input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

/* ---------- Misc blocks ---------- */
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); }
.alert.warn { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.alert.danger { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.alert.success { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.alert > div { color: var(--text); }
.empty { text-align: center; padding: 54px 20px; color: var(--muted); } .empty .ic { width: 46px; height: 46px; color: var(--faint); margin-bottom: 10px; } .empty h3 { color: var(--text); margin-bottom: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 12px 18px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; } .tab:hover { text-decoration: none; color: var(--text); } .tab.active { color: var(--primary); border-color: var(--primary); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 12px 16px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); } .list-row:last-child { border: 0; }
.team-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden; }
.team-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.team-card::before { content: ''; position: absolute; inset-inline: 0; top: 0; height: 5px; background: var(--c); }
.team-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--c); color: #fff; }
.progress { height: 8px; background: var(--gray-soft); border-radius: 8px; overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--primary); border-radius: 8px; }

/* ---------- Permission matrix ---------- */
.perm-module { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; background: var(--surface); }
.perm-module > header { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-weight: 700; }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); } .perm-row:last-child { border: 0; }
.perm-row:hover { background: var(--surface-2); }
.perm-row small { color: var(--faint); direction: ltr; display: block; font-size: 11.5px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; } .switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line-2); border-radius: 26px; transition: .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + i { background: var(--primary); } .switch input:checked + i::after { inset-inline-start: 21px; }
.switch input:focus-visible + i { box-shadow: var(--ring); }

/* ---------- Toasts / palette / dialogs ---------- */
.toasts { position: fixed; top: 80px; inset-inline-start: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); animation: slide .25s ease-out; border-inline-start: 5px solid var(--blue); }
.toast-success { border-inline-start-color: var(--green); } .toast-success > .ic { color: var(--green); } .toast-error { border-inline-start-color: var(--red); } .toast-error > .ic { color: var(--red); } .toast-warning { border-inline-start-color: var(--amber); } .toast > .ic { color: var(--blue); }
.toast span { flex: 1; } .toast-x { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0; } .toast-x .ic { width: 16px; height: 16px; }
.toast.out { opacity: 0; transform: translateX(-20px); transition: .3s; }
@keyframes slide { from { opacity: 0; transform: translateX(-24px); } }
.palette { position: fixed; inset: 0; z-index: 300; background: rgba(14,16,32,.55); backdrop-filter: blur(3px); display: flex; justify-content: center; padding-top: 12vh; }
.palette-box { width: min(560px, calc(100vw - 32px)); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; align-self: flex-start; border: 1px solid var(--line); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line); color: var(--faint); } .palette-input input { flex: 1; height: 56px; border: 0; background: none; outline: none; font-size: 16px; color: var(--text); }
.palette-list { max-height: 340px; overflow-y: auto; padding: 8px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--text); } .palette-item:hover, .palette-item.sel { background: var(--primary-soft); text-decoration: none; color: var(--primary); }
.dialog-back { position: fixed; inset: 0; z-index: 400; background: rgba(14,16,32,.55); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(3px); }
.dialog { width: min(440px, 100%); background: var(--surface); border-radius: 20px; padding: 26px; box-shadow: var(--shadow-lg); animation: pop .15s ease-out; }
.dialog h3 { font-size: 18px; margin-bottom: 8px; } .dialog p { color: var(--muted); } .dialog .row { justify-content: flex-end; margin-top: 20px; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { background: linear-gradient(155deg, #1b1d55, #2f3187 55%, #4a2a7a); color: #fff; display: grid; place-items: center; padding: 40px; position: relative; overflow: hidden; }
.auth-side::before, .auth-side::after { content: ''; position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(240,168,27,.28), transparent 70%); }
.auth-side::before { width: 420px; height: 420px; top: -140px; inset-inline-end: -120px; } .auth-side::after { width: 360px; height: 360px; bottom: -120px; inset-inline-start: -100px; background: radial-gradient(circle, rgba(214,32,39,.3), transparent 70%); }
.auth-side-in { position: relative; z-index: 1; max-width: 440px; } .auth-logo { border-radius: 50%; background: #fff; padding: 4px; box-shadow: 0 10px 40px rgba(0,0,0,.35); margin-bottom: 22px; }
.auth-side h2 { font-size: 34px; margin-bottom: 6px; } .auth-side p { color: #c9ccf5; font-size: 16px; }
.auth-points { list-style: none; padding: 0; margin: 34px 0 0; display: flex; flex-direction: column; gap: 14px; } .auth-points li { display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.08); padding: 12px 16px; border-radius: 14px; border: 1px solid rgba(255,255,255,.12); }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 20px; gap: 18px; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 34px 32px; box-shadow: var(--shadow-lg); position: relative; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; } .auth-sub { color: var(--muted); margin-bottom: 22px; }
.auth-logo-sm { display: none; border-radius: 50%; margin-bottom: 12px; }
.auth-theme { position: absolute; top: 14px; inset-inline-end: 14px; }
.auth-foot { color: var(--faint); font-size: 12.5px; }
.err-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 20px; }
.err-code { font-size: 84px; font-weight: 800; color: var(--primary); line-height: 1; opacity: .85; } .err-page p { color: var(--muted); max-width: 420px; }

/* ---------- Messages ---------- */
.chat { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - var(--top-h) - 150px); min-height: 480px; overflow: hidden; }
.chat-side { border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head { padding: 14px; display: flex; gap: 8px; border-bottom: 1px solid var(--line); } .chat-side-head .input { height: 40px; }
.chat-list { flex: 1; overflow-y: auto; }
.conv { display: flex; gap: 12px; padding: 12px 14px; cursor: pointer; border-bottom: 1px solid var(--line); align-items: center; width: 100%; border-inline: 0; border-top: 0; background: none; text-align: start; }
.conv:hover { background: var(--surface-2); } .conv.active { background: var(--primary-soft); }
.conv-ic { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--c, var(--primary)); color: #fff; flex: none; }
.conv-body { min-width: 0; flex: 1; } .conv-top { display: flex; justify-content: space-between; gap: 6px; } .conv-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; } .conv-top small { color: var(--faint); font-size: 11.5px; flex: none; }
.conv-last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; justify-content: space-between; }
.conv-unread { background: var(--accent); color: #fff; font-size: 11px; min-width: 20px; height: 20px; border-radius: 20px; display: grid; place-items: center; padding: 0 6px; flex: none; }
.chat-main { display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); }
.chat-head { padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; } .chat-head .back { display: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: min(74%, 560px); padding: 9px 14px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; box-shadow: var(--shadow); word-wrap: break-word; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.msg .who { font-size: 12px; font-weight: 700; color: var(--sky); display: block; } .msg time { display: block; font-size: 10.5px; opacity: .7; margin-top: 2px; text-align: end; }
.day-sep { align-self: center; font-size: 12px; color: var(--faint); background: var(--surface); padding: 2px 12px; border-radius: 20px; border: 1px solid var(--line); margin: 8px 0; }
.chat-form { display: flex; gap: 10px; padding: 12px 16px; background: var(--surface); border-top: 1px solid var(--line); align-items: flex-end; } .chat-form textarea { flex: 1; min-height: 46px; max-height: 140px; border-radius: 14px; }
.chat-empty { margin: auto; text-align: center; color: var(--faint); }
.pick-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; }
.pick { display: flex; gap: 10px; align-items: center; padding: 8px 12px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: start; } .pick:hover { background: var(--primary-soft); } .pick:last-child { border: 0; }

.sidebar-backdrop { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main { grid-template-columns: minmax(0, 1fr); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); width: 288px; box-shadow: var(--shadow-lg); } [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(14,16,32,.55); z-index: 55; }
  .main { margin-inline-start: 0; } .icon-btn.menu-btn, .icon-btn.sb-close { display: inline-grid; }
  .search-btn span, .search-btn kbd { display: none; } .search-btn { min-width: 0; width: 42px; padding: 0; justify-content: center; }
  .content { padding: 18px 14px 60px; } .topbar { padding: 0 10px; gap: 2px; }
  .ctx-text, .user-name { display: none; } .ctx-btn { padding: 0 8px; height: 42px; } .ctx-menu .ctx-text { display: flex; }
  .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-logo-sm { display: block; }
  .chat { grid-template-columns: 1fr; height: calc(100vh - var(--top-h) - 120px); } .chat.in-conv .chat-side { display: none; } .chat:not(.in-conv) .chat-main { display: none; } .chat-head .back { display: inline-grid; }
  .notif-menu { width: min(380px, 92vw); position: fixed; inset-inline: 10px; top: 70px; }
}
@media (max-width: 640px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } .form-grid > .col-6, .form-grid > .col-4, .form-grid > .col-3, .form-grid > .col-8 { grid-column: span 12; }
  .page-head h1 { font-size: 21px; } .kv { grid-template-columns: 1fr; gap: 2px; } .kv dt { margin-top: 10px; font-size: 13px; }
  .auth-card { padding: 28px 22px; } .hero { flex-direction: column; text-align: center; padding: 24px 18px; } .toolbar { padding: 14px; } .card-pad, .card-body { padding: 16px; }
  .ctx-menu { position: fixed; inset-inline: 10px; top: 70px; min-width: 0; }
  .tbl.stack-sm thead { display: none; } .tbl.stack-sm td { display: block; border: 0; padding: 4px 16px; } .tbl.stack-sm tr { display: block; border-bottom: 1px solid var(--line); padding: 10px 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .sidebar, .topbar, .page-actions, .toasts, .pager, .toolbar { display: none !important; } .main { margin: 0; } body { background: #fff; } }

/* ---------- منشئ الاستمارات والتقديم ---------- */
.bcard { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin-bottom: 12px; box-shadow: var(--shadow); }
.bcard[data-type="section"] { border-inline-start: 5px solid var(--primary); }
.bcard-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.bcard-label { flex: 1; min-width: 200px; height: 40px; }
.bcard-body { padding: 0 14px 14px; display: grid; gap: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.add-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px; border: 2px dashed var(--line-2); border-radius: 14px; background: var(--surface-2); }
.steps { display: flex; gap: 0; margin: 6px 0 22px; overflow-x: auto; }
.step { flex: 1; min-width: 110px; text-align: center; position: relative; padding-top: 34px; font-size: 13px; color: var(--faint); }
.step::before { content: ''; position: absolute; top: 12px; inset-inline: 0; height: 3px; background: var(--line-2); }
.step i { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 26px; height: 26px; border-radius: 50%; background: var(--line-2); color: #fff; display: grid; place-items: center; font-style: normal; font-size: 13px; z-index: 1; }
.step.done i { background: var(--green); } .step.done::before { background: var(--green); }
.step.now i { background: var(--primary); box-shadow: 0 0 0 5px var(--primary-soft); } .step.now { color: var(--text); font-weight: 700; }
.q-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; background: var(--surface); }
.q-num { color: var(--primary); font-weight: 800; margin-inline-end: 6px; }
.timer { position: sticky; top: 74px; z-index: 30; padding: 10px 18px; border-radius: 14px; background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: 20px; text-align: center; box-shadow: var(--shadow-lg); margin-bottom: 16px; }
.timer.low { background: var(--red); }
.portal-top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.portal-top img.logo { border-radius: 50%; }
.portal-wrap { max-width: 900px; margin: 0 auto; padding: 26px 16px 60px; }

/* ---------- لوحة المهام ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; min-height: 160px; display: flex; flex-direction: column; }
.kcol > header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--surface); border-radius: 14px 14px 0 0; }
.kbody { padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 100px; flex: 1; }
.kcol.drop { outline: 2px dashed var(--primary); outline-offset: -4px; background: var(--primary-soft); }
.kcard { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--text); box-shadow: var(--shadow); border-inline-start: 4px solid var(--line-2); cursor: grab; }
.kcard:hover { text-decoration: none; border-color: var(--primary); }
.kcard.dragging { opacity: .4; }
.kcard.prio-urgent { border-inline-start-color: var(--red); } .kcard.prio-high { border-inline-start-color: var(--amber); } .kcard.prio-normal { border-inline-start-color: var(--blue); }
.ktitle { font-size: 14.5px; line-height: 1.5; } .ktrunc { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kavatars { display: flex; gap: -6px; } .kavatars .avatar { margin-inline-end: -6px; border: 2px solid var(--surface); }
.sugg { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; background: var(--surface); }
.sugg:hover { border-color: var(--primary); } .sugg.sel { background: var(--primary-soft); border-color: var(--primary); }
.sugg .meter { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--gray-soft) 0); position: relative; flex: none; }
.sugg .meter::before { content: ''; position: absolute; inset: 5px; background: var(--surface); border-radius: 50%; } .sugg .meter b { position: relative; font-size: 14px; }
.chat-line { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); } .chat-line:last-child { border: 0; }
@media (max-width: 900px) { .kanban { grid-template-columns: repeat(4, 80vw); } }

/* ---------- التقويم ---------- */
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calhead { padding: 10px 6px; text-align: center; font-weight: 700; font-size: 13px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); }
.calcell { min-height: 112px; padding: 6px; border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.calcell.out { background: var(--surface-2); opacity: .55; }
.calcell.today { background: var(--primary-soft); }
.calnum { font-weight: 700; font-size: 13px; color: var(--muted); } .calcell.today .calnum { background: var(--primary); color: var(--on-primary); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.calev { display: block; font-size: 11.5px; line-height: 1.4; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--text); border-inline-start: 3px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calev:hover { text-decoration: none; background: color-mix(in srgb, var(--c) 28%, transparent); } .calev b { color: var(--c); }
@media (max-width: 700px) { .calcell { min-height: 70px; padding: 3px; } .calev { font-size: 10px; padding: 1px 3px; } .calhead { font-size: 11px; } }

.btn-success { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 4px 14px rgba(18,161,80,.3); }
.btn-success:hover { background: #0e8a43; color: #fff; border-color: #0e8a43; }
.btn-info { background: #1e6fe0; color: #fff; border-color: #1e6fe0; box-shadow: 0 4px 14px rgba(30,111,224,.3); }
.btn-info:hover { background: #1859b8; color: #fff; border-color: #1859b8; }

/* ---------- صفحة التسجيل ---------- */
.reg { max-width: 760px; margin: 0 auto; }
.reg-hero { text-align: center; padding: 34px 20px 30px; margin-bottom: 18px; border-radius: 24px; color: #fff; background: linear-gradient(135deg, var(--primary) 0%, #4a4dc0 55%, #1e6fe0 100%); box-shadow: 0 18px 40px rgba(47,49,135,.28); position: relative; overflow: hidden; }
.reg-hero::after { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); top: -110px; inset-inline-start: -70px; }
.reg-hero h1 { font-size: 28px; margin: 10px 0 6px; color: #fff; } .reg-hero p { margin: 0 auto 8px; max-width: 480px; opacity: .92; } .reg-hero small { opacity: .9; } .reg-hero a { color: #fff; text-decoration: underline; font-weight: 700; }
.reg-hero-ic { width: 64px; height: 64px; border-radius: 20px; background: rgba(255,255,255,.18); display: inline-grid; place-items: center; } .reg-hero-ic .ic { width: 30px; height: 30px; }
.reg-form { display: flex; flex-direction: column; gap: 16px; }
.reg-card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 22px; box-shadow: var(--shadow); }
.reg-card h2 { display: flex; align-items: center; gap: 12px; font-size: 17px; margin: 0 0 18px; }
.reg-card h2 i { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-style: normal; }
.reg-photo { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; padding: 14px; border-radius: 16px; border: 2px dashed var(--line-2); background: var(--surface-2); }
.reg-photo .photo-preview { width: 76px; height: 76px; } .reg-photo-ph { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); } .reg-photo-ph .ic { width: 32px; height: 32px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .seg label { position: relative; cursor: pointer; } .seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: flex; align-items: center; justify-content: center; height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; transition: all .15s; }
.seg input:checked + span { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 4px 14px rgba(47,49,135,.28); } .seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.reg .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
@media (max-width: 700px) { .reg-hero h1 { font-size: 23px; } .reg-card { padding: 16px; border-radius: 18px; } }

/* ---------- تحصين التجاوب (منع الفيض الأفقي على الشاشات الصغيرة) ---------- */
.main, .content, .portal-wrap { min-width: 0; }
.grid > *, .g-main > *, .stack > *, .form-grid > *, .page-head > *, .card-head > *, .row > *, .toolbar > * { min-width: 0; }
.card { min-width: 0; max-width: 100%; }
.card > .table-wrap, .table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
.card-head h2, .card-head h3, .page-head h1 { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; } .page-actions { width: 100%; } .page-actions .btn { flex: 1 1 auto; }
  .tbl th, .tbl td { padding: 11px 12px; } .toolbar .input, .toolbar .search { min-width: 0; flex: 1 1 140px; }
  .card-head { flex-wrap: wrap; padding: 14px 16px; }
}
@media (max-width: 480px) {
  body { font-size: 14.5px; } .content { padding: 14px 10px 56px; } .btn { height: 44px; } .btn-sm { height: 38px; }
  .tabs { margin-inline: -10px; padding-inline: 10px; } .card-head { padding: 12px 14px; } .stat { padding: 14px; }
  .toolbar > .btn, .toolbar > form { flex: 1 1 100%; }
}
[style*="flex:1"] { min-width: 0; }
@media (max-width: 480px) { [style*="height:150px"] small { font-size: 10px; } }
.portal-top { flex-wrap: wrap; }
.portal-wrap { max-width: 1000px; }
@media (max-width: 640px) {
  .portal-top { padding: 10px 12px; gap: 8px; } .portal-top > strong { font-size: 14px; }
  .portal-top > nav { order: 10; width: 100%; margin: 0 !important; overflow-x: auto; }
  .portal-wrap { padding: 16px 12px 48px; }
}
@media (max-width: 640px) {
  .portal-top .btn-sm { padding: 0 10px; height: 38px; gap: 6px; } .portal-top .grow { flex: 1 1 0; }
  .portal-top > nav .btn { flex: 1 1 0; }
}
@media (max-width: 440px) { .portal-top > strong { display: none; } }
@media (max-width: 640px) {
  .g4:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .g4 > .stat { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .tbl td, .tbl th { white-space: nowrap; } .tbl .cell-user { min-width: 200px; } .tbl td .badge, .tbl td .role-chip { white-space: nowrap; }
  .toolbar .input, .toolbar .search { flex: 1 1 100%; width: 100%; }
}
@media (max-width: 640px) { .input, select.input, textarea.input, .pw-wrap .input { font-size: 16px; } }
body { padding-bottom: env(safe-area-inset-bottom); }
