/* ===== حساب المستخدم المشترك ===== */
.cc-account {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.cc-account-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 41px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.cc-account-btn:hover,
.cc-account-btn[aria-expanded="true"] {
  border-color: var(--amber);
  background: var(--amber-soft);
  transform: translateY(-1px);
}

.cc-account-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ink), var(--ink-3));
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  flex: 0 0 auto;
}

.cc-account-avatar-lg {
  width: 42px;
  height: 42px;
  font-size: 1.05rem;
}

.cc-account-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  min-width: 0;
}

.cc-account-name {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--ink);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-account-role {
  font-size: 0.66rem;
  color: var(--muted);
  font-weight: 600;
}

.cc-account-caret {
  width: 0;
  height: 0;
  border-inline: 4px solid transparent;
  border-top: 5px solid var(--muted);
  margin-inline-start: 1px;
}

.cc-account-menu {
  position: absolute;
  top: calc(100% + 9px);
  inset-inline-end: 0;
  z-index: 9500;
  width: 252px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-md);
  animation: cc-pop 0.16s ease;
}

@keyframes cc-pop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.cc-account-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  text-align: start;
}

.cc-account-head-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cc-account-head-text strong {
  font-size: 0.86rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-account-head-text small {
  font-size: 0.72rem;
  color: var(--muted);
  direction: ltr;
  text-align: start;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cc-account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
}

.cc-account-item:hover,
.cc-account-item:focus-visible {
  background: var(--cream);
  outline: none;
}

.cc-account-item .icon {
  width: 17px;
  height: 17px;
  color: var(--ink-3);
}

.cc-account-item-danger {
  color: var(--red);
}

.cc-account-item-danger .icon {
  color: var(--red);
}

.cc-account-item-danger:hover,
.cc-account-item-danger:focus-visible {
  background: var(--red-soft);
}

.cc-account-divider {
  height: 1px;
  margin: 5px 8px;
  background: var(--line);
}

/* ===== نوافذ تغيير بيانات الحساب ===== */
.cc-modal[hidden] {
  display: none;
}

.cc-modal {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.cc-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 38, 56, 0.55);
  backdrop-filter: blur(3px);
}

.cc-modal-panel {
  position: relative;
  z-index: 1;
  width: min(470px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 26px;
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  text-align: start;
}

.cc-modal-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.cc-modal-close:hover {
  background: var(--red-soft);
  color: var(--red);
}

.cc-modal.is-forced .cc-modal-close {
  display: none;
}

.cc-modal.is-forced .cc-modal-backdrop {
  background: rgba(12, 38, 56, 0.72);
}

.cc-modal-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  padding-inline-end: 34px;
}

.cc-modal-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--amber-soft);
  color: var(--amber-deep);
}

.cc-modal-badge .icon {
  width: 21px;
  height: 21px;
}

.cc-modal-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
}

.cc-modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.75;
}

.cc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.cc-field > span {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.cc-field > span b {
  color: var(--red);
}

.cc-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cc-field input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(140,47,57,0.2);
}

.cc-field.has-error input {
  border-color: #dcaeae;
  background: #fffafa;
}

.cc-field-error {
  min-height: 0;
  color: var(--red);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 600;
}

.cc-field-error:empty {
  display: none;
}

.cc-form-error {
  margin: 4px 0 12px;
  padding: 9px 12px;
  border: 1px solid #efc9c9;
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 600;
}

.cc-form-error[hidden] {
  display: none;
}

.cc-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 6px;
}

.cc-modal-actions .btn {
  min-height: 42px;
}

body.cc-modal-open {
  overflow: hidden;
}

/* ===== شاشة الإعداد الأولي المؤقتة ===== */
.cc-setup {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(140,47,57,0.18), transparent 62%),
    radial-gradient(700px 500px at 5% 5%, rgba(42, 106, 145, 0.16), transparent 60%),
    #f6f7f7;
  overflow: auto;
}

.cc-setup-card {
  width: min(480px, 100%);
  margin: auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  text-align: start;
}

.cc-setup-badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
}

.cc-setup-badge .icon {
  width: 25px;
  height: 25px;
}

.cc-setup-card h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--ink);
}

.cc-setup-card > p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.8;
}

.cc-setup-submit {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.cc-setup-hint {
  margin: 16px 0 0 !important;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.74rem !important;
  color: var(--muted);
}

@media (max-width: 720px) {
  .cc-account-meta {
    display: none;
  }

  .cc-account-btn {
    padding: 5px 7px;
    min-height: 38px;
  }

  .cc-account-caret {
    display: none;
  }

  .cc-account-menu {
    position: fixed;
    inset-inline: 12px;
    width: auto;
    max-height: calc(100vh - 180px);
    overflow: auto;
  }

  .cc-modal {
    padding: 12px;
    align-items: end;
  }

  .cc-modal-panel {
    width: 100%;
    max-height: calc(100vh - 24px);
    padding: 22px 18px;
    border-radius: 20px;
  }

  .cc-setup-card {
    padding: 24px 18px;
  }
}
