/* ═══════════════════════════════════════════
   ESPACE CLIENTS - Portal Theme
   PC + Smartphone responsive
   ═══════════════════════════════════════════ */

:root {
    color-scheme: light;
}

/* ── Base ── */
body.portal-body {
    font-family: var(--sap-font);
    color: var(--sap-text);
    background: var(--sap-bg);
}

body.portal-authenticated-body.sidebar-open {
    overflow: hidden;
}

/* ── Page Shells ── */
.portal-page-shell,
.portal-public-shell {
    display: grid;
    gap: 0.85rem;
}

/* ── Public Header ── */
.portal-public-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--sap-border);
}

.portal-public-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--sap-text);
}

.portal-public-brand:hover {
    color: var(--sap-brand-hover);
}

.portal-public-brand-mark {
    margin: 0;
}

.portal-public-brand-mark h1 {
    color: var(--sap-text);
}

.portal-public-brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.portal-public-brand-copy strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--sap-text);
}

.portal-public-brand-copy small {
    font-size: 12px;
    color: var(--sap-text-soft);
}

.portal-public-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ── Authenticated Header ── */
.portal-header-title {
    min-width: 0;
}

.portal-header-copy {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.portal-header-copy h1 {
    margin: 0;
}

.portal-header-context {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(245, 245, 243, 0.82);
}

.portal-header-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.portal-header-user {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 0.625rem;
    border-radius: var(--sap-radius);
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: var(--sap-text-inv);
    font-size: 12px;
}

/* ═══════════════════════════════════════════
   CARDS & PANELS
   ═══════════════════════════════════════════ */

.portal-card {
    margin-bottom: 0;
    padding: 0;
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.portal-hero,
.portal-panel {
    padding: 1.25rem;
}

.portal-hero {
    border-left: 4px solid var(--bleu-poudre);
    background: linear-gradient(135deg, var(--sap-surface) 0%, var(--blanc-neige) 100%);
}

.portal-hero h1,
.portal-card h1,
.portal-card h2,
.portal-card h3 {
    margin: 0;
    color: var(--sap-text);
}

.portal-hero h1 {
    font-size: 1.85rem;
    line-height: 1.15;
    font-weight: 800;
}

.portal-hero p,
.portal-card p,
.portal-card li,
.portal-muted,
.portal-muted-block {
    color: var(--sap-text-soft);
    line-height: 1.55;
}

.portal-hero p {
    max-width: 860px;
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

/* ═══════════════════════════════════════════
   LAYOUT GRIDS
   ═══════════════════════════════════════════ */

.portal-stack,
.portal-stack-tight,
.portal-list,
.portal-timeline,
.portal-metrics {
    display: grid;
    gap: 0.85rem;
}

.portal-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
}

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

.portal-detail-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.8fr);
}

/* ═══════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════ */

.portal-form {
    padding: 0;
    border: none;
    background: transparent;
    display: grid;
    gap: 0.85rem;
}

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

.portal-field {
    display: grid;
    gap: 0.35rem;
}

.portal-field-full {
    grid-column: 1 / -1;
}

.portal-field label {
    display: block;
    margin-bottom: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--sap-text);
}

.portal-field small {
    color: var(--sap-text-soft);
}

.portal-field input,
.portal-field textarea,
.portal-field select {
    width: 100%;
    height: 36px;
    min-height: 36px;
    padding: 0 0.6rem;
    font-family: var(--sap-font);
    font-size: 14px;
    color: var(--sap-text);
    border-radius: var(--sap-radius);
    border: 1px solid var(--sap-border-strong);
    background: var(--sap-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.portal-field textarea {
    height: auto;
    min-height: 100px;
    padding: 0.5rem 0.6rem;
    resize: vertical;
}

.portal-field input[type="file"] {
    padding: 0.4rem 0.5rem;
    background: var(--sap-bg);
}

.portal-field input:focus,
.portal-field textarea:focus,
.portal-field select:focus {
    outline: none;
    border-color: var(--bleu-poudre);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    background: #FAFCFF;
}

.portal-field input:hover:not(:focus),
.portal-field select:hover:not(:focus),
.portal-field textarea:hover:not(:focus) {
    border-color: var(--bleu-ciel-doux);
}

.portal-error-text {
    color: var(--sap-negative);
    font-size: 12px;
}

.attachment-dropzone {
    position: relative;
    display: block;
    cursor: pointer;
    outline: none;
}

.attachment-dropzone-panel {
    display: grid;
    justify-items: center;
    gap: 0.5rem;
    padding: 1.2rem 1rem 1.1rem;
    border-radius: 8px;
    border: 2px dashed rgba(59, 130, 246, 0.28);
    background:
        radial-gradient(circle at top, rgba(59, 130, 246, 0.08), transparent 58%),
        linear-gradient(180deg, #fcfdff 0%, #f4f8fd 100%);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.attachment-dropzone:hover .attachment-dropzone-panel,
.attachment-dropzone:focus-visible .attachment-dropzone-panel,
.attachment-dropzone.dragover .attachment-dropzone-panel {
    border-color: var(--sap-brand);
    background:
        radial-gradient(circle at top, rgba(59, 130, 246, 0.14), transparent 60%),
        linear-gradient(180deg, #ffffff 0%, #eef5ff 100%);
    box-shadow: 0 10px 22px rgba(59, 130, 246, 0.12);
    transform: translateY(-1px);
}

.attachment-dropzone-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 0.6rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.10);
    color: var(--sap-brand);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.attachment-dropzone-panel i.fa-cloud-arrow-up {
    font-size: 1.65rem;
    color: var(--sap-brand);
}

.attachment-dropzone-panel h4 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--sap-text);
}

.attachment-dropzone-panel p {
    margin: 0;
    text-align: center;
    color: var(--sap-text-soft);
}

.attachment-dropzone-count {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 0.65rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--sap-text);
    font-size: 12px;
    font-weight: 700;
}

.attachment-dropzone-list {
    display: grid;
    gap: 0.45rem;
    margin-top: 0.7rem;
}

.attachment-dropzone-empty {
    padding: 0.8rem 0.9rem;
    border-radius: var(--sap-radius);
    border: 1px dashed var(--sap-border);
    background: var(--sap-bg);
    color: var(--sap-text-soft);
    font-size: 12px;
}

.attachment-dropzone-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--sap-radius);
    border: 1px solid var(--sap-border);
    background: var(--sap-surface);
}

.attachment-dropzone-thumb {
    flex: 0 0 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--sap-radius);
    background: var(--sap-bg-header);
    color: var(--sap-brand);
}

.attachment-dropzone-meta {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 0.15rem;
}

.attachment-dropzone-meta strong {
    font-size: 13px;
    color: var(--sap-text);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.attachment-dropzone-meta span {
    font-size: 12px;
    color: var(--sap-text-soft);
}

.attachment-dropzone-remove {
    width: 32px;
    height: 32px;
    border: 1px solid var(--sap-border);
    border-radius: 999px;
    background: var(--sap-surface);
    color: var(--sap-text-soft);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.attachment-dropzone-remove:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--sap-negative);
    border-color: rgba(239, 68, 68, 0.35);
}

/* ═══════════════════════════════════════════
   BUTTONS & ACTIONS
   ═══════════════════════════════════════════ */

.portal-actions,
.portal-inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.portal-hero-actions {
    margin-top: 1rem;
}

.portal-button,
.portal-button-secondary,
.portal-button-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 36px;
    min-height: 36px;
    padding: 0 0.85rem;
    border-radius: 5px;
    border: 1px solid transparent;
    font-family: var(--sap-font);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform 80ms ease;
}

.portal-button:hover,
.portal-button-secondary:hover,
.portal-button-ghost:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.portal-button:active,
.portal-button-secondary:active,
.portal-button-ghost:active {
    transform: translateY(0);
}

.portal-button {
    background: var(--sap-brand);
    color: var(--sap-text-inv);
    border-color: var(--sap-brand);
}

.portal-button:hover {
    background: var(--sap-brand-hover);
    color: var(--sap-text-inv);
    border-color: var(--sap-brand-hover);
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.3);
}

.portal-button-secondary {
    background: var(--sap-surface);
    color: var(--sap-text);
    border-color: var(--sap-border-strong);
}

.portal-button-secondary:hover {
    background: var(--sap-hover);
    color: var(--sap-text);
    border-color: var(--sap-border-strong);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.portal-button-ghost {
    background: transparent;
    color: var(--sap-brand);
    border-color: var(--sap-brand);
}

.portal-button-ghost:hover {
    background: rgba(59, 130, 246, 0.06);
    color: var(--sap-brand-hover);
    border-color: var(--sap-brand-hover);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

.portal-button:disabled,
.portal-button-secondary:disabled,
.portal-button-ghost:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ═══════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════ */

.portal-alert {
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    font-size: 14px;
    border-radius: 5px;
    border-left: 4px solid transparent;
    border-top: 1px solid var(--sap-border);
    border-right: 1px solid var(--sap-border);
    border-bottom: 1px solid var(--sap-border);
    box-shadow: none;
}

.portal-alert-success {
    background: rgba(22, 163, 74, 0.06);
    color: #15803D;
    border-left-color: var(--sap-positive);
}

.portal-alert-error {
    background: rgba(220, 38, 38, 0.06);
    color: #B91C1C;
    border-left-color: var(--sap-negative);
}

.portal-alert-info {
    background: rgba(59, 130, 246, 0.06);
    color: var(--bleu-marine-doux);
    border-left-color: var(--sap-informative);
}

.portal-alert-list {
    margin: 0.5rem 0 0;
    padding-left: 1rem;
}

.portal-alert-list li + li {
    margin-top: 0.25rem;
}

.portal-note-list {
    margin: 0;
    padding-left: 1.15rem;
}

.portal-note-list li + li {
    margin-top: 0.4rem;
}

/* ═══════════════════════════════════════════
   METRICS
   ═══════════════════════════════════════════ */

.portal-metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.portal-metric {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 120px;
    padding: 1rem 1.1rem;
    border: 1px solid var(--sap-border);
    border-left: 4px solid var(--bleu-poudre);
    border-radius: 6px;
    background: linear-gradient(135deg, var(--blanc-pur) 0%, var(--blanc-neige) 100%);
    transition: border-left-color var(--transition), box-shadow var(--transition), transform 80ms ease;
}

.portal-metric:hover {
    box-shadow: var(--sap-shadow);
    transform: translateY(-1px);
}

.portal-metric:nth-child(1) { border-left-color: var(--vivid-purple, #7C3AED); }
.portal-metric:nth-child(2) { border-left-color: var(--vivid-orange, #EA580C); }
.portal-metric:nth-child(3) { border-left-color: var(--vivid-teal, #0D9488); }
.portal-metric:nth-child(4) { border-left-color: var(--vivid-green, #16A34A); }

.portal-metric-label,
.portal-kv-label {
    display: block;
    color: var(--sap-text-soft);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.portal-metric-value {
    color: var(--sap-text);
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.1;
}

.portal-metric-note {
    color: var(--sap-text-soft);
    font-size: 12px;
    line-height: 1.4;
}

/* ═══════════════════════════════════════════
   SECTIONS
   ═══════════════════════════════════════════ */

.portal-section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--sap-border);
}

.portal-section-header h2,
.portal-section-header h3,
.portal-section-header p {
    margin: 0;
}

.portal-subtitle,
.portal-list-meta,
.portal-timeline-meta {
    color: var(--sap-text-soft);
    font-size: 12px;
}

/* ═══════════════════════════════════════════
   KEY-VALUE GRID
   ═══════════════════════════════════════════ */

.portal-kv {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-kv-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--sap-border);
    border-radius: 5px;
    background: var(--blanc-neige);
}

.portal-kv-item-full {
    grid-column: 1 / -1;
}

.portal-kv-value {
    color: var(--sap-text);
    font-size: 14px;
    font-weight: 600;
}

/* ═══════════════════════════════════════════
   STATUS & BADGES
   ═══════════════════════════════════════════ */

.portal-status,
.portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 26px;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.portal-status-active,
.portal-badge-success,
.portal-status-closed {
    background: rgba(22, 163, 74, 0.10);
    color: #15803D;
}

.portal-status-approved,
.portal-badge-warning,
.portal-status-warning {
    background: rgba(234, 88, 12, 0.10);
    color: #C2410C;
}

.portal-status-progress,
.portal-badge-info,
.portal-status-other {
    background: rgba(59, 130, 246, 0.10);
    color: var(--bleu-marine-doux);
}

.portal-badge-neutral {
    background: var(--sap-bg-header);
    color: var(--sap-text-soft);
}

.portal-badge-danger {
    background: rgba(220, 38, 38, 0.10);
    color: #B91C1C;
}

.portal-code {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 0.5rem;
    border-radius: var(--sap-radius);
    background: var(--sap-bg-header);
    border: 1px solid var(--sap-border);
    color: var(--sap-text);
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
}

/* ═══════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════ */

.portal-table-wrap {
    overflow-x: auto;
    border-radius: 5px;
    -webkit-overflow-scrolling: touch;
}

.portal-table {
    width: 100%;
    min-width: 720px;
    margin-top: 0;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 13px;
}

.portal-table th {
    padding: 8px 10px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--sap-text);
    background: var(--sap-bg-header);
    border-bottom: 2px solid var(--sap-border-strong);
    white-space: nowrap;
}

.portal-table td {
    padding: 8px 10px;
    vertical-align: top;
    border-bottom: 1px solid var(--sap-border);
    background: var(--sap-surface);
}

.portal-table tbody tr:nth-child(even) td {
    background: var(--blanc-neige);
}

.portal-table tbody tr:hover td {
    background: var(--sap-selected);
}

/* ═══════════════════════════════════════════
   LIST ITEMS & EMPTY STATE
   ═══════════════════════════════════════════ */

.portal-empty {
    padding: 1rem 1.15rem;
    border: 1px dashed var(--sap-border-strong);
    border-radius: 5px;
    background: var(--sap-bg);
    color: var(--sap-text-soft);
    text-align: center;
    font-size: 13.5px;
}

.portal-list-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.95rem 1rem;
    border: 1px solid var(--sap-border);
    border-radius: 6px;
    background: var(--blanc-neige);
    transition: box-shadow var(--transition), border-color var(--transition);
}

.portal-list-item:hover {
    border-color: var(--sap-border-strong);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.portal-list-item h3 {
    margin: 0;
    font-size: 15px;
}

/* ═══════════════════════════════════════════
   TIMELINE
   ═══════════════════════════════════════════ */

.portal-timeline-item {
    padding: 0.95rem 1rem;
    border: 1px solid var(--sap-border);
    border-left: 4px solid var(--bleu-poudre);
    border-radius: 6px;
    background: var(--blanc-neige);
}

.portal-timeline-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.portal-timeline-title strong {
    color: var(--sap-text);
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */

.portal-footer {
    margin-top: 0;
    padding: 1rem 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--sap-text-soft);
}

/* ═══════════════════════════════════════════
   SIDEBAR OVERRIDES
   ═══════════════════════════════════════════ */

.portal-sidebar-account {
    padding: 0.75rem 1rem 0.5rem;
    border-bottom: 1px solid var(--sap-border);
}

.portal-sidebar-account-label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--sap-text-soft);
}

.portal-sidebar-account strong {
    display: block;
    color: var(--sap-text);
    font-size: 12px;
    word-break: break-word;
}

.portal-sidebar-submit {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
}

.portal-sidebar-submit:hover {
    transform: none;
}

.sidebar-footer form {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

/* ═══════════════════════════════════════════
   PORTAL APP LAYOUT OVERRIDE
   On espace-clients, the container can use more space
   ═══════════════════════════════════════════ */

.portal-app-layout .app-content .container {
    width: calc(100% - 1.5rem);
    max-width: none;
}

/* ═══════════════════════════════════════════
   RESPONSIVE - PC + Smartphone
   ═══════════════════════════════════════════ */

/* Tablet landscape and below */
@media (max-width: 1200px) {
    .portal-header-meta {
        display: none;
    }
}

/* Tablet */
@media (max-width: 920px) {
    .portal-grid,
    .portal-grid-equal,
    .portal-detail-grid,
    .portal-form-grid,
    .portal-kv {
        grid-template-columns: 1fr;
    }

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

/* Mobile landscape / large phones */
@media (max-width: 768px) {
    .portal-public-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }

    .portal-public-nav {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    .portal-public-nav .btn {
        flex: unset;
        width: 100%;
        font-size: 12px;
        padding: 0 0.4rem;
        height: 34px;
        justify-content: center;
    }

    .portal-hero h1 {
        font-size: 1.5rem;
    }

    .portal-hero p {
        font-size: 0.88rem;
    }

    .portal-table {
        min-width: 0;
        font-size: 12px;
    }

    .portal-table th,
    .portal-table td {
        padding: 6px 7px;
    }

    /* Table cards on mobile */
    .portal-table,
    .portal-table thead,
    .portal-table tbody,
    .portal-table th,
    .portal-table td,
    .portal-table tr {
        display: block;
    }

    .portal-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .portal-table tbody tr {
        margin-bottom: 0.5rem;
        border: 1px solid var(--sap-border);
        border-radius: 6px;
        overflow: hidden;
    }

    .portal-table td {
        position: relative;
        padding: 8px 10px 8px 45%;
        text-align: right;
        border-bottom: 1px solid var(--sap-border);
        min-height: 36px;
    }

    .portal-table td:last-child {
        border-bottom: none;
    }

    .portal-table td::before {
        content: attr(data-label);
        position: absolute;
        top: 8px;
        left: 10px;
        width: 40%;
        text-align: left;
        font-size: 11px;
        font-weight: 700;
        color: var(--sap-text-soft);
    }

    .portal-section-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .portal-list-item {
        padding: 0.85rem;
    }

    .portal-kv-item {
        padding: 0.75rem;
    }
}

/* Mobile portrait / small phones */
@media (max-width: 576px) {
    .portal-page-shell,
    .portal-public-shell {
        gap: 0.5rem;
    }

    .portal-hero,
    .portal-panel {
        padding: 0.85rem;
    }

    .portal-hero h1 {
        font-size: 1.3rem;
    }

    .portal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .portal-button,
    .portal-button-secondary,
    .portal-button-ghost {
        width: 100%;
        height: 40px;
        font-size: 14px;
    }

    .portal-metrics-grid {
        grid-template-columns: 1fr;
    }

    .portal-metric {
        min-height: 90px;
        padding: 0.75rem 0.85rem;
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
    }

    .portal-metric-value {
        font-size: 1.5rem;
        min-width: 40px;
    }

    .portal-metric-label {
        font-size: 11px;
    }

    .portal-metric-note {
        display: none;
    }

    .portal-public-nav {
        grid-template-columns: 1fr;
    }

    .portal-field input,
    .portal-field textarea,
    .portal-field select {
        height: 40px;
        min-height: 40px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .portal-field textarea {
        height: auto;
        min-height: 100px;
    }

    .portal-timeline-title {
        flex-direction: column;
        gap: 0.3rem;
    }

    .portal-list-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .portal-kv {
        grid-template-columns: 1fr;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    .portal-hero h1 {
        font-size: 1.15rem;
    }

    .portal-button,
    .portal-button-secondary,
    .portal-button-ghost {
        height: 42px;
        font-size: 13.5px;
    }

    .portal-status,
    .portal-badge {
        font-size: 10px;
        padding: 0.1rem 0.4rem;
        min-height: 22px;
    }
}

/* ═══════════════════════════════════════════
   DESKTOP ENHANCEMENTS
   ═══════════════════════════════════════════ */

@media (min-width: 1400px) {
    .portal-hero {
        padding: 1.5rem 1.75rem;
    }

    .portal-hero h1 {
        font-size: 2.1rem;
    }

    .portal-panel {
        padding: 1.35rem 1.5rem;
    }

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