:root {
  --bg: #f3f7f4;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #6c7890;
  --line: #dfe7ea;
  --green: #16b67f;
  --blue: #4e5cf0;
  --orange: #f59e0b;
  --shadow: 0 22px 60px rgba(23, 32, 51, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(22, 182, 127, 0.18), transparent 36%),
    linear-gradient(135deg, #f8fbf8 0%, var(--bg) 100%);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidebar {
  width: 292px;
  min-height: 100vh;
  padding: 28px 22px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 34px;
}

.brand-icon {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: 24px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 14px 35px rgba(78, 92, 240, 0.26);
}

.brand h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.04em;
}

.brand p, .eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.nav-btn {
  width: 100%;
  border: 0;
  margin: 6px 0;
  padding: 16px 18px;
  border-radius: 16px;
  text-align: left;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.nav-btn:hover,
.nav-btn.active {
  background: #eef3ff;
  color: var(--blue);
}

.sidebar-note {
  margin-top: 34px;
  padding: 16px;
  border-radius: 18px;
  background: #102018;
  color: white;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.sidebar-note span { color: rgba(255, 255, 255, 0.72); }

.main {
  flex: 1;
  min-width: 0;
  padding: 34px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 42px;
  letter-spacing: -0.06em;
}

.status-pill {
  padding: 12px 18px;
  border-radius: 999px;
  background: #dff7ec;
  color: #128761;
  font-weight: 900;
}

.hero-card {
  padding: 32px;
  border-radius: 30px;
  background: linear-gradient(135deg, #101828, #18382b);
  color: white;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.hero-card h3 {
  margin: 10px 0;
  font-size: 36px;
  letter-spacing: -0.06em;
}

.hero-card p { color: rgba(255, 255, 255, 0.75); max-width: 760px; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.module-card {
  padding: 26px;
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid rgba(223, 231, 234, 0.9);
  cursor: pointer;
  min-height: 235px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.module-card h3 {
  margin: 16px 0 8px;
  font-size: 28px;
  letter-spacing: -0.05em;
}

.module-card p {
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.module-card button,
.ghost-btn {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font-weight: 900;
  cursor: pointer;
  background: var(--ink);
  color: white;
}

.ghost-btn {
  background: #eef3ff;
  color: var(--blue);
}

.module-tag {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.module-tag.green { background: #daf8eb; color: var(--green); }
.module-tag.blue { background: #e4e8ff; color: var(--blue); }
.module-tag.orange { background: #fff2d8; color: var(--orange); }

.hidden { display: none !important; }

.module-view {
  min-height: calc(100vh - 150px);
}

.module-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-radius: 24px 24px 0 0;
  background: white;
  border: 1px solid var(--line);
  border-bottom: 0;
}

.module-toolbar h3 {
  margin: 3px 0 0;
  font-size: 25px;
}

iframe {
  width: 100%;
  height: calc(100vh - 176px);
  border: 1px solid var(--line);
  border-radius: 0 0 24px 24px;
  background: white;
}

@media (max-width: 980px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; position: static; }
  .cards-grid { grid-template-columns: 1fr; }
  .main { padding: 20px; }
  .topbar h2 { font-size: 32px; }
}

/* Brand polish */
.brand {
  position: relative;
  padding: 18px 14px 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.95), transparent 34%),
    linear-gradient(135deg, rgba(22, 182, 127, 0.13), rgba(78, 92, 240, 0.11));
  border: 1px solid rgba(223, 231, 234, 0.72);
  overflow: hidden;
}

.brand::before {
  content: "";
  position: absolute;
  width: 118px;
  height: 118px;
  right: -42px;
  top: -42px;
  border-radius: 999px;
  background: rgba(22, 182, 127, 0.16);
}

.brand::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 8px;
  left: 84px;
  bottom: 13px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--blue));
  opacity: 0.75;
}

.brand-icon {
  position: relative;
  isolation: isolate;
  width: 64px;
  height: 64px;
  border-radius: 24px;
  font-size: 30px;
  letter-spacing: -0.08em;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.26), transparent 36%),
    linear-gradient(135deg, #10b981 0%, #3b82f6 58%, #4f46e5 100%);
  box-shadow:
    0 20px 42px rgba(78, 92, 240, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.brand-icon::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  z-index: -1;
}

.brand h1 {
  position: relative;
  font-size: 28px;
  line-height: 1;
  background: linear-gradient(135deg, #142039, #0b513d 72%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand p {
  position: relative;
  margin-top: 7px;
  font-size: 15px;
  color: #62728d;
}

/* Full project workspace layout */
body {
  display: block;
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 18px 28px 12px;
  background: rgba(248, 251, 248, 0.9);
  border-bottom: 1px solid rgba(223, 231, 234, 0.88);
  backdrop-filter: blur(18px);
}

.sidebar {
  width: 100%;
  min-height: auto;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 22px;
  align-items: center;
  background: transparent;
  border-right: 0;
  position: static;
  backdrop-filter: none;
}

.brand {
  margin-bottom: 0;
  padding: 14px 16px;
  min-height: 92px;
}

.brand-icon {
  width: 58px;
  height: 58px;
  border-radius: 22px;
  font-size: 28px;
}

.brand h1 { font-size: 26px; }
.brand p { font-size: 14px; }

.sidebar .nav-btn {
  width: auto;
  margin: 0;
  padding: 18px 24px;
  border-radius: 22px;
  text-align: center;
  font-size: 18px;
  color: #647089;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(223, 231, 234, 0.75);
  box-shadow: 0 10px 26px rgba(23, 32, 51, 0.04);
}

.sidebar .nav-btn:hover,
.sidebar .nav-btn.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), #16b67f);
  border-color: transparent;
  box-shadow: 0 18px 36px rgba(78, 92, 240, 0.22);
  transform: translateY(-1px);
}

.sidebar .nav-btn:nth-of-type(1) {
  justify-self: start;
}

.sidebar {
  grid-template-areas:
    "brand nav";
}

.brand { grid-area: brand; }

.nav-btn {
  transition: 180ms ease;
}

.main {
  padding: 24px 34px 34px;
  width: 100%;
}

.topbar {
  margin-bottom: 20px;
}

.topbar h2 {
  font-size: 34px;
}

.cards-grid {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.module-card {
  min-height: 210px;
}

.module-view {
  min-height: calc(100vh - 190px);
}

iframe {
  height: calc(100vh - 220px);
}

@media (max-width: 1100px) {
  .sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar .nav-btn {
    display: inline-flex;
    justify-content: center;
    margin-right: 8px;
    margin-top: 10px;
  }

  .app-header { position: static; }
}

@media (max-width: 720px) {
  .app-header { padding: 14px; }
  .main { padding: 18px; }
  .brand { min-height: auto; }
  .sidebar .nav-btn {
    width: 100%;
    margin-right: 0;
  }
}

.top-nav {
  grid-area: nav;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.sidebar .nav-btn:nth-of-type(1) {
  justify-self: auto;
}

@media (max-width: 1100px) {
  .top-nav {
    justify-content: flex-start;
  }
}

/* Compact top header */
.app-header {
  padding: 10px 22px;
}

.sidebar {
  grid-template-columns: minmax(230px, 300px) 1fr;
  gap: 18px;
}

.brand {
  min-height: 66px;
  padding: 10px 12px;
  border-radius: 20px;
  gap: 10px;
}

.brand::before {
  width: 86px;
  height: 86px;
  right: -34px;
  top: -34px;
}

.brand::after {
  width: 52px;
  height: 6px;
  left: 72px;
  bottom: 10px;
}

.brand-icon {
  width: 46px;
  height: 46px;
  border-radius: 17px;
  font-size: 23px;
}

.brand h1 {
  font-size: 21px;
  letter-spacing: -0.05em;
}

.brand p {
  margin-top: 4px;
  font-size: 12px;
}

.top-nav {
  gap: 9px;
}

.sidebar .nav-btn {
  padding: 12px 18px;
  border-radius: 17px;
  font-size: 15px;
  min-height: 48px;
}

.main {
  padding-top: 18px;
}

.topbar h2 {
  font-size: 30px;
}

@media (max-width: 720px) {
  .sidebar {
    grid-template-columns: 1fr;
  }

  .top-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

/* Remove duplicate page/module headers */
.main {
  padding-top: 20px;
}

.module-toolbar {
  display: none;
}

iframe {
  height: calc(100vh - 112px);
  border-radius: 24px;
  border: 1px solid var(--line);
}

.module-view {
  min-height: calc(100vh - 112px);
}

/* Chrome-like lightweight tabs */
.app-header {
  padding: 8px 14px 0;
  background: #edf3f2;
  border-bottom: 1px solid #d7e1e1;
}

.sidebar {
  grid-template-columns: 210px 1fr;
  gap: 12px;
  align-items: end;
}

.brand {
  min-height: 46px;
  padding: 7px 10px;
  border-radius: 16px 16px 0 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  gap: 8px;
  overflow: visible;
}

.brand::before,
.brand::after,
.brand-icon::after {
  display: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 18px;
  box-shadow: 0 8px 18px rgba(78, 92, 240, 0.17);
}

.brand h1 {
  font-size: 18px;
  color: #172033;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
}

.brand p {
  display: none;
}

.top-nav {
  justify-content: flex-start;
  align-items: end;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-top: 6px;
}

.sidebar .nav-btn {
  position: relative;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: transparent;
  color: #66728a;
  font-size: 15px;
  box-shadow: none;
  white-space: nowrap;
}

.sidebar .nav-btn:hover {
  color: #172033;
  background: rgba(255, 255, 255, 0.58);
  transform: none;
  box-shadow: none;
}

.sidebar .nav-btn.active {
  color: #172033;
  background: #ffffff;
  border-color: #d7e1e1;
  box-shadow: 0 -4px 16px rgba(23, 32, 51, 0.05);
  transform: none;
}

.sidebar .nav-btn.active::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(90deg, #3b82f6, #16b67f);
}

.main {
  padding: 18px 22px 28px;
  background: #ffffff;
  min-height: calc(100vh - 59px);
}

iframe {
  height: calc(100vh - 95px);
  border-radius: 18px;
}

@media (max-width: 900px) {
  .sidebar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .brand {
    min-height: 40px;
  }

  .top-nav {
    padding-top: 0;
  }
}

/* Flush module content, no frame borders */
.main {
  padding: 0;
  background: #fff;
}

.module-view {
  min-height: calc(100vh - 59px);
}

iframe {
  display: block;
  width: 100%;
  height: calc(100vh - 59px);
  border: 0;
  border-radius: 0;
}

.home-view {
  padding: 24px;
}

/* System settings */
.settings-view {
  min-height: calc(100vh - 59px);
  background:
    radial-gradient(circle at 12% 0%, rgba(22, 182, 127, 0.13), transparent 32%),
    linear-gradient(135deg, #f7faf9, #eef5f2);
  padding: 24px;
}

.settings-shell {
  max-width: 1320px;
  margin: 0 auto;
}

.settings-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  padding: 26px;
  border-radius: 28px;
  background: #111827;
  color: white;
  box-shadow: 0 20px 60px rgba(17, 24, 39, 0.16);
  margin-bottom: 20px;
}

.settings-kicker {
  margin: 0 0 8px;
  color: #6b7a95;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 900;
}

.settings-hero .settings-kicker {
  color: rgba(255, 255, 255, 0.55);
}

.settings-hero h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.05em;
}

.settings-hero p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.68);
}

.session-card {
  min-width: 260px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 5px;
}

.session-card span,
.session-card small {
  color: rgba(255, 255, 255, 0.62);
}

.session-card strong {
  font-size: 20px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(430px, 1.25fr);
  gap: 20px;
}

.settings-panel {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(215, 225, 225, 0.95);
  border-radius: 28px;
  padding: 22px;
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.08);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h3 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.primary-btn,
.save-btn,
.ghost-action {
  border: 0;
  border-radius: 15px;
  padding: 12px 16px;
  font-weight: 900;
  cursor: pointer;
}

.primary-btn,
.save-btn {
  color: white;
  background: linear-gradient(135deg, #4f46e5, #16b67f);
}

.ghost-action {
  color: #4f46e5;
  background: #eef3ff;
}

.add-user-form,
.password-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.password-row {
  grid-template-columns: 1fr auto;
  margin-bottom: 0;
}

.add-user-form input,
.password-row input {
  width: 100%;
  border: 1px solid #dbe4e6;
  background: white;
  border-radius: 15px;
  padding: 13px 14px;
  font: inherit;
  font-weight: 700;
  outline: none;
}

.add-user-form input:focus,
.password-row input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* user-row styles consolidated below */

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #4f46e5, #16b67f);
}

.user-main {
  display: grid;
  gap: 3px;
}

.user-main strong {
  font-size: 17px;
}

.user-main small {
  color: #6b7a95;
  font-weight: 700;
}

.mini-badge,
.role-badge {
  padding: 8px 10px;
  border-radius: 999px;
  background: #e8fff4;
  color: #128761;
  font-size: 12px;
  font-weight: 900;
}

/* ──────────────────────────────────────────────────
   SETTINGS PAGE — Complete Premium Redesign
   ────────────────────────────────────────────────── */

/* Layout */
.settings-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 0 2px;
}

.settings-title {
  margin: 4px 0 0;
  font-size: 32px;
  letter-spacing: -0.05em;
  font-weight: 900;
  color: var(--ink);
}

.settings-meta { display: flex; align-items: center; gap: 10px; }

.settings-meta-pill {
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(79,70,229,0.12), rgba(22,182,127,0.1));
  border: 1px solid rgba(79,70,229,0.2);
  font-size: 13px;
  font-weight: 800;
  color: var(--blue);
}

.settings-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}

/* ── MEMBERS PANEL ── */
.members-panel {
  background: white;
  border-radius: 24px;
  border: 1px solid rgba(215,225,230,0.9);
  box-shadow: 0 8px 32px rgba(17,24,39,0.06);
  padding: 20px;
  align-self: start;
}

.members-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-label {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.panel-title {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.btn-add {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 12px;
  padding: 9px 14px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-add:hover { opacity: 0.88; }

.add-user-form {
  display: grid;
  grid-template-columns: 1fr; /* single column — no cramped layout */
  gap: 10px;
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1.5px dashed #d0d8e0;
  animation: slideDown 0.18s ease;
}

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

.add-user-form input {
  width: 100%;
  border: 1.5px solid #dbe4e6;
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.add-user-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.btn-confirm {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px 14px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
}
.btn-confirm:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-confirm:active { transform: translateY(0); }

.users-list { display: grid; gap: 10px; }

.user-card-wrap {
  display: flex;
  flex-direction: column;
  border-radius: 17px;
  border: 1.5px solid #e5ecee;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: white;
}

.user-row {
  width: 100%;
  background: white;
  padding: 11px 13px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  border-radius: 16px;
  transition: background 0.15s;
}
.user-card-wrap:hover { border-color: rgba(79,70,229,0.35); box-shadow: 0 4px 14px rgba(79,70,229,0.08); }
.user-row.selected,
.user-card-wrap:has(.user-row.selected) { border-color: var(--blue); }
.user-row.selected { background: #f0f2ff; }


.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: 17px;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.user-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.user-main strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-main small { color: var(--muted); font-weight: 700; font-size: 12px; }

.mini-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef3ff;
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.user-row.selected .mini-badge,
.user-card-wrap:has(.user-row.selected) .mini-badge { background: rgba(79,70,229,0.15); }

/* ── PERMISSIONS PANEL ── */
.permissions-panel {
  background: white;
  border-radius: 24px;
  border: 1px solid rgba(215,225,230,0.9);
  box-shadow: 0 8px 32px rgba(17,24,39,0.06);
  overflow: hidden;
}

.perms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 18px;
  border-bottom: 1px solid #eef1f5;
  background: #fafbfc;
}

.perms-header-left { display: flex; align-items: center; gap: 14px; }

.perms-avatar-wrap {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
}

.perms-avatar {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.role-badge-new {
  padding: 7px 13px;
  border-radius: 999px;
  background: #eef9f3;
  color: #128761;
  font-size: 12px;
  font-weight: 900;
}

.perms-body {
  padding: 18px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

/* ── MODULE CARDS ── */
.perm-module-card {
  border-radius: 18px;
  border: 1.5px solid #e8eef2;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.perm-module-card:hover { box-shadow: 0 4px 20px rgba(17,24,39,0.07); }

/* Color accents per module */
.perm-planning { border-color: rgba(79,70,229,0.25); }
.perm-planning .perm-module-header { background: linear-gradient(135deg, rgba(79,70,229,0.07), rgba(79,70,229,0.03)); }

.perm-trafic { border-color: rgba(245,158,11,0.3); }
.perm-trafic .perm-module-header { background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(245,158,11,0.03)); }

.perm-atelier { border-color: rgba(22,182,127,0.3); }
.perm-atelier .perm-module-header { background: linear-gradient(135deg, rgba(22,182,127,0.08), rgba(22,182,127,0.03)); }

.perm-system { border-color: rgba(99,102,241,0.2); }
.perm-system .perm-module-header { background: #f8f8fe; }

.perm-module-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.perm-system-header { border-bottom: none; }

.perm-module-toggle { display: flex; align-items: center; cursor: pointer; }

/* Custom Toggle Switch */
.perm-toggle-input { display: none; }
.perm-toggle-track {
  display: block;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #d1d9e0;
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
  flex-shrink: 0;
}
.perm-toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.perm-toggle-input:checked + .perm-toggle-track { background: var(--blue); }
.perm-toggle-input:checked + .perm-toggle-track::after { transform: translateX(18px); }

.perm-module-info { display: flex; align-items: center; gap: 10px; flex: 1; }
.perm-module-icon { display: none; } /* emojis hidden */

/* ── Letter-based module identifier (replaces emoji) ── */
.perm-module-letter {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.perm-letter-blue   { background: rgba(79,70,229,0.12); color: var(--blue); }
.perm-letter-orange { background: rgba(245,158,11,0.12); color: #b45309; }
.perm-letter-green  { background: rgba(22,182,127,0.12); color: #0e9166; }
.perm-letter-grey   { background: rgba(100,116,139,0.1); color: #475569; }
.perm-module-name { display: block; font-size: 15px; font-weight: 900; color: var(--ink); }
.perm-module-desc { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-top: 1px; }

/* ── PERMISSION ROWS ── */
.perm-rows {
  padding: 10px 14px 12px;
  display: grid;
  gap: 2px;
}

.perm-rows-nogap { gap: 0; }

.perm-section-title {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 8px 4px 4px;
}

.perm-divider {
  height: 1px;
  background: #f0f2f5;
  margin: 6px 0;
}

.perm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  user-select: none;
}
.perm-row:hover { background: #f5f7fa; }

.perm-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 5px;
}

.perm-row-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

.perm-row-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Sub-rows (indented) */
.perm-sub-rows {
  padding-left: 28px;
  display: grid;
  gap: 1px;
}

.perm-sub .perm-row-text {
  color: var(--muted);
  font-size: 13px;
}
.perm-sub:hover { background: #f9fafc; }

/* Permission Tags */
.perm-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 900;
  background: rgba(22,182,127,0.12);
  color: #0e9166;
}
.perm-tag-orange {
  background: rgba(245,158,11,0.12);
  color: #b45309;
}
.perm-tag-red {
  background: rgba(220,38,38,0.1);
  color: #dc2626;
}

/* Disabled state */
.perm-row input[type="checkbox"]:disabled { opacity: 0.35; }
.perm-row input[type="checkbox"]:disabled ~ .perm-row-icon,
.perm-row input[type="checkbox"]:disabled ~ .perm-row-text { opacity: 0.4; }

/* ── ACTIONS BAR ── */
.perm-actions-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: #fafbfc;
  border-radius: 18px;
  border: 1.5px solid #e8eef2;
}

.perm-password-label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 7px;
}

.perm-password-row {
  display: flex;
  gap: 8px;
}

.perm-password-row input {
  flex: 1;
  border: 1.5px solid #dbe4e6;
  border-radius: 12px;
  padding: 10px 13px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.perm-password-row input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

.btn-ghost-small {
  border: 1.5px solid #dbe4e6;
  border-radius: 12px;
  padding: 10px 16px;
  background: white;
  color: var(--blue);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.btn-ghost-small:hover { background: #f0f2ff; border-color: var(--blue); }

.btn-save-perms {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 13px 22px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: white;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(79,70,229,0.25);
  transition: opacity 0.15s, transform 0.1s;
}
.btn-save-perms:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-save-perms:active { transform: translateY(0); }

/* Responsive */
@media (max-width: 1024px) {
  .settings-layout { grid-template-columns: 1fr; }
  .members-panel { position: static; }
  .perms-body { max-height: none; }
}

/* ── TOAST NOTIFICATIONS ── */
.app-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 16px;
  background: #111827;
  color: white;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 8px 32px rgba(17,24,39,0.28);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
}
.app-toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.app-toast.toast-success { background: #0f1f14; border: 1.5px solid rgba(22,182,127,0.4); }
.app-toast.toast-error   { background: #1f0f0f; border: 1.5px solid rgba(220,38,38,0.4);  }

/* ── Legacy classes cleanup (kept for compat) ── */
.permission-block, .password-box,
.permission-module, .perm-sub-card,
.permission-parent, .permission-children,
.permission-sub-parent { display: none !important; }

@media (max-width: 680px) {
  .perm-actions-bar { grid-template-columns: 1fr; }
}




/* Login */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(22, 182, 127, 0.16), transparent 34%),
    radial-gradient(circle at 80% 10%, rgba(79, 70, 229, 0.12), transparent 32%),
    linear-gradient(135deg, #f7faf9, #edf3f2);
}

.login-card {
  width: min(460px, 100%);
  padding: 32px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #dce7e6;
  box-shadow: 0 26px 80px rgba(17, 24, 39, 0.14);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-brand h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.05em;
}

.login-brand p {
  margin: 3px 0 0;
  color: #6b7a95;
  font-weight: 800;
}

.login-card h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.06em;
}

.login-subtitle {
  margin: 8px 0 22px;
  color: #6b7a95;
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form input {
  width: 100%;
  border: 1px solid #dbe4e6;
  border-radius: 17px;
  padding: 15px 16px;
  font: inherit;
  font-weight: 800;
  outline: none;
}

.login-form input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.login-form button {
  border: 0;
  border-radius: 17px;
  padding: 15px 16px;
  color: white;
  font-weight: 950;
  cursor: pointer;
  background: linear-gradient(135deg, #4f46e5, #16b67f);
}

.login-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: #dc2626;
  font-weight: 900;
}

.logout-btn {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: transparent;
  color: #9b3140;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.58);
  color: #dc2626;
}

.settings-hero {
  display: none;
}


.module-permissions {
  display: grid;
  gap: 14px;
}

.permission-module {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(78, 92, 240, 0.04);
}

.permission-parent {
  font-size: 17px;
  font-weight: 900;
}

.permission-children {
  margin-top: 12px;
  margin-inline-start: 34px;
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.permission-children label {
  font-size: 15px;
  color: var(--muted);
}

.permission-children input:disabled {
  opacity: 0.45;
}

/* ── USER EMAIL ROW ── */
.user-email-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Copy email button */
.copy-email-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.copy-email-btn:hover { background: #e8eef5; color: var(--blue); }

/* 3-dots menu button */
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid #e5ecee;
  border-radius: 9px;
  background: white;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}
.user-menu-btn:hover,
.user-menu-btn.active { background: #f0f2ff; border-color: var(--blue); color: var(--blue); }

/* ── USER ACTION PANEL ── */
.user-action-panel {
  display: grid;
  gap: 10px;
  padding: 14px 12px 12px;
  background: #f4f6ff;
  border-top: 1.5px dashed rgba(79,70,229,0.2);
  animation: slideDown 0.15s ease;
}

.uap-field-row {
  display: grid;
  gap: 5px;
}
.uap-field-row > label {
  font-size: 11px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.uap-input-group {
  display: flex;
  gap: 6px;
  align-items: center;
}
.uap-input {
  flex: 1;
  border: 1.5px solid #dbe4e6;
  background: white;
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.uap-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

.uap-btn {
  border: 0;
  border-radius: 9px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.12s, transform 0.1s;
}
.uap-btn-save {
  background: var(--blue);
  color: white;
}
.uap-btn-save:hover { opacity: 0.88; transform: translateY(-1px); }

/* Eye toggle button */
.uap-eye-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1.5px solid #dbe4e6;
  border-radius: 9px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.uap-eye-btn:hover,
.uap-eye-btn.active { border-color: var(--blue); color: var(--blue); background: #eef3ff; }

/* Delete button */
.uap-delete-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  border: 1.5px solid #fecdd3;
  border-radius: 10px;
  padding: 9px 12px;
  background: #fff5f5;
  color: #dc2626;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.uap-delete-btn:hover { background: #fee2e2; border-color: #dc2626; }

