<style nonce="{{ csp_nonce }}">

/* === add_site_user.html === */
.error { background: #f8d7da; color: #721c24; padding: 12px; border-radius: 4px; margin-bottom: 16px; }
    .form-group { margin-bottom: 16px; }
    .form-group label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 14px; }
    .form-group input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border, #ddd); border-radius: 6px; font-size: 16px; min-height: 48px; background: var(--bg-elevated, #fafafa); transition: border-color 0.15s, box-shadow 0.15s; box-sizing: border-box; }
    .form-group input:focus { outline: none; border-color: var(--accent, #1a1a2e); background: #fff; box-shadow: 0 0 0 3px rgba(26,26,46,0.1); }
    .form-group select { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border, #ddd); border-radius: 6px; font-size: 16px; min-height: 48px; background: var(--bg-elevated, #fafafa); transition: border-color 0.15s, box-shadow 0.15s; box-sizing: border-box; }
    .form-group select:focus { outline: none; border-color: var(--accent, #1a1a2e); background: #fff; box-shadow: 0 0 0 3px rgba(26,26,46,0.1); }
    .form-group .hint { font-size: 12px; color: var(--text-muted, #888); margin-top: 4px; }
    .form-group select option.featured { background: #e8f5e9; font-weight: 600; }
    .form-group select option { padding: 8px; }
    .template-preview { background: var(--bg-elevated, #f8f9fa); border-radius: 4px; padding: 12px; margin-top: 8px; display: none; font-size: 13px; }
    .template-preview.active { display: block; }
    .template-preview .desc { color: var(--text-muted, #666); margin-bottom: 4px; }
    .template-preview .fields { font-size: 12px; color: var(--text-muted, #888); }
    /* MOBILE */
    @media (max-width: 640px) {
        .card { padding: 16px; }
        .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
        div[style*="flex"] { flex-direction: column; }
        div[style*="flex"] > * { width: 100%; }
    }

/* === user_sites.html === */
/* ─── Page-specific styles ─── */
    .btn-danger { background: var(--danger, #dc3545); }
    .btn-danger:hover { background: #c82333; }
    .btn:disabled { opacity: 0.5; cursor: not-allowed; }
    .badge-ai { background: var(--info-bg, #f3e8ff); color: var(--info, #6b21a8); font-weight: 600; }
    .warning { background: var(--warning-bg, #fff3cd); color: #856404; padding: 12px; border-radius: 4px; margin-bottom: 16px; }
    .header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
    .usage-bar { background: var(--bg-elevated, #e9ecef); border-radius: 4px; height: 8px; overflow: hidden; margin-top: 4px; }
    .usage-bar-fill { height: 100%; background: var(--accent, #1a1a2e); border-radius: 4px; }
    .usage-bar-fill.warning { background: var(--warning, #ffc107); }
    .usage-bar-fill.danger { background: var(--danger, #dc3545); }
    .usage-row { display: flex; gap: 20px; margin-bottom: 16px; }
    .usage-item { flex: 1; }
    .usage-label { font-size: 13px; color: var(--text-muted, #666); display: flex; justify-content: space-between; }
    .actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
    .actions-row form { display: inline; }
    .token { font-family: var(--mono); background: var(--bg-elevated, #f0f0f0); padding: 2px 6px; border-radius: 3px; font-size: 12px; cursor: pointer; }
    .empty { text-align: center; padding: 24px 0; }

    /* ─── Table styles (moved from end-of-page cascade block) ─── */
    .sites-table {
        border-collapse: collapse;
        width: 100%;
        table-layout: fixed;
    }
    .sites-table th:nth-child(1), .sites-table td:nth-child(1) { width: 20%; }
    .sites-table th:nth-child(2), .sites-table td:nth-child(2) { width: 20%; }
    .sites-table th:nth-child(3), .sites-table td:nth-child(3) { width: 20%; }
    .sites-table th:nth-child(4), .sites-table td:nth-child(4) { width: 15%; }
    .sites-table th:nth-child(5), .sites-table td:nth-child(5) { width: 25%; }
    .sites-table th,
    .sites-table td {
        text-align: left;
        padding: 12px;
        border-bottom: 1px solid var(--border);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: middle;
        box-sizing: border-box;
    }
    .sites-table th {
        background: var(--bg-elevated);
        font-weight: 600;
    }
    .sites-table td .token {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
    }
    .sites-table td:last-child {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .sites-table td .action-form {
        display: inline;
    }
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    /* ─── Mobile card layout ─── */
    @media (max-width: 640px) {
        .container { padding: 8px; }
        .header-row { flex-direction: column; align-items: flex-start; gap: 12px; }
        .header-row .btn, .header-row > div { width: 100%; }
        .header-row > div { display: flex; flex-direction: column; gap: 8px; }
        .usage-row { flex-direction: column; gap: 12px; }
        .sites-table { display: block; width: 100%; }
        .sites-table thead { display: none; }
        .sites-table tbody { display: block; width: 100%; }
        .sites-table tr {
            display: block; width: 100%; padding: 12px; margin-bottom: 12px;
            background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            box-sizing: border-box;
        }
        .sites-table td {
             display: flex; width: 100%; justify-content: space-between; align-items: center;
             text-align: right; padding: 6px 0; border: none; box-sizing: border-box;
             white-space: normal; overflow: visible; text-overflow: clip;
         }
        .sites-table td:before {
            content: attr(data-label); position: static; font-weight: 600; color: var(--text-muted, #666);
            text-align: left; flex-shrink: 0; margin-right: 8px; font-size: 11px; text-transform: uppercase;
        }
        .sites-table td:last-child { justify-content: flex-end; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border, #eee); }
        .sites-table td:last-child::before { display: none; }
        .sites-table td:last-child { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
        .sites-table td:last-child .btn { flex: 1 1 auto; text-align: center; min-height: 36px; font-size: 12px; padding: 6px 8px; }
        .sites-table td:last-child .action-form { display: inline; flex: 0 0 auto; }
        .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    }
</style>
