/* SOS DBA Tickets – client portal. Colours come from CSS variables so a theme can rebrand it. */
.sd-portal {
	--sd-ink: var(--bdm-ink, #0b2230);
	--sd-muted: var(--bdm-muted, #4a6272);
	--sd-line: var(--bdm-line, #d7e1e6);
	--sd-bg: var(--bdm-surface, #ffffff);
	--sd-soft: var(--bdm-soft, #f3f7f8);
	--sd-primary: var(--bdm-blue, #1f5fce);
	--sd-accent: var(--bdm-amber, #f2a71b);
	--sd-danger: #c0392b;
	--sd-radius: 10px;
	color: var(--sd-ink);
	font-size: 16px;
	line-height: 1.55;
}
.sd-portal *, .sd-portal *::before, .sd-portal *::after { box-sizing: border-box; }
.sd-portal h2 { margin: 0 0 .4em; line-height: 1.2; }
.sd-muted { color: var(--sd-muted); }
.sd-help { color: var(--sd-muted); font-size: .9em; margin: .35em 0 0; }

.sd-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1rem; }
.sd-head p { margin: 0; }
.sd-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.sd-btn { display: inline-block; padding: .65em 1.1em; border-radius: var(--sd-radius); border: 1px solid transparent; font-weight: 600; text-decoration: none; cursor: pointer; font: inherit; font-weight: 600; line-height: 1.2; }
.sd-btn--primary { background: var(--sd-primary); color: #fff; }
.sd-btn--primary:hover, .sd-btn--primary:focus { filter: brightness(.92); color: #fff; }
.sd-btn--danger { background: var(--sd-danger); color: #fff; }
.sd-btn--danger:hover, .sd-btn--danger:focus { filter: brightness(.92); color: #fff; }
.sd-btn--ghost { background: transparent; color: var(--sd-ink); border-color: var(--sd-line); }
.sd-btn:focus-visible { outline: 3px solid var(--sd-accent); outline-offset: 2px; }

.sd-notice { padding: .8em 1em; border-radius: var(--sd-radius); background: var(--sd-soft); border: 1px solid var(--sd-line); margin: 0 0 1rem; }
.sd-notice ul { margin: 0; padding-left: 1.2em; }
.sd-notice--ok { background: #e8f6ee; border-color: #9bd3b1; }
.sd-notice--error { background: #fdecea; border-color: #f0a9a1; }
.sd-urgent { padding: .8em 1em; border-left: 4px solid var(--sd-danger); background: #fff5f3; border-radius: 0 var(--sd-radius) var(--sd-radius) 0; margin: 0 0 1.2rem; }
.sd-urgent a { color: var(--sd-danger); font-weight: 700; }

.sd-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--sd-line); margin-bottom: 1rem; }
.sd-tabs a { padding: .55em .9em; text-decoration: none; color: var(--sd-muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.sd-tabs a.is-active { color: var(--sd-ink); border-bottom-color: var(--sd-primary); font-weight: 600; }
.sd-tabs__scope { margin-left: auto; }

.sd-table-wrap { overflow-x: auto; }
.sd-table { width: 100%; border-collapse: collapse; background: var(--sd-bg); border: 1px solid var(--sd-line); border-radius: var(--sd-radius); }
.sd-table th, .sd-table td { text-align: left; padding: .6em .75em; border-bottom: 1px solid var(--sd-line); vertical-align: top; }
.sd-table th { font-size: .85em; text-transform: uppercase; letter-spacing: .03em; color: var(--sd-muted); background: var(--sd-soft); }
.sd-table td:first-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sd-empty { padding: 2rem 1rem; text-align: center; color: var(--sd-muted); background: var(--sd-soft); border-radius: var(--sd-radius); }
.sd-pager { display: flex; gap: .4rem; margin-top: 1rem; }
.sd-pager a, .sd-pager span { padding: .3em .7em; border: 1px solid var(--sd-line); border-radius: 6px; text-decoration: none; }
.sd-pager span { background: var(--sd-ink); color: #fff; }

.sd-badge, .sd-status, .sd-tag { display: inline-block; padding: .15em .55em; border-radius: 999px; font-size: .8em; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.sd-badge--p1 { background: #c0392b; color: #fff; }
.sd-badge--p2 { background: #f2a71b; color: #1a1200; }
.sd-badge--p3 { background: #e6eefb; color: #1f5fce; }
.sd-badge--p4 { background: #eef1f3; color: #4a6272; }
.sd-status { background: #eef1f3; color: #24323b; font-weight: 600; }
.sd-status--nouveau { background: #e6eefb; color: #1f5fce; }
.sd-status--en_cours { background: #fff3da; color: #7a5200; }
.sd-status--attente_client { background: #fde8e4; color: #9b2c1f; }
.sd-status--planifie { background: #efe8fb; color: #5b3aa6; }
.sd-status--resolu { background: #e3f4ea; color: #1d6b3f; }
.sd-tag { background: var(--sd-ink); color: #fff; font-weight: 600; }

.sd-form { margin: 1rem 0; }
.sd-form fieldset { border: 1px solid var(--sd-line); border-radius: var(--sd-radius); padding: 1rem; margin: 0 0 1rem; }
.sd-form legend { font-weight: 700; padding: 0 .4em; }
.sd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .9rem 1rem; }
.sd-field { margin: 0 0 1rem; }
.sd-grid .sd-field { margin: 0; }
.sd-field--full { grid-column: 1 / -1; }
.sd-field[hidden] { display: none; }
.sd-field label { display: block; font-weight: 600; margin-bottom: .3em; }
.sd-req { color: var(--sd-danger); }
.sd-form input[type="text"], .sd-form input[type="email"], .sd-form input[type="tel"], .sd-form input[type="date"], .sd-form input[type="datetime-local"], .sd-form select, .sd-form textarea {
	width: 100%; padding: .6em .7em; border: 1px solid #b8c7cf; border-radius: 8px; background: #fff; color: var(--sd-ink); font: inherit;
}
.sd-form input:focus, .sd-form select:focus, .sd-form textarea:focus { outline: 2px solid var(--sd-primary); outline-offset: 1px; border-color: var(--sd-primary); }
.sd-p1[hidden] { display: none; }

.sd-ticket-head h2 { margin-top: .1em; }
.sd-ticket-head p { margin: .2em 0; }
.sd-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .6rem 1rem; padding: 1rem; background: var(--sd-soft); border-radius: var(--sd-radius); margin: 1rem 0; }
.sd-meta dt { font-size: .8em; text-transform: uppercase; letter-spacing: .03em; color: var(--sd-muted); }
.sd-meta dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sd-thread { list-style: none; margin: 1.5rem 0; padding: 0; }
.sd-msg { border: 1px solid var(--sd-line); border-radius: var(--sd-radius); padding: 1rem; margin: 0 0 1rem; background: var(--sd-bg); }
.sd-msg--agent { border-left: 4px solid var(--sd-primary); }
.sd-msg__head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.sd-msg__head time { color: var(--sd-muted); font-size: .9em; margin-left: auto; }
.sd-msg__body { overflow-wrap: anywhere; }
.sd-msg__body p:last-child { margin-bottom: 0; }
.sd-files { margin: .6rem 0 0; padding-left: 1.2em; font-size: .95em; }
.sd-resolve { margin-top: -.5rem; }

.sd-login { max-width: 460px; }
.sd-login form p { margin: 0 0 .9rem; }
.sd-login label { display: block; font-weight: 600; margin-bottom: .3em; }
.sd-login input[type="text"], .sd-login input[type="password"] { width: 100%; padding: .6em .7em; border: 1px solid #b8c7cf; border-radius: 8px; font: inherit; }
.sd-login .login-remember label { display: inline; font-weight: 400; }
.sd-login input[type="submit"] { background: var(--sd-primary); color: #fff; border: 0; border-radius: var(--sd-radius); padding: .7em 1.3em; font: inherit; font-weight: 600; cursor: pointer; }
.sd-login__links { font-size: .95em; }
.sd-status-page { max-width: 560px; }

@media (max-width: 640px) {
	.sd-msg__head time { margin-left: 0; width: 100%; }
	.sd-actions { width: 100%; }
	.sd-actions .sd-btn { flex: 1; text-align: center; }
}
.sd-file-error { color: var(--sd-danger); font-weight: 600; margin: .4em 0 0; }
.sd-file-error[hidden] { display: none; }

/* Legal pages */
.sd-legal h2 { font-size: 1.3rem; margin: 1.8rem 0 .5rem; }
.sd-legal h2:first-child { margin-top: 0; }
.sd-legal ul { padding-left: 1.2em; }
.sd-legal .sd-table td { font-size: .95rem; }
