/* =================================================================
   outsend — Design System
   Direction : utilitaire raffiné, warm, typographie technique
   ================================================================= */

/* Fonts: JetBrains Mono (titres/tech) + IBM Plex Sans (corps) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    /* Palette warm, distinctive */
    --bg: #F5F2ED;               /* fond crème chaleureux */
    --bg-card: #FFFFFF;
    --bg-soft: #EDE8DF;          /* surface secondaire */
    --bg-code: #1A1814;          /* fond bloc code/log */

    --ink: #1A1814;              /* texte primaire (presque noir, brun) */
    --ink-muted: #8F8A82;        /* texte secondaire */
    --ink-faint: #C8BFB1;        /* placeholder, helper */

    --border: #E5DFD5;
    --border-strong: #D4CCBC;

    --accent: #0D5D5C;           /* vert sapin profond, signature */
    --accent-hover: #094543;
    --accent-soft: #DEEDED;
    --accent-text: #094543;

    --danger: #A33D3D;
    --danger-soft: #F4E1E1;
    --warning: #B8852E;
    --warning-soft: #F5EBD4;
    --success: #3D6B3D;
    --success-soft: #DEEDDE;
    --info: #2E6F9E;
    --info-soft: #DDEBF5;

    /* Typography */
    --font-display: 'JetBrains Mono', ui-monospace, monospace;
    --font-body: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    /* Spacing (8pt base) */
    --r-sm: 4px;
    --r-md: 8px;
    --r-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(26, 24, 20, 0.04);
    --shadow-md: 0 4px 12px rgba(26, 24, 20, 0.06), 0 1px 3px rgba(26, 24, 20, 0.04);
    --shadow-lg: 0 10px 30px rgba(26, 24, 20, 0.08), 0 4px 8px rgba(26, 24, 20, 0.04);

    /* Transitions */
    --t-fast: 120ms cubic-bezier(0.2, 0, 0.2, 1);
    --t-med: 220ms cubic-bezier(0.2, 0, 0.2, 1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Subtle background texture (grain) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

main {
    flex: 1;
    position: relative;
    z-index: 1;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0;
}

h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 22px; line-height: 1.3; }
h3 { font-size: 18px; line-height: 1.35; }
h4 { font-size: 15px; line-height: 1.4; font-weight: 600; }

a {
    color: var(--accent-text);
    text-decoration: none;
    transition: color var(--t-fast);
}
a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

code, .mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-sm {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================================
   HEADER
   ============================================================ */

.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 18px 0;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
    background: rgba(245, 242, 237, 0.85);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.04em;
}
.brand:hover {
    text-decoration: none;
    color: var(--ink);
}
.brand-mark {
    display: inline-block;
    width: 22px;
    height: 22px;
    background: var(--accent);
    border-radius: 4px;
    position: relative;
}
.brand-mark::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: var(--bg);
    border-radius: 1px;
}
.brand-mark::before {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--accent);
    top: 8px;
    left: 8px;
    border-radius: 1px;
    z-index: 1;
}

.alpha-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--warning);
    background: var(--warning-soft);
    border: 1px solid var(--warning);
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 4px;
}

.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-links a {
    color: var(--ink-muted);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--r-md);
    transition: all var(--t-fast);
}
.nav-links a:hover {
    color: var(--ink);
    background: var(--bg-soft);
    text-decoration: none;
}
.nav-links a.active {
    color: var(--accent-text);
    background: var(--accent-soft);
}

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
    margin-top: 80px;
    padding: 32px 0;
    border-top: 1px solid var(--border);
    color: var(--ink-muted);
    font-size: 13px;
}

.site-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

/* ============================================================
   FEEDBACK BUTTON (proeminent)
   ============================================================ */

.feedback-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    background: var(--ink);
    color: var(--bg);
    border: none;
    padding: 12px 18px;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform var(--t-fast), box-shadow var(--t-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}
.feedback-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(26, 24, 20, 0.15);
}
.feedback-fab::before {
    content: '✦';
    font-size: 14px;
    color: var(--accent-soft);
}

/* ============================================================
   CARDS & SURFACES
   ============================================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 16px;
}

/* ============================================================
   FORMS
   ============================================================ */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.field-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

.field-help {
    font-size: 12px;
    color: var(--ink-muted);
}

.input, .textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--bg-card);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.4;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input.mono, .textarea.mono {
    font-family: var(--font-mono);
}
.input:focus, .textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder, .textarea::placeholder {
    color: var(--ink-faint);
}

.textarea {
    resize: vertical;
    min-height: 100px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0;
}
.checkbox-row input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}
.checkbox-row label {
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.5;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--r-md);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--t-fast);
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--ink);
    color: var(--bg);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent);
    text-decoration: none;
    color: var(--bg);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}
.btn-accent:hover:not(:disabled) {
    background: var(--accent-hover);
    text-decoration: none;
    color: #fff;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--ink);
    border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg-soft);
    text-decoration: none;
    color: var(--ink);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
    background: var(--danger);
    color: #fff;
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--ink-muted);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-soft);
    color: var(--ink);
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ============================================================
   ALERTS / MESSAGES
   ============================================================ */

.alert {
    border: 1px solid;
    border-radius: var(--r-md);
    padding: 12px 14px;
    margin: 12px 0;
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.alert-error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning); color: var(--warning); }
.alert-success { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.alert-info { background: var(--info-soft); border-color: var(--info); color: var(--info); }

/* ============================================================
   STATUS BADGES
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid;
}
.badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge-pending { background: var(--bg-soft); color: var(--ink-muted); border-color: var(--border-strong); }
.badge-running { background: var(--info-soft); color: var(--info); border-color: var(--info); animation: pulse 1.5s infinite; }
.badge-done { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.badge-failed { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.badge-cancelled { background: var(--bg-soft); color: var(--ink-muted); border-color: var(--border-strong); text-decoration: line-through; }
.badge-expired { background: var(--bg-soft); color: var(--ink-faint); border-color: var(--border); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================================
   TABLES
   ============================================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th, .table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table th {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--bg-soft);
}
.table tbody tr:hover {
    background: var(--bg-soft);
}
.table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */

.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-soft);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.progress-bar {
    height: 100%;
    background: var(--accent);
    transition: width 300ms ease;
    border-radius: 999px;
}
.progress-bar-warning { background: var(--warning); }
.progress-bar-danger { background: var(--danger); }

/* ============================================================
   LOG STREAM (job detail page)
   ============================================================ */

.log-stream {
    background: var(--bg-code);
    color: #C8C0B0;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.55;
    padding: 16px;
    border-radius: var(--r-md);
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    border: 1px solid var(--border);
}
.log-line {
    padding: 1px 0;
    word-wrap: break-word;
}
.log-time {
    color: #6B6358;
    margin-right: 8px;
    user-select: none;
}
.log-info { color: #C8C0B0; }
.log-warning { color: #E8B86E; }
.log-error { color: #E89090; }
.log-debug { color: #6B6358; }

/* ============================================================
   COMING SOON SECTIONS (sidebar)
   ============================================================ */

.coming-soon {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--r-md);
    color: var(--ink-faint);
    font-size: 13px;
    cursor: not-allowed;
    border: 1px dashed var(--border-strong);
    background: var(--bg-soft);
    margin-bottom: 6px;
}
.coming-soon-tag {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    border: 1px solid var(--border-strong);
    padding: 1px 5px;
    border-radius: 2px;
}

/* ============================================================
   STATS (admin)
   ============================================================ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px;
}
.stat-label {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
    margin-bottom: 6px;
}
.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

/* ============================================================
   MODAL (feedback)
   ============================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(26, 24, 20, 0.4);
    backdrop-filter: blur(2px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal {
    background: var(--bg-card);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================================
   UTILS
   ============================================================ */

.text-muted { color: var(--ink-muted); }
.text-faint { color: var(--ink-faint); }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 720px) {
    .container, .container-sm { padding: 0 16px; }
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }
    .card { padding: 16px; }
    .feedback-fab { padding: 10px 14px; font-size: 12px; }
    .table { font-size: 13px; }
    .table th, .table td { padding: 8px 10px; }
}
