:root {
    --bg: #1c1e23;
    --bg-soft: #23262d;
    --panel: #2b2f37;
    --panel-hover: #343945;
    --text: #f4f6fb;
    --muted: #b7bfcc;
    --line: rgba(255, 255, 255, 0.08);
    --accent: #c026d3;
    --accent-2: #7c3aed;
    --accent-soft: rgba(192, 38, 211, 0.18);
    --danger: #b42318;
    --danger-hover: #8d1d14;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(192, 38, 211, 0.14), transparent 22%),
        radial-gradient(circle at top center, rgba(124, 58, 237, 0.12), transparent 18%),
        linear-gradient(180deg, #1b1d22 0%, #1c1e23 100%);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 18px 18px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 22px 24px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
        linear-gradient(135deg, #20232a, #17191d);
    box-shadow: var(--shadow);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    height: 62px;
    padding: 0 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 8px 18px rgba(124, 58, 237, 0.28);
}

.brand-logo {
    height: 56px;
    width: auto;
    display: block;
    object-fit: contain;
}

.app-brand h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.app-brand p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.app-brand-text p {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.app-user {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.app-user span {
    font-weight: 600;
    color: #fff;
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #c0392b, var(--danger));
    border: 1px solid rgba(255,255,255,0.06);
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.logout-btn:hover {
    background: linear-gradient(135deg, #a93226, var(--danger-hover));
    transform: translateY(-1px);
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    text-decoration: none;
    font-weight: 600;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    transition: all 0.18s ease;
}

.main-nav a:hover {
    background: var(--panel-hover);
    border-color: rgba(192, 38, 211, 0.35);
    transform: translateY(-1px);
}

.main-nav-wrapper {
    margin-bottom: 28px;
}

.mobile-nav-toggle {
    display: none;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    transition: all 0.18s ease;
}

.mobile-nav-toggle:hover {
    background: var(--panel-hover);
    border-color: rgba(192, 38, 211, 0.35);
}

.page-content {
    min-height: 60vh;
}

.page-intro {
    margin-bottom: 18px;
}

.page-intro-row {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    flex-wrap: wrap;
}

.page-intro h2 {
    margin: 0 0 8px;
    font-size: 1.75rem;
    font-weight: 800;
}

.page-intro p {
    margin: 0;
    color: var(--muted);
    font-size: 0.98rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.92rem;
}

.back-link:hover {
    color: #fff;
}

.content-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.015));
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.toolbar {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1 1 auto;
    min-width: 260px;
}

.search-box input,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.04);
    color: #fff;
    font-size: 0.96rem;
    outline: none;
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
    color: #9ea7b6;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(192, 38, 211, 0.55);
    box-shadow: 0 0 0 3px rgba(192, 38, 211, 0.14);
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s ease;
}

.btn-small {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.9rem;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.22);
}

.btn-primary:hover {
    transform: translateY(-1px);
    opacity: 0.96;
}

.btn-secondary {
    color: #fff;
    background: var(--panel);
    border-color: var(--line);
}

.btn-secondary:hover {
    background: var(--panel-hover);
    border-color: rgba(192, 38, 211, 0.35);
}

.btn-ghost {
    color: var(--muted);
    background: transparent;
    border-color: var(--line);
}

.btn-ghost:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}

.btn-danger {
    background: linear-gradient(135deg, #c0392b, #8d1d14);
    color: white;
}

.btn-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--panel);
    border-color: var(--line);
    color: var(--muted);
}

.btn-block {
    width: 100%;
}

.list-section {
    margin-top: 4px;
}

.structure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.item-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 220px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.018));
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.item-card-body {
    padding: 20px;
}

.item-card-top h3 {
    margin: 0 0 16px;
    font-size: 1.2rem;
}

.item-title {
    color: #fff;
    text-decoration: none;
}

.item-title:hover {
    color: #f3d9ff;
}

.item-meta {
    display: grid;
    gap: 12px;
}

.item-meta > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.item-card-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 20px 20px;
    border-top: 1px solid var(--line);
}

.empty-state {
    text-align: center;
    padding: 36px 20px;
}

.empty-state h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.empty-state p {
    margin-top: 0;
    margin-bottom: 18px;
    color: var(--muted);
}

.empty-state-inline {
    padding: 18px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    color: var(--muted);
    text-align: center;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: 0.18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(192,38,211,0.35);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
}

.stat-value-small {
    font-size: 1.05rem;
    font-weight: 800;
    color: #fff;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--muted);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 18px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-item-full {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--muted);
}

.notes-box {
    padding: 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    line-height: 1.75;
}

.notes-empty {
    font-style: italic;
    color: var(--muted);
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.record-meta {
    font-size: 0.85rem;
    opacity: 0.75;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 16px;
}

.section-header h3 {
    margin: 0;
}

.mini-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mini-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    transition: 0.18s ease;
}

.mini-list-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(192,38,211,0.35);
}

.mini-list-meta {
    color: var(--muted);
    font-size: 0.92rem;
}

.empty-inline {
    color: var(--muted);
    font-style: italic;
    padding: 12px 0;
}

.form-card {
    max-width: 820px;
}

.styled-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
}

.required {
    color: #f87171;
    margin-left: 4px;
}

.help-text {
    color: var(--muted);
    font-size: 0.85rem;
}

.field-error {
    color: #f87171;
    font-size: 0.85rem;
    font-weight: 600;
}

.form-global-errors {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.22);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    margin-top: 12px;
}

.styled-form input,
.styled-form select,
.styled-form textarea {
    width: 100%;
}

.styled-form textarea {
    min-height: 110px;
}

.danger-card {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding: 34px 28px;
}

.danger-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border-radius: 18px;
    background: rgba(220, 38, 38, 0.12);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.22);
}

.danger-card h3 {
    margin: 0 0 16px;
    font-size: 1.4rem;
}

.danger-text {
    font-size: 1rem;
    margin-bottom: 10px;
}

.danger-subtext {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 24px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.filter-group {
    min-width: 180px;
}

.filter-card {
    padding: 18px 20px;
}

.demarche-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.demarche-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.018));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: 0.18s ease;
}

.demarche-card:hover {
    transform: translateY(-1px);
    border-color: rgba(192,38,211,0.30);
}

.demarche-main {
    flex: 1;
}

.demarche-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.demarche-header h3 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 800;
}

.demarche-header a {
    color: #fff;
}

.demarche-header a:hover {
    color: #f3d9ff;
}

.demarche-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.88rem;
}

.status-badge {
    display: inline-flex;
    width: fit-content;
    align-self: flex-start;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.status-open {
    background: rgba(59,130,246,0.16);
    color: #93c5fd;
}

.status-late {
    background: rgba(239,68,68,0.16);
    color: #fca5a5;
}

.status-closed {
    background: rgba(34,197,94,0.16);
    color: #86efac;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}

.timeline-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.03);
    transition: 0.18s ease;
    text-decoration: none;
}

.timeline-item:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(192,38,211,0.35);
    transform: translateY(-1px);
}

.timeline-dot {
    width: 12px;
    height: 12px;
    margin-top: 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    flex-shrink: 0;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeline-title {
    font-weight: 700;
    color: #fff;
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--muted);
}

.devis-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.devis-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.018));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    transition: 0.18s ease;
}

.devis-card:hover {
    transform: translateY(-1px);
    border-color: rgba(192,38,211,0.30);
}

.devis-main {
    flex: 1;
}

.devis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.devis-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.devis-header a {
    color: #fff;
}

.devis-header a:hover {
    color: #f3d9ff;
}

.devis-date {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.devis-objet {
    margin-bottom: 8px;
    color: #e6e9ef;
}

.devis-meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.dashboard-hero {
    margin-bottom: 24px;
}

.dashboard-company {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(192,38,211,0.12), rgba(59,130,246,0.08));
    border: 1px solid rgba(255,255,255,0.06);
}

.dashboard-logo {
    width: 84px;
    height: 84px;
    object-fit: contain;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    padding: 10px;
}

.dashboard-company h1 {
    margin: 0 0 6px;
    font-size: 2rem;
    font-weight: 800;
}

.dashboard-company p {
    margin: 0;
    color: var(--muted);
}

.dashboard-company-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.dashboard-company-main {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.dashboard-settings-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.05);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.dashboard-settings-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(192,38,211,0.35);
    transform: translateY(-1px);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
}

.quick-actions {
    display: grid;
    gap: 12px;
}

.quick-action-card {
    display: block;
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--line);
    transition: 0.18s ease;
}

.quick-action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(192,38,211,0.45);
    box-shadow: 0 8px 24px rgba(192,38,211,0.15);
}

.quick-action-title {
    display: block;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.quick-action-sub {
    font-size: 0.9rem;
    color: var(--muted);
}

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    padding: 32px;
    border-radius: 24px;
    background: rgba(17,24,39,0.92);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, #c026d3, #7c3aed);
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
}

.auth-header h2 {
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--muted);
}

.auth-logo {
    width: 220px;
    max-width: 100%;
    height: auto;
    margin: 0 auto 24px;
    display: block;
    object-fit: contain;
}

.auth-actions {
    margin-top: 24px;
}

.form-errors {
    margin-bottom: 18px;
}

.form-error {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(220,38,38,0.12);
    border: 1px solid rgba(220,38,38,0.35);
    color: #fca5a5;
    font-size: 0.95rem;
}

.user-dropdown {
    position: relative;
}

.user-dropdown::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 10px;
}

.user-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.user-dropdown-toggle:hover {
    background: var(--panel-hover);
    border-color: rgba(192, 38, 211, 0.35);
}

.chevron {
    font-size: 0.85rem;
    color: var(--muted);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    margin-top: 6px;
    padding: 10px;
    border-radius: 14px;
    background: #111827;
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px rgba(0,0,0,0.28);
    display: none;
    z-index: 1200;
}

.user-dropdown:hover .user-dropdown-menu,
.user-dropdown:focus-within .user-dropdown-menu {
    display: block;
}

.user-dropdown-menu a,
.user-dropdown-logout {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: none;
    background: transparent;
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease;
}

.user-dropdown-menu a:hover,
.user-dropdown-logout:hover {
    background: rgba(255,255,255,0.05);
}

.user-dropdown-menu form {
    margin: 0;
    padding: 0;
}

.app-footer {
    margin-top: 44px;
    padding: 20px 10px 14px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-user {
        width: 100%;
        justify-content: space-between;
    }

    .user-dropdown {
        width: 100%;
    }

    .user-dropdown-toggle {
        width: 100%;
        justify-content: space-between;
    }

    .user-dropdown-menu {
        left: 0;
        right: auto;
        width: 100%;
        min-width: unset;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-company {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-company-row {
        align-items: flex-start;
    }

    .dashboard-settings-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .demarche-card,
    .devis-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .demarche-actions,
    .devis-actions {
        width: 100%;
    }

    .demarche-actions .btn,
    .devis-actions .btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 14px 12px 12px;
    }

    .app-brand h1 {
        font-size: 1.6rem;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        margin-bottom: 12px;
    }

    .main-nav {
        display: none;
        flex-direction: column;
        gap: 10px;
        margin-bottom: 0;
    }

    .main-nav.is-open {
        display: flex;
    }

    .main-nav a {
        width: 100%;
        justify-content: flex-start;
    }

    .page-intro-row {
        align-items: stretch;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 10px;
    }

    .toolbar-actions {
        width: 100%;
        margin-top: 0;
    }

    .toolbar-actions .btn {
        flex: 1 1 auto;
    }

    .filter-card {
        padding: 12px 14px;
    }

    .filter-card .search-box {
        flex: none;
        min-width: 0;
        width: 100%;
    }

    .filter-card .toolbar {
        gap: 10px;
        justify-content: flex-start;
    }

    .filter-card .search-box input,
    .filter-card .filter-group select,
    .filter-card .toolbar .btn {
        min-height: 40px;
    }

    .filter-card .toolbar-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
        margin-top: 0;
        align-self: stretch;
    }

    .filter-card .toolbar-actions .btn {
        width: 100%;
    }
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    background-color: rgba(255,255,255,0.04);
    color: #fff;
}

select option {
    background-color: #1f2430;
    color: #ffffff;
}

select option:checked,
select option:hover {
    background-color: #7c3aed;
    color: #ffffff;
}

.messages-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
}

.message-alert {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    font-weight: 600;
    box-shadow: var(--shadow);
}

.message-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.28);
    color: #dcfce7;
}

.message-error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.28);
    color: #fecaca;
}

.message-warning {
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.28);
    color: #fde68a;
}

.message-info {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.28);
    color: #dbeafe;
}

.mail-history-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mail-history-item {
    padding: 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--line);
    border-left: 3px solid rgba(192,38,211,0.55);
    transition: 0.18s ease;
}

.mail-history-item:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(192,38,211,0.35);
}

.mail-history-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.mail-history-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.mail-history-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.mail-body-preview {
    max-height: 180px;
    overflow: auto;
    padding: 14px;
    border-radius: 12px;
    background: rgba(0,0,0,0.16);
    border: 1px solid rgba(255,255,255,0.05);
    line-height: 1.7;
    color: #f4f6fb;
}

@media (max-width: 768px) {
    .mail-history-header {
        flex-direction: column;
    }

    .mail-history-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .mail-history-actions .btn {
        flex: 1 1 auto;
    }
}

