/* ===========================
   CSS VARIABLES & ROOT
   =========================== */
:root {
  --surface-app: #ecf0f1;
  --surface-panel: #ffffff;
  --surface-soft: #f8fafc;
  --line: #d9e1e8;
  --line-strong: #c9d4df;
  --text-main: #2c3e50;
  --text-muted: #51606e;
  --brand-dark: #2c3e50;
  --brand-mid: #34495e;
  --brand-mid-hover: #2f4356;
  --danger: #d32f2f;
  --danger-hover: #b71c1c;
  --radius-lg: 6px;
  --radius-md: 4px;
  --shadow-panel: 0 8px 20px rgba(21, 35, 49, 0.08);
  --shadow-toolbar: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* ===========================
   GLOBAL & BASE STYLES
   =========================== */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 12% 12%, rgba(52, 73, 94, 0.22), transparent 36%),
              radial-gradient(circle at 88% 85%, rgba(44, 62, 80, 0.2), transparent 30%),
              linear-gradient(150deg, #e8eef2, #dfe7ec);
}

.background-alt {
  background: linear-gradient(rgba(18, 29, 40, 0.5), rgba(18, 29, 40, 0.58)),
              url('/assets/map-background.svg') center center / cover no-repeat;
}

body.login-page {
  display: grid;
  place-items: center;
  padding: 24px 0;
  background: linear-gradient(rgba(18, 29, 40, 0.5), rgba(18, 29, 40, 0.58)),
              url('/assets/map-background.svg') center center / cover no-repeat;
}

body.app-page {
  background: radial-gradient(circle at 15% 25%, rgba(67, 99, 129, 0.35), transparent 42%),
              linear-gradient(140deg, #d8e3ea 0%, #e9eff3 50%, #dde6ed 100%);
}

body.login-page .shell {
  width: min(460px, 92vw);
  margin: 0;
  padding: 0;
  display: grid;
  justify-items: center;
  gap: 14px;
}

body.login-page .brand,
body.login-page .subtitle {
  text-align: center;
}

body.login-page .subtitle {
  margin-left: auto;
  margin-right: auto;
}

body.login-page .auth-card {
  width: 100%;
  max-width: 460px;
  background-color: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(2px);
}

.separator-horisontal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 18px 0 12px;
  font-size: 0.84rem;
  color: #5b6773;
}

.separator-horisontal::before, .separator-horisontal::after {
  content: '';
  flex-grow: 1;
  height: 1px;
  background-color: var(--line);
}

/* ===========================
   LOGIN PAGE LAYOUT
   =========================== */
.auth-form-panel {
  padding: 8px;
  display: grid;
  align-content: center;
}

.shell {
  width: min(980px, 92vw);
  margin: 0 auto;
  padding: 30px 0 48px;
}

.brand {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 0.95;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 3px 10px rgba(23, 37, 50, 0.32);
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-link:hover {
  text-decoration: none;
}

.subtitle {
  margin: 8px 0 22px;
  max-width: 52ch;
  color: #e8eef2;
  font-weight: 500;
  text-shadow: 0 2px 12px rgba(20, 34, 47, 0.24);
}

/* ===========================
   CARDS & CONTAINERS
   =========================== */
.card {
  background-color: var(--surface-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  animation: reveal 0.35s ease both;
}

.card h2 {
  margin: 0;
  margin-bottom: 16px;
  font-size: 1.06rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-main);
}

.auth-card {
  max-width: 560px;
}

.stack {
  display: grid;
  gap: 8px;
}

/* ===========================
   FORM ELEMENTS & FIELDS
   =========================== */
.create-event-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
  row-gap: 10px;
  align-content: start;
  width: 100%;
  padding: 0;
  margin: 0;
}

.event-field {
  display: grid;
  gap: 6px;
}

.event-field-wide {
  grid-column: 1 / -1;
}

.event-rdv-box {
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid rgba(125, 146, 166, 0.55);
  border-radius: 8px;
  background-color: transparent;
}

.event-rdv-box legend {
  padding: 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #4f6173;
}

.event-rdv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.event-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.event-form-actions button {
  margin-top: 0;
  min-width: 140px;
}

label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5b6773;
}

input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  padding: 0 12px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  border-color: #7f98af;
  box-shadow: 0 0 0 3px rgba(47, 85, 120, 0.16);
}

textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  color: var(--text-main);
  padding: 10px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: #7f98af;
  box-shadow: 0 0 0 3px rgba(47, 85, 120, 0.16);
}

select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="%232f4558" d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 20px;
  padding: 0 36px 0 12px;
  color: var(--text-main);
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

select:hover {
  background-color: #f9fbfd;
}

select:focus {
  outline: none;
  border-color: #7f98af;
  box-shadow: 0 0 0 3px rgba(47, 85, 120, 0.16);
}

select option {
  padding: 8px;
  background-color: #ffffff;
  color: var(--text-main);
}

button {
  margin-top: 8px;
  height: 42px;
  border: 1px solid var(--brand-dark);
  border-radius: var(--radius-md);
  background-color: var(--brand-dark);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.16s ease;
}

button:hover {
  background-color: var(--brand-mid-hover);
}

button:active {
  transform: translateY(1px);
}

.error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 55%, white);
  border-radius: var(--radius-md);
  background-color: color-mix(in srgb, var(--danger) 12%, white);
  color: var(--danger);
  font-weight: 700;
}

.muted {
  margin-top: 14px;
  font-size: 0.84rem;
  color: #5b6773;
}

.features {
  margin: 14px 0 20px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background-color: var(--surface-soft);
}

.features li {
  margin: 6px 0;
  color: var(--text-muted);
}

/* ===========================
   APP LAYOUT
   =========================== */
.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.app-topbar {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 20px;
  background-color: #2c3e50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border-bottom: 0;
}

.topbar-left {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

/* ===========================
   NAV TOGGLE
   =========================== */
.nav-toggle {
  width: 38px;
  height: 36px;
  margin: 0;
  border-radius: 8px;
  border: 1px solid #35516d;
  background-color: #41617f;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background-color: #edf5fb;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.app-layout.nav-collapsed .nav-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.app-layout.nav-collapsed .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.app-layout.nav-collapsed .nav-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===========================
   BRANDING
   =========================== */
.app-brand-wrap {
  min-width: 0;
}

.app-brand {
  margin: 0;
  color: #f2f7fa;
  font-size: 1rem;
  letter-spacing: 0.09em;
  font-weight: 700;
  text-decoration: none;
}

.app-brand:hover {
  text-decoration: none;
}

.app-subtitle {
  margin: 2px 0 0;
  color: #cfdae4;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ===========================
   TOPBAR ACTIONS
   =========================== */
.topbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-secondary-btn,
.user-menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  color: #f5fbff;
  text-decoration: none;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #35516d;
  background-color: #41617f;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-sizing: border-box;
  box-shadow: 0 10px 18px rgba(16, 29, 40, 0.12);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.toolbar-secondary-btn:hover,
.user-menu:hover {
  background-color: #35516d;
  border-color: #35516d;
  transform: translateY(-1px);
}

.toolbar-secondary-btn:focus-visible,
.user-menu:focus-visible {
  outline: 2px solid rgba(232, 241, 248, 0.9);
  outline-offset: 2px;
}

.toolbar-secondary-btn i {
  font-size: 1rem;
}

.user-menu {
  justify-content: space-between;
  min-width: 168px;
}

.user-menu.is-active {
  border-color: #9bb9d4;
  background: linear-gradient(180deg, #4f7291 0%, #3f617d 100%);
}

.user-identity {
  display: grid;
  text-align: right;
  line-height: 1.1;
  min-width: 0;
}

.user-identity strong {
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.user-identity small {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.88;
  white-space: nowrap;
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background-color: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(225, 236, 245, 0.5);
}

.user-avatar svg {
  width: 15px;
  height: 15px;
  fill: #ecf4fb;
}

/* ===========================
   MAIN CONTENT AREA
   =========================== */
.app-main {
  width: 100%;
  padding: 24px;
  display: grid;
  align-content: stretch;
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

.app-body {
  height: calc(100vh - 50px);
  display: grid;
  grid-template-columns: 200px 1fr;
  transition: grid-template-columns 0.24s ease;
  overflow: hidden;
}

body.user-profile-page {
  overflow-y: auto;
}

.user-profile-page .app-layout {
  min-height: 100vh;
}

.user-profile-page .app-body {
  min-height: calc(100vh - 50px);
  height: auto;
  overflow: visible;
}

.user-profile-page .app-main {
  min-height: calc(100vh - 50px);
  height: auto;
  overflow: visible;
  align-content: start;
  grid-template-rows: auto;
}

.user-profile-page .app-panel {
  min-height: auto;
}

.user-profile-page-dispatching .app-body {
  grid-template-columns: minmax(0, 1fr);
}

.user-profile-page-dispatching .app-main {
  padding: 24px clamp(18px, 3vw, 32px) 32px;
}

.user-profile-page-dispatching .user-profile-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
}

/* ===========================
   SIDE NAVIGATION
   =========================== */
.side-nav {
  border-right: 0;
  background-color: #34495e;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.side-nav-menu {
  display: grid;
  gap: 0;
  padding: 10px 0;
}

.side-link {
  height: 48px;
  padding: 14px 20px;
  border-radius: 0;
  color: #ffffff;
  text-decoration: none;
  border: 0;
  background-color: transparent;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  transition: background-color 0.2s ease;
}

.side-link-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  color: #ffffff;
}

.side-link-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.side-link.active {
  background-color: rgba(255, 255, 255, 0.14);
  font-weight: 600;
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.55);
}

.app-layout.nav-collapsed .app-body {
  grid-template-columns: 60px 1fr;
}

.app-layout.nav-collapsed .side-nav-menu {
  padding: 10px 0;
}

.app-layout.nav-collapsed .side-link-label {
  display: none;
}

/* ===========================
   PANELS
   =========================== */
.app-panel {
  width: 100%;
  display: grid;
  align-content: start;
  min-height: 100%;
  gap: 14px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
}

.profile-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(165deg, #f8fbfd 0%, #f1f6fa 100%);
  padding: 16px;
}

.profile-card h2 {
  margin-bottom: 14px;
}

.profile-card p {
  margin: 0 0 10px;
  display: grid;
  gap: 3px;
}

.profile-card p span {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6f7d89;
}

.profile-card p strong {
  font-size: 1rem;
  color: #2a3c4e;
}

.profile-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.user-profile-shell {
  gap: 18px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 249, 252, 0.98) 100%);
}

.user-profile-edit-shell {
  display: grid;
  gap: 18px;
}

.user-profile-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 18px;
  padding: 24px;
  border: 1px solid #3c556f;
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 12%, rgba(153, 190, 221, 0.38), transparent 24%),
    radial-gradient(circle at 85% 18%, rgba(255, 255, 255, 0.2), transparent 22%),
    linear-gradient(140deg, #223547 0%, #34516a 54%, #4d6d88 100%);
  color: #ffffff;
}

.user-profile-hero::after {
  content: '';
  position: absolute;
  right: -40px;
  bottom: -56px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  filter: blur(2px);
}

.user-profile-hero-head,
.user-profile-hero-tools,
.user-phone-tile-status {
  position: relative;
  z-index: 1;
}

.user-profile-hero-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.user-profile-hero-tools {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-shrink: 0;
}

.user-profile-identity {
  position: relative;
  z-index: 1;
}

.user-profile-identity {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.user-profile-avatar {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(235, 243, 250, 0.36);
  box-shadow: 0 16px 30px rgba(12, 23, 33, 0.26);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.user-profile-copy {
  min-width: 0;
}

.user-profile-copy h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.user-profile-meta-line {
  margin-top: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.user-meta-chip,
.user-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(226, 237, 247, 0.26);
  background-color: rgba(255, 255, 255, 0.12);
  color: #f4f9fd;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.user-status-badge.is-active {
  background-color: rgba(106, 191, 137, 0.22);
  border-color: rgba(155, 227, 180, 0.46);
}

.user-status-badge.is-muted {
  background-color: rgba(217, 99, 99, 0.22);
  border-color: rgba(245, 170, 170, 0.4);
}

.user-profile-edit-btn {
  flex-shrink: 0;
  position: relative;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(255, 255, 255, 0.74);
  border-radius: 14px;
  box-shadow:
    0 14px 30px rgba(12, 23, 33, 0.34),
    0 0 0 4px rgba(255, 255, 255, 0.12);
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease;
}

.user-profile-edit-btn i {
  font-size: 1.08rem;
}

.user-profile-edit-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 18px 34px rgba(12, 23, 33, 0.4),
    0 0 0 4px rgba(255, 255, 255, 0.16);
}

.user-profile-edit-btn:focus-visible {
  outline: none;
  box-shadow:
    0 18px 34px rgba(12, 23, 33, 0.4),
    0 0 0 5px rgba(255, 255, 255, 0.28);
}

.action-edit-btn.user-profile-edit-btn {
  border-color: rgba(255, 255, 255, 0.86);
  background: linear-gradient(145deg, #ffffff 0%, #dcebf5 100%);
  color: #1f3343;
}

.action-edit-btn.user-profile-edit-btn:hover {
  border-color: #ffffff;
  background: linear-gradient(145deg, #ffffff 0%, #cfe1ef 100%);
}

.user-profile-cancel-btn {
  border-color: rgba(255, 255, 255, 0.82);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.12));
  color: #ffffff;
}

.user-profile-cancel-btn:hover {
  border-color: #ffffff;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.18));
}

.user-profile-feedback-stack {
  display: grid;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.user-profile-feedback {
  margin: 0;
  position: relative;
  z-index: 1;
}

.user-profile-edit-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.user-detail-card {
  padding: 0;
  border-radius: 16px;
}

.user-phone-tile-card {
  overflow: hidden;
}

.user-phone-tile-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  background: linear-gradient(155deg, #f8fbfe 0%, #edf4fa 100%);
}

.user-phone-tile-card.is-edit-mode .user-phone-tile-shell {
  background: linear-gradient(155deg, #f7fbff 0%, #e8f2fb 100%);
}

.user-phone-tile-copy {
  display: grid;
  gap: 6px;
}

.user-phone-tile-kicker {
  color: #617384;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.user-phone-tile-copy strong {
  color: #233546;
  font-size: 1.18rem;
}

.user-phone-tile-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.user-section-heading {
  display: grid;
  gap: 4px;
  padding: 18px 20px 0;
}

.user-section-heading-inline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.user-section-heading h2 {
  margin: 0;
}

.user-section-heading p {
  margin: 0;
  color: #5f7181;
  font-size: 0.92rem;
  line-height: 1.5;
}

.user-function-list {
  display: grid;
  gap: 12px;
  padding: 18px 20px 20px;
}

.user-function-editor {
  padding: 18px 20px 20px;
}

.user-profile-function-picker {
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f2f7fb 100%);
}

.user-profile-function-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.user-profile-function-option {
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid #dbe5ee;
  border-radius: 12px;
  background-color: #ffffff;
}

.user-profile-function-option span {
  display: grid;
  gap: 4px;
}

.user-profile-function-option small {
  color: #667989;
  font-size: 0.76rem;
}

.user-function-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #dce6ee;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.user-function-item strong {
  display: block;
  color: #243546;
  font-size: 1rem;
}

.user-function-item p {
  margin: 4px 0 0;
  color: #5f7181;
  font-size: 0.9rem;
  line-height: 1.5;
}

.user-function-badges,
.user-phone-tags {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.user-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #d3dfe9;
  border-radius: 999px;
  background-color: #eef4f8;
  color: #2f4558;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.user-tag-accent {
  border-color: #2f4558;
  background-color: #2f4558;
  color: #ffffff;
}

.user-tag-phonebip {
  border-color: #84bb94;
  background-color: #e8f7ec;
  color: #245e35;
}

.profile-empty-state {
  margin: 18px 20px 20px;
  padding: 20px;
  border: 1px dashed #c6d4df;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbfe 0%, #f1f6fa 100%);
}

.profile-empty-state strong {
  display: block;
  color: #2a3d4f;
  font-size: 1rem;
}

.profile-empty-state p {
  margin: 8px 0 0;
  color: #5f7181;
  line-height: 1.5;
}

.user-phone-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  padding: 18px 20px 20px;
}

.user-phone-feedback-stack {
  display: grid;
  gap: 10px;
  padding: 0 20px;
}

.user-phone-feedback {
  margin: 0 20px;
}

.user-phone-create-box {
  padding: 0 20px 20px;
}

.user-phone-create-form {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px dashed #c6d4df;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f2f7fb 100%);
}

.user-phone-type-summary {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.user-phone-type-picker {
  margin: 0;
}

.user-phone-type-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.user-phone-type-hint {
  margin-left: 6px;
  color: #245e35;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.user-phone-item {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #dce6ee;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fafd 100%);
  box-shadow: 0 12px 22px rgba(21, 37, 49, 0.06);
}

.user-phone-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.user-phone-link {
  color: #233546;
  font-size: 1.14rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.user-phone-link:hover {
  color: #385872;
}

.user-phone-link-static {
  text-decoration: none;
}

.user-phone-detail {
  margin: 0;
  color: #5a6c7c;
  font-size: 0.92rem;
  line-height: 1.55;
}

.user-phones-card.is-edit-mode .user-phone-item {
  border-style: dashed;
  background: linear-gradient(180deg, #ffffff 0%, #f9fcfe 100%);
}

.user-phone-edit-form {
  display: grid;
  gap: 14px;
}

.user-edit-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 240px;
}

.user-edit-field label {
  color: #4f6173;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.user-edit-field input,
.user-edit-field select,
.user-edit-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #c9d6e2;
  border-radius: 10px;
  background-color: #ffffff;
  color: #233546;
  font: inherit;
  box-sizing: border-box;
}

.user-edit-field textarea {
  min-height: 104px;
  resize: vertical;
}

.user-edit-field input:focus,
.user-edit-field select:focus,
.user-edit-field textarea:focus {
  outline: none;
  border-color: #587892;
  box-shadow: 0 0 0 3px rgba(88, 120, 146, 0.18);
}

.user-edit-field input:disabled,
.user-edit-field select:disabled,
.user-edit-field textarea:disabled {
  background-color: #eef3f7;
  color: #617384;
  cursor: not-allowed;
}

.user-profile-hero .user-edit-field label {
  color: #e4edf5;
}

.user-profile-hero .user-edit-field input,
.user-profile-hero .user-edit-field select,
.user-profile-hero .user-edit-field textarea {
  border-color: rgba(226, 237, 247, 0.26);
  background-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.user-profile-hero .user-edit-field input::placeholder,
.user-profile-hero .user-edit-field textarea::placeholder {
  color: rgba(244, 249, 253, 0.72);
}

.user-profile-hero .user-edit-field input:focus,
.user-profile-hero .user-edit-field select:focus,
.user-profile-hero .user-edit-field textarea:focus {
  border-color: rgba(255, 255, 255, 0.54);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.user-edit-field-wide {
  width: 100%;
}

.user-profile-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.user-profile-form-actions button {
  margin-top: 0;
}

.user-phone-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.user-phone-edit-actions button {
  margin-top: 0;
  min-width: 150px;
}

.user-phone-delete-btn {
  border-color: #b71c1c;
  background-color: #d32f2f;
}

.user-phone-delete-btn:hover {
  background-color: #b71c1c;
}

.user-schedule-feedback-stack {
  display: grid;
  gap: 10px;
  padding: 0 20px;
}

.user-schedule-feedback {
  margin: 0 20px;
}

.user-schedule-list {
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
}

.user-schedule-item {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #dce6ee;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f9fc 100%);
  box-shadow: 0 12px 22px rgba(21, 37, 49, 0.05);
}

.user-schedules-card.is-edit-mode .user-schedule-item {
  border-style: dashed;
  background: linear-gradient(180deg, #ffffff 0%, #f9fcfe 100%);
}

.user-schedule-edit-form {
  display: grid;
  gap: 14px;
}

.user-schedule-edit-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(120px, 1fr));
  gap: 12px;
}

.user-schedule-edit-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-schedule-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.user-schedule-range {
  margin: 6px 0 0;
  color: #2f4558;
  font-size: 0.94rem;
  font-weight: 700;
}

.user-schedule-copy {
  display: grid;
  gap: 10px;
}

.user-schedule-detail,
.user-schedule-note {
  margin: 0;
  color: #5a6c7c;
  font-size: 0.92rem;
  line-height: 1.55;
}

.user-schedule-note span {
  display: block;
  margin-bottom: 4px;
  color: #6d7b88;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.user-tag-schedule-current {
  border-color: #84bb94;
  background-color: #e8f7ec;
  color: #245e35;
}

.user-tag-schedule-upcoming {
  border-color: #a5bdd3;
  background-color: #edf5fb;
  color: #2e516d;
}

.user-tag-schedule-completed {
  border-color: #d3dfe9;
  background-color: #f3f6f9;
  color: #5f7181;
}

.management-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.management-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.success-msg {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #78b78d;
  border-radius: var(--radius-md);
  background-color: #e9f8ee;
  color: #1f5f2f;
  font-weight: 700;
}

/* ===========================
   TABS
   =========================== */
.tabs-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
  width: 100%;
  margin-bottom: 16px;
}

.tabs-header-frame {
  display: flex;
  align-items: center;
  padding: 16px;
  gap: 12px;
  min-width: 0;
  border: 1px solid #d5e0ea;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, #f8fbfe 0%, #edf4fa 100%);
  flex: 1 1 0;
}

.tabs {
  display: flex;
  gap: 8px;
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
}

.tabs::-webkit-scrollbar {
  height: 6px;
}

.tabs::-webkit-scrollbar-track {
  background-color: transparent;
}

.tabs::-webkit-scrollbar-thumb {
  background-color: #c5d3e0;
  border-radius: 3px;
}

.tabs::-webkit-scrollbar-thumb:hover {
  background-color: #a8b8c8;
}

.tab-btn {
  height: 38px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid #8da3b6;
  border-radius: 7px;
  background-color: #edf3f8;
  color: #2f4558;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn:hover {
  background-color: #dbe7f1;
}

.tab-btn.active {
  background-color: #2f4558;
  border-color: #2f4558;
  color: #ffffff;
}

.tab-panel {
  display: none;
  gap: 12px;
}

.tab-panel.active {
  display: grid;
  min-height: 100%;
  grid-template-rows: minmax(0, 1fr);
  align-content: stretch;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.tab-panel h3 {
  margin: 0;
  font-size: 1rem;
  color: #2b3f52;
}

.category-frame {
  min-height: 320px;
  border: 1px solid #d5e0ea;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, #f8fbfe 0%, #edf4fa 100%);
  padding: 16px;
  display: grid;
  align-content: start;
}

.tab-panel.active > .category-frame {
  min-height: 100%;
  height: 100%;
  grid-template-rows: minmax(0, 1fr);
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  align-content: stretch;
}

.category-frame p {
  margin: 0;
  font-size: 0.95rem;
  color: #44586a;
  font-weight: 600;
}

.users-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tab-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: min(100%, 420px);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}

.tab-actions > * {
  flex: 0 0 auto;
}

.tab-actions::-webkit-scrollbar {
  height: 6px;
}

.tab-actions::-webkit-scrollbar-track {
  background-color: transparent;
}

.tab-actions::-webkit-scrollbar-thumb {
  background-color: #c5d3e0;
  border-radius: 3px;
}

.tab-actions::-webkit-scrollbar-thumb:hover {
  background-color: #a8b8c8;
}

/* ===========================
   BUTTONS
   =========================== */
.icon-btn {
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 1px solid #8da3b6;
  border-radius: 7px;
  background-color: #edf3f8;
  color: #2f4558;
  font-size: 1rem;
}

.icon-btn:hover {
  background-color: #dbe7f1;
}

.user-add-btn {
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 1px solid #2f4558;
  border-radius: 7px;
  background-color: #2f4558;
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.user-add-btn:hover {
  background-color: #243849;
}

/* ===========================
   TABLES
   =========================== */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: auto;
  background-color: #ffffff;
}

.users-table-wrap {
  max-height: none;
  height: 100%;
  min-height: 100%;
  overflow-y: auto;
}

.tab-panel.active .table-wrap {
  height: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e4ebf1;
  font-size: 0.9rem;
}

.data-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #556576;
  background-color: #f3f7fb;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.bool-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.bool-mark-yes {
  color: #1f7a33;
}

.bool-mark-no {
  color: var(--danger);
}

.color-swatch {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #d9e1e8;
  vertical-align: middle;
}

.user-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  width: 100%;
}

.inline-action-form {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.table-actions-cell {
  text-align: right !important;
  vertical-align: middle;
  white-space: nowrap;
}

/* ===========================
   FUNCTIONS
   =========================== */
.function-picker {
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid #d5e0ea;
  border-radius: 8px;
}

.function-picker legend {
  padding: 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #4f6173;
}

.function-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 8px;
}

.function-picker-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: #2f4558;
  text-transform: none;
  letter-spacing: normal;
}

.function-picker-option input {
  width: 16px;
  height: 16px;
}

.function-row-form {
  display: grid;
  grid-template-columns: 1.4fr auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #dde6ee;
  border-radius: var(--radius-md);
  padding: 10px;
  background-color: #ffffff;
}

.function-list {
  display: grid;
  gap: 10px;
}

.function-name-label {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #d5e0ea;
  border-radius: 6px;
  background-color: #f8fbfe;
  color: #2f4558;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-icon-btn {
  width: 38px;
  height: 38px;
  margin-top: 0;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  font-size: 0.98rem;
  letter-spacing: normal;
}

.action-edit-btn {
  border-color: #2f4558;
  background-color: #2f4558;
}

.action-edit-btn:hover {
  background-color: #243849;
}

.action-profile-btn {
  border-color: #4f7291;
  background-color: #5d84a6;
  color: #f5fbff;
}

.action-profile-btn:hover {
  background-color: #4a7193;
}

.action-key-btn {
  border-color: #6a4c93;
  background-color: #7b57ad;
}

.action-key-btn:hover {
  background-color: #674791;
}

.action-trash-btn {
  border-color: #b71c1c;
  background-color: #d32f2f;
}

.action-trash-btn:hover {
  background-color: #b71c1c;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: #425364;
  text-transform: none;
  letter-spacing: normal;
}

.checkbox-inline input {
  width: 16px;
  height: 16px;
}

/* ===========================
   MODALS
   =========================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background-color: rgba(20, 32, 46, 0.52);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  width: min(560px, 96vw);
  max-height: 98vh;
  border: 1px solid #c8d5e1;
  border-radius: 10px;
  background-color: #ffffff;
  box-shadow: 0 20px 44px rgba(15, 31, 44, 0.28);
  padding: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  padding: 14px 14px 8px 14px;
  border-bottom: 1px solid #e4ebf1;
}

.modal-card > form,
.modal-card > .table-wrap {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #c5d3e0 transparent;
}

.modal-card > .modal-form-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #c5d3e0 transparent;
}

#createEventModal {
  place-items: start center;
  overflow-y: auto;
}

#createEventModal .modal-card {
  max-height: calc(100dvh - 24px);
  margin: 12px 0;
}

#createEventModal .modal-form-scroll {
  min-height: 0;
  max-height: calc(100dvh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
}

#createEventModal .create-event-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#createEventModal .event-rdv-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#createEventModal .event-field-wide,
#createEventModal .event-form-actions {
  grid-column: 1 / -1;
}

@media (max-width: 768px) {
  #createEventModal {
    place-items: start center;
    padding: 8px;
    overflow-y: auto;
  }

  #createEventModal .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 16px);
    margin: 0;
  }

  #createEventModal .modal-form-scroll {
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  #createEventModal .create-event-grid,
  #createEventModal .event-rdv-grid {
    grid-template-columns: 1fr;
  }

  #createEventModal .event-field-wide,
  #createEventModal .event-form-actions {
    grid-column: auto;
  }
}

.modal-card > .modal-form-scroll::-webkit-scrollbar {
  width: 8px;
}

#createEventModal .modal-form-scroll::-webkit-scrollbar {
  width: 8px;
}

.modal-card > .modal-form-scroll::-webkit-scrollbar-track {
  background-color: transparent;
}

.modal-card > .modal-form-scroll::-webkit-scrollbar-thumb {
  background-color: #c5d3e0;
  border-radius: 4px;
}

.modal-card > .modal-form-scroll::-webkit-scrollbar-thumb:hover {
  background-color: #a8b8c8;
}

.modal-card > form.create-event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  column-gap: 14px;
  row-gap: 10px;
  align-content: start;
}

.modal-card > .modal-form-scroll > form.create-event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  column-gap: 14px;
  row-gap: 10px;
  align-content: start;
  width: 100%;
}

.modal-card > .table-wrap {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 6px 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-close {
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid #a9bbca;
  border-radius: 6px;
  background-color: #edf3f8;
  color: #2f4558;
  font-size: 1.2rem;
  line-height: 1;
}

body.modal-open {
  overflow: hidden;
}

.secondary-btn {
  height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border: 1px solid #8da3b6;
  border-radius: var(--radius-md);
  color: #2f4558;
  font-weight: 700;
  font-size: 0.84rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  background-color: #edf3f8;
}

.secondary-btn:hover {
  background-color: #e1eaf1;
}

/* ===========================
   EVENTS SECTION
   =========================== */
.events-toolbar {
  display: grid;
  gap: 12px;
}

.events-toolbar-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.events-toolbar-field {
  display: grid;
  gap: 6px;
}

.events-search-field {
  min-width: 220px;
  flex: 1 1 300px;
}

.events-search-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.events-search-btn {
  margin-top: 0;
}

.events-toolbar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.events-status-manage-btn {
  font-size: 0.75rem;
  min-width: 96px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.events-toolbar-actions .secondary-btn,
.events-toolbar-actions button {
  margin-top: 0;
}

.events-filter-box {
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid rgba(125, 146, 166, 0.55);
  border-radius: 8px;
  background-color: transparent;
  flex: 0 1 auto;
}

.events-filter-box legend {
  padding: 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #4f6173;
}

.events-filter-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 220px)) auto;
  gap: 10px;
  align-items: end;
}

.status-placeholder {
  opacity: 0.75;
  cursor: not-allowed;
}

.events-frame {
  max-height: 520px;
  overflow: auto;
}

.events-archive-modal {
  width: min(1180px, 96vw);
}

@media (max-width: 1100px) {
}

@media (max-width: 820px) {
  .app-topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar-left,
  .topbar-actions {
    width: 100%;
  }

  .topbar-left {
    justify-content: space-between;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .toolbar-secondary-btn,
  .user-menu {
    flex: 1 1 calc(50% - 5px);
  }

  .user-profile-shell {
    padding: 18px;
  }

  .user-profile-hero-head,
  .user-phone-tile-shell,
  .user-section-heading-inline {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-profile-hero-tools {
    width: 100%;
    justify-content: flex-end;
  }

  .user-profile-edit-grid,
  .user-schedule-edit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-phone-tile-status {
    width: 100%;
    justify-content: flex-start;
  }

  .user-profile-form-actions {
    justify-content: flex-start;
  }

  .user-phone-type-summary {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-main {
    padding: 16px;
  }

  .user-profile-identity {
    align-items: flex-start;
  }

  .user-profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    font-size: 1.35rem;
  }

  .user-phone-list {
    grid-template-columns: 1fr;
  }

  .user-function-item,
  .user-phone-main,
  .user-schedule-main {
    flex-direction: column;
  }

  .user-profile-edit-grid,
  .user-schedule-edit-grid,
  .user-profile-function-grid {
    grid-template-columns: 1fr;
  }

  .user-function-badges,
  .user-phone-tags {
    justify-content: flex-start;
  }

  .toolbar-secondary-btn,
  .user-menu {
    flex: 1 1 100%;
  }

  .user-profile-form-actions .secondary-btn,
  .user-profile-form-actions button,
  .user-phone-edit-actions button {
    width: 100%;
    min-width: 0;
  }

  .user-phone-create-box {
    padding: 0 20px 18px;
  }

  .user-phone-type-grid {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   COLOR PICKER
   =========================== */
.color-picker-shell {
  width: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

#colorPickerModal .td-color-picker {
  width: min(430px, 96vw);
  padding: 14px;
}

#colorPickerModal .td-picker-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 8px;
}

#colorPickerModal .td-picker-square-wrap {
  position: relative;
  height: 200px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}

#colorPickerModal #tdPickerSquare {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#colorPickerModal .td-picker-cursor {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(20, 32, 46, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
  left: 0;
  top: 0;
}

#colorPickerModal .td-picker-rails {
  display: flex;
  gap: 10px;
}

#colorPickerModal .td-picker-rail-wrap {
  display: grid;
  justify-items: center;
  gap: 6px;
}

#colorPickerModal .td-picker-rail-wrap span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5b6773;
  font-weight: 700;
}

#colorPickerModal .td-picker-rail {
  position: relative;
  width: 18px;
  height: 200px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
}

#colorPickerModal .checker-bg {
  background-image: linear-gradient(45deg, #dbe5ee 25%, transparent 25%),
                    linear-gradient(-45deg, #dbe5ee 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #dbe5ee 75%),
                    linear-gradient(-45deg, transparent 75%, #dbe5ee 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

#colorPickerModal #tdPickerHue,
#colorPickerModal #tdPickerAlpha {
  width: 100%;
  height: 100%;
  display: block;
  cursor: ns-resize;
}

#colorPickerModal #tdPickerHue {
  background: linear-gradient(to bottom, #ff0000 0%, #ff00ff 17%, #0000ff 33%, #00ffff 50%, #00ff00 67%, #ffff00 83%, #ff0000 100%);
}

#colorPickerModal .td-picker-rail-cursor {
  position: absolute;
  left: 50%;
  width: 22px;
  height: 10px;
  border-radius: 8px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(20, 32, 46, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  top: 0;
  z-index: 2;
}

#colorPickerModal .td-picker-footer {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

#colorPickerModal .td-picker-preview {
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

#colorPickerModal .td-picker-validate-btn {
  margin-top: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--brand-dark);
  border-radius: 6px;
  background: var(--brand-dark);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#colorPickerModal .td-picker-validate-btn:hover {
  background: var(--brand-mid-hover);
}

@media (max-width: 520px) {
  #colorPickerModal .td-color-picker {
    width: min(420px, 96vw);
  }

  #colorPickerModal .td-picker-main {
    grid-template-columns: 1fr;
  }

  #colorPickerModal .td-picker-rails {
    justify-content: center;
  }
}

/* ===========================
   LOGOUT BUTTON
   =========================== */
form[action='/logout.php'] button,
form[action='/logout'] button {
  border-color: var(--danger);
  background-color: var(--danger);
}

form[action='/logout.php'] button:hover,
form[action='/logout'] button:hover {
  background-color: var(--danger-hover);
}

a {
  color: #2f5578;
  text-decoration-thickness: 2px;
}

/* ===========================
   RESPONSIVE / MOBILE
   =========================== */
@media (max-width: 760px) {
  body.login-page {
    align-items: start;
    padding: 24px 0;
    background-position: center top;
  }

  body.login-page .shell {
    padding-top: 0;
  }

  .auth-form-panel {
    padding: 0;
  }

  .shell {
    width: min(560px, 92vw);
    padding-top: 24px;
  }

  .card {
    padding: 18px;
  }

  .brand {
    letter-spacing: 0.04em;
  }

  .app-topbar {
    height: auto;
    padding: 10px 12px;
  }

  .topbar-left {
    gap: 10px;
  }

  .nav-toggle {
    width: 38px;
    height: 38px;
  }

  .app-brand {
    letter-spacing: 0.08em;
    font-size: 0.96rem;
  }

  .app-body {
    grid-template-columns: 1fr;
  }

  .side-nav {
    display: none;
  }

  .app-layout.nav-collapsed .app-body {
    grid-template-columns: 1fr;
  }

  .app-main {
    padding: 12px;
  }

  .app-panel {
    display: grid;
  }

  .toolbar-secondary-btn,
  .user-menu {
    min-height: 38px;
    padding: 0 12px;
  }

  .user-menu {
    gap: 8px;
  }

  .user-identity strong {
    font-size: 0.82rem;
  }

  .user-identity small {
    font-size: 0.68rem;
  }

  .user-avatar {
    width: 30px;
    height: 30px;
  }

  .user-avatar svg {
    width: 18px;
    height: 18px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .function-row-form {
    grid-template-columns: 1fr;
  }

  .function-picker-grid {
    grid-template-columns: 1fr;
  }

  .create-event-grid {
    grid-template-columns: 1fr;
  }

  .event-rdv-grid {
    grid-template-columns: 1fr;
  }

  .event-field-wide,
  .event-form-actions {
    grid-column: auto;
  }

  .events-toolbar {
    grid-template-columns: 1fr;
  }

  .events-toolbar-row {
    align-items: stretch;
  }

  .events-toolbar-actions {
    justify-content: flex-start;
  }

  .events-filter-fields {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   ANIMATIONS & KEYFRAMES
   =========================== */
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   SKELETON LOADERS
   =========================== */
.sk {
  padding: 2rem;
}

.sk-l {
  height: 12px;
  background: #e8e8e8;
  border-radius: 4px;
  margin-bottom: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

.sk-p {
  margin-bottom: 2rem;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
