:root {
  --navy: #082b68;
  --blue: #0074c8;
  --cyan: #00a8df;
  --coral: #ff5b67;
  --green: #15936b;
  --amber: #d98718;
  --ink: #10213d;
  --muted: #627084;
  --line: #dce5ef;
  --page: #f4f7fb;
  --panel: #ffffff;
  --soft: 0 14px 38px rgba(8, 43, 104, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 30;
}

.brand-block,
.side-user,
.topbar,
.topbar-actions,
.metric-card,
.inline-actions,
.row-actions,
.form-actions,
.section-heading,
.ticket-message-meta {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
  padding: 4px 2px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark,
.avatar {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue) 58%, var(--cyan));
  font-weight: 800;
  font-size: 13px;
}

.brand-kicker,
.tiny-label,
.page-kicker,
.card-kicker {
  margin: 0;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0;
}

.brand-title {
  margin: 2px 0 0;
  color: var(--ink);
  font-weight: 800;
}

.side-nav {
  display: grid;
  gap: 7px;
}

.side-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #46566d;
  font-weight: 700;
  font-size: 14px;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.side-link i {
  width: 18px;
  color: var(--blue);
}

.side-link:hover,
.side-link.is-active {
  background: #edf7ff;
  border-color: #cce8fb;
  color: var(--navy);
  transform: translateX(2px);
}

.side-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.side-user {
  gap: 10px;
}

.avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--coral), var(--amber));
}

.side-user-name,
.side-user-role {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-user-name {
  max-width: 170px;
  font-weight: 800;
  font-size: 13px;
}

.side-user-role {
  color: var(--muted);
  font-size: 12px;
}

.app-main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  min-height: 76px;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(244, 247, 251, 0.88);
  backdrop-filter: blur(16px);
  z-index: 20;
  border-bottom: 1px solid rgba(220, 229, 239, 0.82);
}

.topbar h1 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.2;
}

.topbar-actions {
  gap: 10px;
}

.client-link,
.button,
.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.button:hover,
.icon-button:hover,
.client-link:hover {
  transform: translateY(-1px);
  border-color: #b9dff8;
  box-shadow: var(--soft);
}

.icon-button {
  width: 40px;
  padding: 0;
}

.icon-button-small {
  min-height: 30px;
  width: 30px;
}

.button-primary {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
  border-color: transparent;
}

.button-danger {
  background: #fff2f3;
  color: #b8323b;
  border-color: #ffd3d8;
}

.button-muted {
  background: #f7fafc;
  color: #55657a;
}

.content-wrap {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 26px 28px 42px;
}

.flash {
  margin: 16px 28px 0;
  min-height: 48px;
  padding: 9px 12px 9px 16px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.flash-success {
  background: #eaf8f2;
  color: #116849;
  border: 1px solid #bfe8d7;
}

.flash-danger {
  background: #fff1f2;
  color: #a72831;
  border: 1px solid #ffc9cf;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

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

.metric-card,
.panel,
.table-panel,
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--soft);
}

.metric-card {
  min-height: 132px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--blue);
}

.metric-card:nth-child(2) .metric-icon {
  background: var(--green);
}

.metric-card:nth-child(3) .metric-icon {
  background: var(--coral);
}

.metric-card:nth-child(4) .metric-icon {
  background: var(--amber);
}

.metric-card h2,
.panel h2,
.section-heading h2 {
  margin: 4px 0 0;
  color: var(--ink);
  line-height: 1.16;
  overflow-wrap: anywhere;
}

.metric-card h2 {
  font-size: 24px;
}

.metric-card p,
.panel p,
.empty-state p,
.help-text {
  color: var(--muted);
}

.panel {
  padding: 18px;
}

.panel-header,
.table-header,
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.table-panel {
  overflow: hidden;
}

.table-header {
  padding: 18px 18px 0;
}

.table-wrap {
  overflow-x: auto;
  padding: 0 18px 18px;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0 8px;
}

th {
  color: var(--muted);
  text-align: left;
  text-transform: uppercase;
  font-size: 11px;
  padding: 0 12px 5px;
}

td {
  background: #fff;
  border-top: 1px solid #e7edf5;
  border-bottom: 1px solid #e7edf5;
  padding: 12px;
  font-size: 13px;
  vertical-align: middle;
}

td:first-child {
  border-left: 1px solid #e7edf5;
  border-radius: 8px 0 0 8px;
}

td:last-child {
  border-right: 1px solid #e7edf5;
  border-radius: 0 8px 8px 0;
}

.strong {
  color: var(--ink);
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
}

.badge-success {
  color: #116849;
  background: #e8f7f0;
}

.badge-danger {
  color: #ab3038;
  background: #fff0f1;
}

.badge-warning {
  color: #875411;
  background: #fff5dd;
}

.badge-info {
  color: #075985;
  background: #e8f6ff;
}

.badge-coral {
  color: #a83d43;
  background: #fff0ed;
}

.badge-muted {
  color: #59677b;
  background: #eef2f6;
}

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

.field {
  display: grid;
  gap: 7px;
}

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

label {
  color: #34445d;
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid #cfd9e6;
  color: var(--ink);
  background: #fff;
  padding: 10px 12px;
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 116, 200, 0.12);
}

.form-actions,
.inline-actions,
.row-actions {
  gap: 9px;
  flex-wrap: wrap;
}

.form-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.row-actions {
  justify-content: flex-end;
}

.chart-box {
  min-height: 290px;
  position: relative;
}

.chart-box canvas {
  width: 100% !important;
  height: 270px !important;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 18px;
  align-items: start;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 10px;
  color: var(--muted);
  padding: 28px;
}

.empty-state i {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #edf7ff;
  color: var(--blue);
}

.empty-state h3 {
  margin: 0;
  color: var(--ink);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 247, 255, 0.9)),
    #f7fbff;
  overflow: hidden;
}

.partner-login-page {
  position: relative;
}

.partner-login-page::before,
.partner-login-page::after {
  content: "";
  position: fixed;
  z-index: 0;
  width: 360px;
  height: 92px;
  border-radius: 8px;
  pointer-events: none;
  transform: skewY(-28deg) rotate(-26deg);
}

.partner-login-page::before {
  left: -92px;
  top: 126px;
  background: linear-gradient(135deg, rgba(0, 116, 200, 0.18), rgba(0, 168, 223, 0.1));
}

.partner-login-page::after {
  right: -118px;
  bottom: 132px;
  background: linear-gradient(135deg, rgba(255, 91, 103, 0.13), rgba(21, 147, 107, 0.12));
}

.partner-login {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  display: grid;
  justify-items: center;
  gap: 24px;
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.login-brand img {
  width: min(330px, 74vw);
  height: auto;
  display: block;
}

.login-brand span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid #d5eaff;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-hero {
  text-align: center;
  width: min(620px, 100%);
}

.login-hero h1 {
  margin: 8px 0 10px;
  color: #202b3d;
  font-size: clamp(38px, 7vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.login-hero p:not(.card-kicker) {
  margin: 0 auto;
  max-width: 560px;
  color: #637083;
  font-weight: 600;
  line-height: 1.58;
}

.login-panel {
  width: min(548px, 100%);
  position: relative;
  padding: 34px 38px 28px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(213, 226, 240, 0.9);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(8, 43, 104, 0.13);
}

.login-panel::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 250px;
  height: 64px;
  right: -104px;
  top: 58px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(0, 116, 200, 0.82), rgba(0, 168, 223, 0.76));
  transform: skewY(-28deg) rotate(-26deg);
}

.login-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.login-panel h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
}

.login-error {
  margin: 0 0 18px;
}

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

.login-form .field {
  gap: 9px;
}

.login-input {
  min-height: 58px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  border: 1px solid #cdd8e5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(16, 33, 61, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 116, 200, 0.12), 0 14px 28px rgba(8, 43, 104, 0.1);
}

.login-input i {
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #34445d;
  border-right: 1px solid #dce5ef;
}

.login-input input {
  min-height: 56px;
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0 18px;
  font-size: 16px;
  font-weight: 700;
}

.login-input input:focus {
  box-shadow: none;
}

.login-input input::placeholder {
  color: #a0aabc;
}

.login-submit {
  min-height: 60px;
  width: min(380px, 100%);
  margin: 8px auto 0;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--navy), var(--blue) 60%, var(--cyan));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 18px 30px rgba(0, 116, 200, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.login-submit:hover,
.login-submit:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 22px 36px rgba(0, 116, 200, 0.29);
}

.login-footnote {
  margin: 22px 0 0;
  color: #6a7789;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.login-feature-row {
  width: min(820px, 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.login-feature-row div {
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid #dde8f3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: #314057;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(8, 43, 104, 0.06);
}

.login-feature-row i {
  color: var(--blue);
}

.callout {
  border: 1px solid #cde9fb;
  background: #eef8ff;
  color: #11456d;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
}

.ticket-message {
  border: 1px solid #e3ebf4;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.ticket-message + .ticket-message {
  margin-top: 10px;
}

.ticket-message-meta {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.ticket-message p {
  white-space: pre-wrap;
  margin: 0;
  color: #26364f;
  line-height: 1.55;
}

.profile-hero {
  min-height: 240px;
  display: grid;
  align-items: end;
  overflow: hidden;
  position: relative;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, #082b68, #0074c8 58%, #00a8df);
  color: #fff;
}

.profile-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--profile-cover, none);
  background-size: cover;
  background-position: center;
  opacity: 0.28;
}

.profile-hero-content {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  z-index: 1;
}

.profile-photo {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  border: 3px solid rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-size: 34px;
  font-weight: 900;
}

.profile-photo img,
.portfolio-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-hero h2,
.profile-hero p {
  color: #fff;
}

.profile-hero h2 {
  margin: 0 0 4px;
}

.profile-hero p {
  margin: 0;
  opacity: 0.88;
}

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

.portfolio-card {
  overflow: hidden;
  border: 1px solid #e3ebf4;
  border-radius: 8px;
  background: #fff;
}

.portfolio-image {
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  background: #edf7ff;
  color: var(--blue);
  font-size: 24px;
}

.portfolio-body {
  padding: 14px;
}

.portfolio-body p {
  margin: 8px 0 0;
}

.conversation-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.message-thread {
  display: grid;
  gap: 10px;
}

.message-bubble {
  max-width: min(760px, 100%);
  border: 1px solid #e3ebf4;
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.message-bubble.is-mine {
  margin-left: auto;
  background: #edf7ff;
  border-color: #cce8fb;
}

.message-bubble p {
  margin: 8px 0 0;
  white-space: pre-wrap;
  color: #26364f;
  line-height: 1.55;
}

.copy-button.copied::after {
  content: " Copié";
}

.mobile-only {
  display: none;
}

.mobile-backdrop {
  display: none;
}

@media (max-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split,
  .login-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .login-page {
    padding: 18px;
    overflow-y: auto;
  }

  .partner-login {
    gap: 18px;
  }

  .partner-login-page::before,
  .partner-login-page::after {
    opacity: 0.48;
  }

  .login-brand img {
    width: min(270px, 82vw);
  }

  .login-panel {
    padding: 26px 20px 22px;
  }

  .login-panel::before {
    right: -136px;
    top: 76px;
    opacity: 0.54;
  }

  .login-panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .login-input {
    grid-template-columns: 48px minmax(0, 1fr);
    min-height: 54px;
  }

  .login-input input {
    min-height: 52px;
    padding: 0 14px;
  }

  .login-feature-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    left: 12px;
    top: 12px;
    bottom: 12px;
    width: min(294px, calc(100vw - 24px));
    height: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    transform: translateX(calc(-100% - 24px));
    transition: transform 0.2s ease;
    box-shadow: 0 22px 56px rgba(8, 43, 104, 0.22);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 20, 38, 0.44);
    z-index: 25;
  }

  .mobile-only {
    display: inline-flex;
  }

  .topbar {
    padding: 12px 16px;
  }

  .client-link span {
    display: none;
  }

  .content-wrap {
    padding: 18px 16px 32px;
  }

  .flash {
    margin: 12px 16px 0;
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .portfolio-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .profile-hero-content {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-header,
  .table-header,
  .section-heading {
    flex-direction: column;
  }
}
