.setup {
  max-width: 650px;
  margin: 5vh auto;
  padding: 32px;
}
.auth-logo {
  background: #1d1d1d;
  padding: 28px;
  border-radius: 12px;
  margin-bottom: 24px;
}
.auth-logo img {
  width: min(100%, 380px);
  height: auto;
  display: block;
  margin: auto;
}
.portal-login {
  max-width: 480px;
  margin: 8vh auto;
}
.portal-login .auth-logo {
  margin: -28px -28px 30px;
  padding: 40px 28px;
  border-radius: 12px 12px 0 0;
}
.portal-login h1 {
  font-size: 1.6rem;
}
.portal-login form {
  display: grid;
  gap: 18px;
}
.portal-login .check {
  display: flex;
  align-items: center;
  gap: 9px;
}
.portal-login .check input {
  width: auto;
}
.portal-main {
  padding: 32px 40px;
  max-width: 1800px;
  margin: auto;
}
.portal-nav {
  display: grid;
  gap: 8px;
  margin-top: 30px;
}
.portal-nav a {
  color: #eee;
  text-decoration: none;
  padding: 12px;
  border-radius: 9px;
}
.portal-nav a[aria-current="page"] {
  background: #ff9933;
  color: #1d1d1d;
  font-weight: bold;
}
.portal-sidebar-bottom {
  margin-top: auto;
  padding-top: 40px;
  display: grid;
  gap: 12px;
}
.portal-sidebar-bottom a {
  color: #eee;
}
.portal-sidebar-bottom button {
  font-size: 0.78rem;
}
.portal-sidebar-bottom small {
  color: #ccc;
}
.portal-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.portal-top-actions select {
  max-width: 340px;
}
.portal-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  margin-bottom: 24px;
}
.portal-heading h1 {
  margin: 5px 0 8px;
}
.portal-heading p {
  margin: 0;
  color: var(--muted);
}
.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 18px;
}
.portal-cols {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 22px;
}
.portal-list {
  display: grid;
  gap: 14px;
}
.portal-list .panel {
  margin: 0;
}
.portal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 22px;
}
.portal-toolbar label {
  flex: 1;
  min-width: 130px;
}
.portal-table {
  width: 100%;
  border-collapse: collapse;
}
.portal-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  background: #faf9f7;
  letter-spacing: 0.04em;
}
.portal-table th,
.portal-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.portal-table td small {
  display: block;
  color: var(--muted);
}
.portal-table tr:hover td {
  background: #fffaf5;
}
.portal-table a {
  font-weight: bold;
}
.portal-scroll {
  overflow-x: auto;
}
.portal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.portal-actions form {
  display: inline;
}
.portal-block {
  margin: 22px 0;
}
.portal-label {
  font-size: 0.75rem;
  color: var(--muted);
}
.portal-value {
  font-weight: bold;
  margin: 4px 0 18px;
  white-space: pre-wrap;
}
.portal-pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.portal-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  background: #fff0dd;
  color: #733900;
  white-space: nowrap;
}
.portal-chip.publiee,
.portal-chip.validee,
.portal-chip.valide,
.portal-chip.a_jour {
  background: #e9f6ed;
  color: #176647;
}
.portal-chip.correction,
.portal-chip.expire,
.portal-chip.annulee {
  background: #fdece6;
  color: #8b321c;
}
.portal-chip.a_valider,
.portal-chip.soumis,
.portal-chip.soumise {
  background: #edf2fb;
  color: #29599b;
}
.portal-chip.a_renouveler {
  background: #fff2cf;
  color: #775000;
}
.portal-file {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: 9px;
  align-items: center;
}
.portal-file a {
  overflow-wrap: anywhere;
}
.portal-muted {
  color: var(--muted);
  font-size: 0.8rem;
}
.portal-notice {
  padding: 16px;
  background: #fff2e6;
  border-left: 4px solid #ff9933;
  border-radius: 8px;
  margin: 18px 0;
}
.portal-item {
  display: grid;
  grid-template-columns: 2fr 0.6fr 1fr 2fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.portal-item label {
  font-size: 0.72rem;
}
.portal-timeline {
  padding-left: 20px;
}
.portal-timeline li {
  padding: 0 0 18px 8px;
}
.portal-timeline p {
  margin: 4px 0;
  white-space: pre-wrap;
}
.portal-error {
  color: #913d18;
  font-weight: bold;
}
.portal-ok {
  color: #176647;
}
.portal-check {
  display: flex;
  align-items: center;
  gap: 10px;
}
.portal-check input {
  width: auto;
}
.portal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  gap: 10px;
  min-width: 1040px;
}
.portal-day {
  background: #fff;
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 10px;
}
.portal-day h3 {
  font-size: 0.9rem;
}
.portal-appointment {
  display: block;
  border-left: 3px solid #ff9933;
  padding: 10px;
  background: #fff7ed;
  margin-bottom: 10px;
  color: var(--ink);
  text-decoration: none;
}
.portal-appointment small {
  display: block;
}
.portal-company-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 22px 0;
}
.portal-company-links a {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.portal-company-links a.active {
  background: var(--brand-wash);
  border-color: var(--brand);
}
#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(450px, 90vw);
  padding: 18px 24px;
  background: #1d1d1d;
  color: white;
  border-left: 5px solid #ff9933;
  border-radius: 10px;
  z-index: 150;
  box-shadow: 0 12px 35px #0003;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 15px;
  width: min(900px, 94vw);
  max-height: 90vh;
  padding: 28px;
}
dialog::backdrop {
  background: #12121299;
}
dialog pre {
  white-space: pre-wrap;
  font-size: 0.8rem;
}
dialog .portal-actions {
  margin-top: 20px;
}
.portal-footer {
  padding: 24px 40px;
  font-size: 0.7rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.portal-form-message {
  min-height: 1em;
  white-space: pre-wrap;
}
.portal-money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.portal-print-only {
  display: none;
}
@media (max-width: 900px) {
  .portal-main {
    padding: 24px;
  }
  .portal-cols {
    grid-template-columns: 1fr;
  }
  .portal-heading {
    flex-direction: column;
  }
  .portal-item {
    grid-template-columns: 1fr 1fr;
  }
  .portal-top-actions {
    flex-wrap: wrap;
  }
  .portal-top-actions select {
    max-width: 220px;
  }
}
@media (max-width: 700px) {
  .app-sidebar {
    position: static;
    width: auto;
    padding: 18px;
  }
  .app-sidebar .brand img {
    width: 200px;
  }
  .portal-nav {
    display: flex;
    flex-wrap: wrap;
    margin: 18px 0 0;
    gap: 4px;
  }
  .portal-nav a {
    padding: 8px;
    font-size: 0.78rem;
  }
  .portal-sidebar-bottom {
    display: none;
  }
  .app-topbar {
    flex-wrap: wrap;
  }
  .portal-main {
    padding: 20px 15px;
  }
  .portal-login {
    margin: 20px 15px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .portal-toolbar button {
    width: 100%;
  }
  .portal-footer {
    padding: 20px;
  }
  .portal-item {
    grid-template-columns: 1fr;
  }
  .setup {
    margin: 20px 15px;
    padding: 22px;
  }
}
.portal-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
}
.portal-nav-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}
.portal-nav a > span {
  min-width: 0;
}
.portal-role-title {
  font-family: Montserrat, "Segoe UI", sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}
.portal-tagline {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.8;
  color: #ccc;
}
.portal-login .auth-portal-title {
  font-family: Montserrat, "Segoe UI", sans-serif;
  font-size: clamp(1.15rem, 4vw, 1.4rem);
  font-weight: 600;
  letter-spacing: 0.07em;
  line-height: 1.35;
  margin: 0 0 10px;
}
.portal-login .auth-section-title {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
  margin: 0 0 22px;
}
@media print {
  .app-sidebar,
  .app-topbar,
  .portal-actions,
  .portal-footer,
  #toast,
  #modal,
  .portal-no-print,
  form {
    display: none !important;
  }
  .app-content {
    margin: 0;
  }
  .portal-main {
    padding: 0;
  }
  .panel {
    box-shadow: none;
    break-inside: avoid;
  }
  .portal-print-only {
    display: block;
  }
  .portal-cols {
    display: block;
  }
  .portal-heading {
    margin-bottom: 10px;
  }
  body {
    background: white;
  }
}

/* Authentication layout follows the Emage’In Services two-panel identity. */
.auth-split {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 46% 54%;
  background: white;
  border-left: 8px solid #ff9933;
}
.auth-brand-panel {
  background: #252122;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  gap: 24px;
  color: #fff;
}
.auth-brand-panel img {
  width: min(100%, 420px);
  height: auto;
}
.auth-brand-panel p {
  font-size: 0.72rem;
  letter-spacing: 0.13em;
  color: #eee;
}
.auth-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.auth-form-wrap {
  width: min(420px, calc(100% - 64px));
  margin: auto;
  padding: 64px 0;
}
.auth-form-wrap h1 {
  font-size: 1.8rem;
  margin: 0 0 22px;
}
.auth-form-wrap > .portal-muted {
  margin-bottom: 30px;
}
.auth-form-wrap form {
  display: grid;
  gap: 22px;
}
.auth-form-wrap form > .portal-actions {
  display: block;
}
.auth-form-wrap form button {
  width: 100%;
}
.auth-form-wrap .portal-check {
  font-size: 0.75rem;
}
.auth-form-wrap .portal-footer {
  margin-top: auto;
}
.auth-idle-note {
  font-size: 0.68rem;
}
.required-mark {
  color: #8a4200;
  font-weight: 700;
}
.portal-timeline {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 16px;
}
.portal-timeline li {
  border: 1px solid var(--line);
  border-left: 3px solid #ff9933;
  border-radius: 9px;
  padding: 18px;
  background: #fff;
}
.exchange-meta {
  display: flex;
  gap: 8px 16px;
  flex-wrap: wrap;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 0.78rem;
}
.exchange-meta time {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.portal-timeline p {
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.portal-chip.nouvelle {
  background: #e8f1ff;
  color: #174b8c;
}
.portal-chip.en_etude {
  background: #fff0d8;
  color: #754300;
}
.portal-chip.informations {
  background: #f2eafa;
  color: #63358a;
}
.portal-chip.proposition,
.portal-chip.devis_envoye {
  background: #def3f6;
  color: #12535c;
}
.portal-chip.convertie {
  background: #e2f4e8;
  color: #195c36;
}
.portal-chip.refusee {
  background: #fde8e8;
  color: #8b2323;
}
.portal-chip.sans_suite {
  background: #eee;
  color: #444;
}
@media (max-width: 760px) {
  .auth-split {
    grid-template-columns: 1fr;
  }
  .auth-brand-panel {
    padding: 32px;
    gap: 10px;
  }
  .auth-brand-panel img {
    width: 240px;
  }
  .auth-form-wrap {
    padding: 38px 0;
  }
  .exchange-meta time {
    margin-left: 0;
    width: 100%;
  }
}
