:root {
  color-scheme: dark;
  --bg: #0a0807;
  --bg-deep: #060504;
  --surface: #12100f;
  --surface-raised: #181411;
  --surface-soft: #1d1815;
  --surface-hover: #241c18;
  --line: rgba(255, 235, 220, 0.085);
  --line-strong: rgba(255, 119, 57, 0.22);
  --text: #fff8f2;
  --text-soft: #d9cbc1;
  --muted: #8f8179;
  --muted-dark: #675c56;
  --orange: #ff6a20;
  --orange-bright: #ff8a35;
  --red: #e12b22;
  --red-bright: #ff493d;
  --green: #55d896;
  --yellow: #ffb84d;
  --radius-xl: 26px;
  --radius-lg: 19px;
  --radius-md: 13px;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--orange-bright);
  outline-offset: 3px;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.noise-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.17;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.ambient {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(130px);
  pointer-events: none;
}

.ambient-one {
  width: 620px;
  height: 620px;
  top: -360px;
  left: 8%;
  background: rgba(255, 88, 22, 0.28);
}

.ambient-two {
  width: 480px;
  height: 480px;
  right: -250px;
  bottom: -220px;
  background: rgba(205, 22, 20, 0.2);
}

/* Connexion */
.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 42px 24px;
}

.login-card {
  position: relative;
  width: min(100%, 540px);
  padding: 36px 56px 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 102, 31, 0.17), transparent 44%),
    linear-gradient(150deg, rgba(25, 20, 17, 0.97), rgba(10, 8, 7, 0.98));
  box-shadow: 0 50px 130px rgba(0, 0, 0, 0.54), inset 0 1px rgba(255, 255, 255, 0.04);
  text-align: center;
  backdrop-filter: blur(24px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 12% auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--orange-bright), var(--red), transparent);
  box-shadow: 0 0 28px rgba(255, 85, 28, 0.7);
}

.login-brand {
  position: relative;
  margin: 0 auto 25px;
}

.login-logo-wrap {
  width: 185px;
  aspect-ratio: 1;
  margin: 0 auto -2px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 20px 26px rgba(0, 0, 0, 0.48)) drop-shadow(0 0 24px rgba(255, 78, 20, 0.13));
}

.login-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-brand-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  width: min(100%, 300px);
  margin: 0 auto;
}

.login-brand-line span {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 114, 49, 0.45));
}

.login-brand-line span:last-child {
  transform: rotate(180deg);
}

.login-brand-line p {
  margin: 0;
  color: #bba99e;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--orange-bright);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 51px);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

h1 span {
  color: transparent;
  background: linear-gradient(100deg, var(--orange-bright), var(--red-bright));
  background-clip: text;
  -webkit-background-clip: text;
}

.login-copy {
  max-width: 405px;
  margin: 22px auto 27px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.discord-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 14px 20px;
  border: 1px solid rgba(255, 142, 70, 0.28);
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(115deg, #f56b25, #d82720);
  box-shadow: 0 15px 32px rgba(214, 49, 27, 0.2), inset 0 1px rgba(255, 255, 255, 0.14);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.discord-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 20px 42px rgba(214, 49, 27, 0.3), inset 0 1px rgba(255, 255, 255, 0.18);
}

.discord-button svg {
  width: 22px;
  flex: 0 0 auto;
  fill: currentColor;
}

.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-top: 22px;
  color: #9a8b82;
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
}

.security-note small {
  color: var(--muted-dark);
  font-size: 10px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(85, 216, 150, 0.08), 0 0 18px rgba(85, 216, 150, 0.45);
}

.alert {
  max-width: 100%;
  margin: 0 0 18px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 73, 61, 0.23);
  border-radius: 12px;
  color: #ffaaa3;
  background: rgba(225, 43, 34, 0.09);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
  overflow-wrap: anywhere;
}

/* Structure */
.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 272px;
  display: flex;
  flex-direction: column;
  padding: 25px 20px 20px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at 30% 0, rgba(255, 88, 20, 0.1), transparent 30%),
    rgba(9, 7, 6, 0.93);
  backdrop-filter: blur(24px);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 1px;
  background: linear-gradient(transparent, rgba(255, 98, 31, 0.22), transparent);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 13px;
  padding: 0 8px 30px;
}

.sidebar-logo {
  width: 49px;
  height: 49px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.42));
}

.sidebar-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-brand > div:last-child {
  min-width: 0;
}

.sidebar-brand strong,
.sidebar-brand small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-brand strong {
  font-size: 16px;
  letter-spacing: -0.025em;
}

.sidebar-brand small {
  margin-top: 3px;
  color: var(--orange-bright);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.nav button {
  position: relative;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #94877f;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav button span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.nav button:hover {
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.025);
  transform: translateX(2px);
}

.nav button.active {
  color: #fff;
  border-color: rgba(255, 111, 37, 0.16);
  background: linear-gradient(100deg, rgba(255, 101, 27, 0.16), rgba(211, 38, 29, 0.06));
  box-shadow: inset 3px 0 var(--orange), 0 8px 24px rgba(0, 0, 0, 0.13);
}

.nav svg,
.icon-button svg {
  width: 19px;
  flex: 0 0 auto;
  fill: currentColor;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-top: auto;
  padding: 18px 7px 1px;
  border-top: 1px solid var(--line);
}

.profile {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 10px;
}

.profile img,
.avatar-fallback {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  object-fit: cover;
  background: var(--surface-soft);
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--orange-bright);
  font-weight: 850;
}

.profile span {
  min-width: 0;
}

.profile strong,
.profile small {
  display: block;
  max-width: 130px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.profile strong {
  font-size: 11px;
}

.profile small {
  margin-top: 3px;
  color: var(--orange-bright);
  font-size: 9px;
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.icon-button:hover {
  color: var(--red-bright);
  border-color: rgba(255, 73, 61, 0.14);
  background: rgba(225, 43, 34, 0.07);
}

.workspace {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-width: 0;
  height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(24px, 3vw, 46px);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 8, 7, 0.76);
  backdrop-filter: blur(22px);
}

.topbar-title {
  min-width: 0;
}

.topbar h2 {
  max-width: min(60vw, 640px);
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 23px;
  letter-spacing: -0.04em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 18px;
  color: var(--muted);
  font-size: 11px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 210px;
  padding: 8px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
}

.status-pill span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-pill i {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--yellow);
}

.status-pill.online i {
  background: var(--green);
  box-shadow: 0 0 12px rgba(85, 216, 150, 0.72);
}

.status-pill.offline i {
  background: var(--red-bright);
  box-shadow: 0 0 12px rgba(255, 73, 61, 0.45);
}

.page-content {
  width: min(100%, 1660px);
  margin: 0 auto;
  padding: 36px clamp(24px, 3vw, 46px) 64px;
}

.section-head {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.section-head > div:first-child {
  min-width: 0;
}

.section-head h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.035em;
}

.section-head p {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex: 0 0 auto;
  gap: 9px;
}

.button {
  min-height: 39px;
  max-width: 240px;
  padding: 9px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-soft);
  background: var(--surface-raised);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(255, 117, 49, 0.36);
  color: #fff;
  background: var(--surface-hover);
}

.button.primary {
  border-color: rgba(255, 121, 53, 0.28);
  color: #fff;
  background: linear-gradient(110deg, #f06a26, #d82b21);
  box-shadow: 0 9px 24px rgba(211, 46, 27, 0.16);
}

.button.danger {
  border-color: rgba(255, 73, 61, 0.17);
  color: #ff9b92;
  background: rgba(225, 43, 34, 0.08);
}

.button.success {
  border-color: rgba(85, 216, 150, 0.16);
  color: #8de7b9;
  background: rgba(85, 216, 150, 0.07);
}

.button:disabled {
  opacity: 0.36;
  cursor: not-allowed;
}

/* Console */
.terminal-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: #080706;
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.025);
}

.terminal-card::before {
  content: "";
  position: absolute;
  inset: 0 8% auto;
  z-index: 2;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 107, 31, 0.5), transparent);
}

.terminal-bar {
  min-width: 0;
  height: 49px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: linear-gradient(180deg, #171310, #100d0c);
  font-size: 10px;
}

.terminal-bar > span:nth-child(2) {
  max-width: 50vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.terminal-bar > span:last-child {
  justify-self: end;
  color: #8de7b9;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.13em;
}

.terminal-dots {
  display: flex;
  gap: 7px;
}

.terminal-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4d423c;
}

.terminal-dots i:first-child { background: var(--red-bright); }
.terminal-dots i:nth-child(2) { background: var(--orange-bright); }
.terminal-dots i:nth-child(3) { background: var(--green); }

.terminal {
  height: calc(100vh - 346px);
  min-height: 390px;
  margin: 0;
  padding: 22px 24px;
  overflow: auto;
  color: #d0c5bc;
  background:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px) 0 0 / 100% 25px,
    #080706;
  font: 11px/1.58 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overscroll-behavior: contain;
}

.command-line {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 57px;
  padding: 11px 17px;
  border-top: 1px solid var(--line);
  background: #110e0c;
}

.prompt {
  color: var(--orange-bright);
  font: 800 12px monospace;
}

.command-line input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #fff;
  background: transparent;
  font: 12px monospace;
}

.command-line input::placeholder {
  color: #5e514b;
}

.command-hint {
  max-width: 310px;
  overflow: hidden;
  color: #635751;
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Équipe et accès */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.metric {
  min-width: 0;
  padding: 17px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(145deg, rgba(27, 22, 19, 0.92), rgba(17, 14, 12, 0.92));
}

.metric span,
.metric strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.metric span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.metric strong {
  margin-top: 5px;
  color: var(--text);
  font-size: 20px;
  letter-spacing: -0.04em;
}

.metric.accent strong {
  color: var(--orange-bright);
}

.staff-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.62fr) minmax(0, 1.45fr);
  align-items: start;
  gap: 24px;
}

.staff-layout > .card:first-child {
  position: sticky;
  top: 122px;
}

.staff-section {
  margin-top: 24px;
}

.card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(24, 20, 17, 0.94), rgba(15, 13, 11, 0.95));
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.17), inset 0 1px rgba(255, 255, 255, 0.025);
}

.card-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 19px 21px;
  border-bottom: 1px solid var(--line);
}

.card-head h3,
.card-head small {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-head h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: -0.025em;
}

.card-head small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-body {
  min-width: 0;
  padding: 23px;
}

.grade-list {
  display: grid;
  gap: 7px;
  max-height: calc(100vh - 230px);
  padding: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.grade-item {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 12px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.grade-item > span:first-child {
  min-width: 0;
}

.grade-item:hover {
  background: rgba(255, 255, 255, 0.025);
}

.grade-item.active {
  border-color: rgba(255, 111, 37, 0.16);
  background: linear-gradient(100deg, rgba(255, 102, 28, 0.13), rgba(216, 43, 33, 0.045));
}

.grade-item strong,
.grade-item small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.grade-item strong {
  font-size: 11px;
}

.grade-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 170px;
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 121, 53, 0.13);
  border-radius: 7px;
  color: var(--orange-bright);
  background: rgba(255, 106, 32, 0.08);
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 16px;
}

.field {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field > label {
  color: #ae9f96;
  font-size: 10px;
  font-weight: 750;
}

.input,
.select {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--text);
  background: #0e0c0b;
  font-size: 11px;
  text-overflow: ellipsis;
}

.input:focus,
.select:focus {
  border-color: rgba(255, 113, 44, 0.52);
  box-shadow: 0 0 0 3px rgba(255, 106, 32, 0.07);
}

.input:disabled,
.select:disabled {
  color: var(--muted-dark);
  background: #0c0a09;
}

.permission-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 13px;
  max-height: 510px;
  padding: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.permission-group {
  min-width: 0;
  padding: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7, 6, 5, 0.34);
}

.permission-group h4 {
  margin: 0 0 9px;
  overflow: hidden;
  color: var(--orange-bright);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.permission-option {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 2px;
  cursor: pointer;
}

.permission-option + .permission-option {
  border-top: 1px solid rgba(255, 255, 255, 0.035);
}

.permission-option input {
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--orange);
}

.permission-option span {
  min-width: 0;
}

.permission-option strong,
.permission-option small {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.permission-option strong {
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.35;
}

.permission-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 21px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 6px;
  min-width: 0;
  padding: 0 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  flex: 0 0 auto;
  padding: 16px 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.tabs button.active {
  border-color: var(--orange);
  color: #fff;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  max-width: 330px;
  padding: 14px 17px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.45;
  text-align: left;
  text-overflow: ellipsis;
  vertical-align: middle;
}

th {
  color: #766a64;
  background: rgba(7, 6, 5, 0.18);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.012);
}

td strong,
td small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

td strong {
  color: var(--text-soft);
  font-size: 11px;
}

td small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.inline-actions {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.inline-actions .select {
  width: 142px;
  padding: 7px 8px;
}

.mini-button {
  flex: 0 0 auto;
  max-width: 90px;
  padding: 7px 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-soft);
  background: var(--surface-raised);
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.mini-button:hover {
  border-color: rgba(255, 117, 49, 0.3);
}

.mini-button.danger {
  color: #ff9189;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.search-results {
  display: grid;
  gap: 9px;
  max-height: 440px;
  padding: 15px 20px 20px;
  overflow-y: auto;
  border-bottom: 1px solid var(--line);
  overscroll-behavior: contain;
}

.search-result {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 13px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.012);
}

.search-result > span:first-child {
  min-width: 0;
}

.search-result strong,
.search-result small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.search-result strong {
  font-size: 11px;
}

.search-result small {
  max-width: min(50vw, 620px);
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.empty {
  padding: 42px 24px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
  overflow-wrap: anywhere;
}

.toast-zone {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100vw - 44px));
  pointer-events: none;
}

.toast {
  width: 100%;
  padding: 13px 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 11px;
  color: var(--text-soft);
  background: #1a1512;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.5);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  animation: toast-in 220ms ease-out;
}

.toast.error {
  border-left-color: var(--red-bright);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
}

@media (max-width: 1180px) {
  .permission-groups {
    grid-template-columns: 1fr;
  }

  .staff-layout {
    grid-template-columns: minmax(250px, 0.52fr) minmax(0, 1fr);
  }

  .command-hint {
    display: none;
  }
}

@media (max-width: 960px) {
  .staff-layout {
    grid-template-columns: 1fr;
  }

  .staff-layout > .card:first-child {
    position: static;
  }

  .grade-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 360px;
  }

  .permission-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .terminal {
    height: 55vh;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    height: 70px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar::after {
    display: none;
  }

  .sidebar-brand {
    padding: 0;
  }

  .sidebar-logo {
    width: 46px;
    height: 46px;
  }

  .sidebar-brand > div:last-child {
    display: none;
  }

  .nav {
    display: flex;
    margin-left: 3px;
    overflow-x: auto;
  }

  .nav button {
    width: 43px;
    height: 43px;
    justify-content: center;
    padding: 0;
  }

  .nav button span {
    display: none;
  }

  .sidebar-foot {
    flex: 0 0 auto;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
  }

  .profile {
    display: none;
  }

  .workspace {
    width: 100%;
  }

  .topbar {
    top: 70px;
    height: 78px;
    padding: 0 18px;
  }

  .topbar h2 {
    max-width: 44vw;
    font-size: 19px;
  }

  .topbar-right {
    gap: 8px;
  }

  .topbar-right #clock {
    display: none;
  }

  .status-pill {
    max-width: 155px;
  }

  .page-content {
    padding: 24px 16px 42px;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
  }

  .control-row {
    width: 100%;
    justify-content: flex-start;
  }

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

  .metric {
    padding: 13px 12px;
  }

  .metric strong {
    font-size: 17px;
  }

  .grade-list,
  .permission-groups {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: 1;
  }

  .card-body {
    padding: 18px;
  }

  .terminal-bar {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .terminal-bar > span:nth-child(2) {
    max-width: none;
  }

  .terminal {
    min-height: 340px;
    padding: 18px;
  }

  .command-line {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .search-result {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-result .inline-actions {
    width: 100%;
  }

  .search-result .select {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .login-wrap {
    padding: 18px 12px;
  }

  .login-card {
    padding: 25px 21px 31px;
    border-radius: 25px;
  }

  .login-logo-wrap {
    width: 150px;
  }

  .security-note {
    align-items: flex-start;
  }

  .status-pill span {
    display: none;
  }

  .status-pill {
    padding: 10px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .metric strong {
    margin: 0;
  }

  .control-row .button {
    flex: 1;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .form-actions .button {
    max-width: none;
    width: 100%;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .search-row .button {
    max-width: none;
  }

  .inline-actions {
    flex-wrap: wrap;
  }
}
