/* ============================================
   JWT Decoder - Stylesheet
   Matches All-WebTools design system (Slate + Orange)
   Color coding follows jwt.io convention:
     Header → red, Payload → purple, Signature → cyan
   ============================================ */

:root {
    --jwt-primary: #FF8C00;
    --jwt-primary-hover: #E67E00;
    --jwt-header-color: #ef4444;
    --jwt-payload-color: #8b5cf6;
    --jwt-signature-color: #06b6d4;
    --jwt-dark: #0f172a;
    --jwt-dark-light: #1e293b;
    --jwt-white: #ffffff;
    --jwt-gray-50: #f8fafc;
    --jwt-gray-100: #f1f5f9;
    --jwt-gray-200: #e2e8f0;
    --jwt-gray-300: #cbd5e1;
    --jwt-gray-400: #94a3b8;
    --jwt-gray-500: #64748b;
    --jwt-gray-600: #475569;
    --jwt-gray-700: #334155;
    --jwt-gray-800: #1e293b;
    --jwt-gray-900: #0f172a;
    --jwt-success: #22c55e;
    --jwt-danger: #ef4444;
    --jwt-warning: #f59e0b;
    --jwt-radius: 16px;
    --jwt-radius-sm: 8px;
    --jwt-radius-xs: 6px;
    --jwt-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --jwt-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --jwt-mono: 'SF Mono', 'JetBrains Mono', Consolas, 'Liberation Mono', monospace;
}

/* ============================================
   Main Tool Card
   ============================================ */
.tool-main-card {
    background: var(--jwt-gray-100);
    border-radius: var(--jwt-radius);
    overflow: hidden;
}

/* ============================================
   Tool Grid Layout
   ============================================ */
.jwt-tool-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    padding: 24px;
}

@media (max-width: 1024px) {
    .jwt-tool-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* ============================================
   Main Panel (Left)
   ============================================ */
.jwt-main-panel {
    background: var(--jwt-white);
    border-radius: var(--jwt-radius);
    padding: 24px;
    box-shadow: var(--jwt-shadow);
    min-width: 0;
}

/* ============================================
   JWT Input Card
   ============================================ */
.jwt-input-card {
    margin-bottom: 16px;
}

.jwt-input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--jwt-gray-700);
    margin-bottom: 10px;
}

.jwt-input-label iconify-icon {
    color: var(--jwt-primary);
    font-size: 18px;
}

.jwt-input-wrapper {
    position: relative;
    background: var(--jwt-gray-50);
    border: 2px solid var(--jwt-gray-200);
    border-radius: var(--jwt-radius-sm);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.jwt-input-wrapper:focus-within {
    border-color: var(--jwt-primary);
    background: var(--jwt-white);
    box-shadow: 0 0 0 4px rgba(255, 140, 0, 0.1);
}

.jwt-input-wrapper.error {
    border-color: var(--jwt-danger);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.jwt-input-wrapper.success {
    border-color: var(--jwt-success);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}

.jwt-textarea {
    width: 100%;
    box-sizing: border-box;
    border: none;
    background: transparent;
    padding: 16px 16px 56px;
    font-size: 13px;
    color: var(--jwt-gray-800);
    font-family: var(--jwt-mono);
    line-height: 1.6;
    word-break: break-all;
    resize: vertical;
    min-height: 110px;
    max-height: 320px;
    outline: none;
}

.jwt-textarea::placeholder {
    color: var(--jwt-gray-400);
    word-break: break-all;
}

.jwt-input-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
    pointer-events: none;
}

.jwt-input-actions .jwt-mini-btn {
    pointer-events: auto;
}

.jwt-input-meta {
    margin-top: 10px;
    min-height: 20px;
}

.jwt-input-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--jwt-gray-500);
}

.jwt-input-hint iconify-icon {
    color: var(--jwt-gray-400);
}

.jwt-input-hint.error {
    color: var(--jwt-danger);
}

.jwt-input-hint.success {
    color: var(--jwt-success);
}

/* ============================================
   Mini Buttons (shared)
   ============================================ */
.jwt-mini-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--jwt-white);
    border: 1px solid var(--jwt-gray-200);
    border-radius: var(--jwt-radius-xs);
    font-size: 13px;
    color: var(--jwt-gray-700);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-weight: 500;
    font-family: inherit;
}

.jwt-mini-btn:hover {
    background: var(--jwt-gray-50);
    border-color: var(--jwt-gray-300);
    color: var(--jwt-gray-900);
}

.jwt-mini-btn.primary {
    background: var(--jwt-primary);
    color: var(--jwt-white);
    border-color: var(--jwt-primary);
}

.jwt-mini-btn.primary:hover {
    background: var(--jwt-primary-hover);
    border-color: var(--jwt-primary-hover);
    color: var(--jwt-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(255, 140, 0, 0.25);
}

.jwt-mini-btn.danger {
    color: var(--jwt-danger);
    border-color: #fecaca;
}

.jwt-mini-btn.danger:hover {
    background: var(--jwt-danger);
    color: var(--jwt-white);
    border-color: var(--jwt-danger);
}

.jwt-mini-btn iconify-icon {
    font-size: 15px;
}

/* ============================================
   Trust Badges Row
   ============================================ */
.jwt-trust-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 0 0 20px;
    padding: 14px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #bbf7d0;
    border-radius: var(--jwt-radius-sm);
}

.jwt-trust-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: var(--jwt-radius-xs);
    backdrop-filter: blur(4px);
}

.jwt-trust-badge iconify-icon {
    font-size: 22px;
    color: var(--jwt-success);
    flex-shrink: 0;
}

.jwt-trust-badge div {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.jwt-trust-badge strong {
    font-size: 13px;
    color: #166534;
    font-weight: 700;
    line-height: 1.2;
}

.jwt-trust-badge span {
    font-size: 11px;
    color: #15803d;
    line-height: 1.3;
}

/* ============================================
   Empty State
   ============================================ */
.jwt-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    background: var(--jwt-gray-50);
    border: 2px dashed var(--jwt-gray-200);
    border-radius: var(--jwt-radius-sm);
}

.jwt-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--jwt-white);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: var(--jwt-shadow);
}

.jwt-empty-icon iconify-icon {
    font-size: 40px;
    color: var(--jwt-primary);
}

.jwt-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--jwt-gray-700);
    margin: 0 0 8px;
}

.jwt-empty-desc {
    font-size: 14px;
    color: var(--jwt-gray-500);
    margin: 0 0 24px;
}

.jwt-example-urls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.jwt-example-label {
    font-size: 12px;
    color: var(--jwt-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.jwt-example-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--jwt-white);
    border: 1px solid var(--jwt-gray-200);
    border-radius: 999px;
    font-size: 13px;
    color: var(--jwt-gray-700);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.jwt-example-chip:hover {
    background: var(--jwt-primary);
    color: var(--jwt-white);
    border-color: var(--jwt-primary);
    transform: translateY(-1px);
}

.jwt-example-chip iconify-icon {
    font-size: 14px;
}

/* ============================================
   Error State
   ============================================ */
.jwt-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: var(--jwt-radius-sm);
}

.jwt-error-state iconify-icon {
    font-size: 48px;
    color: var(--jwt-danger);
    margin-bottom: 12px;
}

.jwt-error-state h3 {
    font-size: 18px;
    color: var(--jwt-danger);
    margin: 0 0 8px;
    font-weight: 600;
}

.jwt-error-state p {
    font-size: 14px;
    color: var(--jwt-gray-600);
    margin: 0;
    max-width: 460px;
}

/* ============================================
   Results
   ============================================ */
.jwt-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Validation Bar */
.jwt-validation-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px;
    background: linear-gradient(135deg, var(--jwt-gray-50), var(--jwt-white));
    border: 1px solid var(--jwt-gray-200);
    border-radius: var(--jwt-radius-sm);
    align-items: center;
}

.jwt-validation-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--jwt-mono);
}

.jwt-validation-pill iconify-icon {
    font-size: 14px;
}

.jwt-validation-pill.valid {
    background: #dcfce7;
    color: #166534;
}

.jwt-validation-pill.invalid {
    background: #fee2e2;
    color: #991b1b;
}

.jwt-validation-pill.warning {
    background: #fef3c7;
    color: #92400e;
}

.jwt-validation-pill.info {
    background: #e0e7ff;
    color: #3730a3;
}

/* ============================================
   Three Decoded Sections (Header/Payload/Sig)
   ============================================ */
.jwt-sections {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.jwt-section-card {
    background: var(--jwt-white);
    border: 1px solid var(--jwt-gray-200);
    border-radius: var(--jwt-radius-sm);
    overflow: hidden;
    border-left: 4px solid var(--jwt-gray-300);
}

.jwt-section-card.header-section   { border-left-color: var(--jwt-header-color); }
.jwt-section-card.payload-section  { border-left-color: var(--jwt-payload-color); }
.jwt-section-card.signature-section { border-left-color: var(--jwt-signature-color); }

.jwt-section-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--jwt-gray-100);
    background: var(--jwt-gray-50);
}

.jwt-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.jwt-section-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.jwt-section-dot.header     { background: var(--jwt-header-color); }
.jwt-section-dot.payload    { background: var(--jwt-payload-color); }
.jwt-section-dot.signature  { background: var(--jwt-signature-color); }

.jwt-section-title h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--jwt-gray-900);
}

.jwt-section-tag {
    font-size: 11px;
    color: var(--jwt-gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Decoded JSON output */
.jwt-decoded {
    margin: 0;
    padding: 16px 18px;
    font-family: var(--jwt-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--jwt-gray-800);
    background: var(--jwt-white);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 360px;
    overflow-y: auto;
}

.jwt-decoded.header-section,
.header-section .jwt-decoded { color: var(--jwt-header-color); }

/* JSON syntax highlighting tokens */
.jwt-json-key     { color: #0369a1; font-weight: 500; }
.jwt-json-string  { color: #15803d; }
.jwt-json-number  { color: #c2410c; }
.jwt-json-bool    { color: #7c3aed; font-weight: 600; }
.jwt-json-null    { color: #6b7280; font-style: italic; }
.jwt-json-bracket { color: var(--jwt-gray-500); }

.header-section .jwt-decoded {
    background: linear-gradient(180deg, #fef2f2 0%, var(--jwt-white) 60%);
}
.payload-section .jwt-decoded {
    background: linear-gradient(180deg, #f5f3ff 0%, var(--jwt-white) 60%);
}
.signature-section .jwt-decoded {
    background: linear-gradient(180deg, #ecfeff 0%, var(--jwt-white) 60%);
}

.jwt-signature-raw {
    word-break: break-all;
    color: var(--jwt-signature-color);
    font-size: 12px;
}

/* Standard claims grid (parsed from payload) */
.jwt-claims-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    padding: 12px 18px 16px;
    background: var(--jwt-white);
}

.jwt-claim-pill {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 8px 12px;
    background: var(--jwt-gray-50);
    border-radius: var(--jwt-radius-xs);
    border-left: 3px solid var(--jwt-payload-color);
    font-size: 12px;
}

.jwt-claim-pill iconify-icon {
    font-size: 14px;
    color: var(--jwt-payload-color);
    margin-top: 2px;
    flex-shrink: 0;
}

.jwt-claim-info { min-width: 0; }

.jwt-claim-name {
    font-family: var(--jwt-mono);
    font-weight: 700;
    color: var(--jwt-gray-900);
    display: block;
    margin-bottom: 2px;
}

.jwt-claim-value {
    color: var(--jwt-gray-600);
    word-break: break-word;
    line-height: 1.4;
    display: block;
}

.jwt-claim-value strong {
    color: var(--jwt-gray-800);
}

.jwt-claim-pill.expired { border-left-color: var(--jwt-danger); }
.jwt-claim-pill.expired iconify-icon { color: var(--jwt-danger); }

.jwt-claim-pill.valid   { border-left-color: var(--jwt-success); }
.jwt-claim-pill.valid iconify-icon   { color: var(--jwt-success); }

.jwt-claim-pill.future  { border-left-color: var(--jwt-warning); }
.jwt-claim-pill.future iconify-icon  { color: var(--jwt-warning); }

/* ============================================
   Signature Verification Area
   ============================================ */
.jwt-verify-area {
    padding: 12px 18px 0;
    background: var(--jwt-white);
}

.jwt-verify-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--jwt-gray-700);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.jwt-verify-label iconify-icon {
    color: var(--jwt-signature-color);
    font-size: 14px;
}

.jwt-verify-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--jwt-gray-200);
    border-radius: var(--jwt-radius-xs);
    background: var(--jwt-gray-50);
    font-family: var(--jwt-mono);
    font-size: 12px;
    color: var(--jwt-gray-800);
    outline: none;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.jwt-verify-input:focus {
    border-color: var(--jwt-signature-color);
    background: var(--jwt-white);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.12);
}

.jwt-verify-input.textarea {
    min-height: 100px;
    word-break: break-all;
}

.jwt-verify-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.jwt-verify-result {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.jwt-verify-result iconify-icon { font-size: 14px; }

.jwt-verify-result.success {
    background: #dcfce7;
    color: #166534;
}

.jwt-verify-result.fail {
    background: #fee2e2;
    color: #991b1b;
}

.jwt-verify-result.pending {
    background: var(--jwt-gray-100);
    color: var(--jwt-gray-600);
}

.jwt-verify-note {
    font-size: 11px;
    color: var(--jwt-gray-500);
    margin-top: 6px;
    line-height: 1.4;
}

/* ============================================
   Side Panel
   ============================================ */
.jwt-side-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.jwt-section {
    background: var(--jwt-white);
    border-radius: var(--jwt-radius);
    padding: 18px;
    box-shadow: var(--jwt-shadow);
}

.jwt-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.jwt-section-header h3 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--jwt-gray-800);
    margin: 0;
}

.jwt-section-header h3 iconify-icon {
    color: var(--jwt-primary);
    font-size: 18px;
}

/* Algorithm list */
.jwt-algo-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.jwt-algo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--jwt-gray-50);
    border-radius: var(--jwt-radius-xs);
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.jwt-algo-item:hover {
    border-color: var(--jwt-gray-200);
}

.jwt-algo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--jwt-white);
    border-radius: 4px;
    letter-spacing: 0.05em;
    font-family: var(--jwt-mono);
}

.jwt-algo-badge.hmac   { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.jwt-algo-badge.rsa    { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.jwt-algo-badge.ecdsa  { background: linear-gradient(135deg, #06b6d4, #0e7490); }
.jwt-algo-badge.eddsa  { background: linear-gradient(135deg, #10b981, #047857); }

.jwt-algo-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.jwt-algo-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--jwt-gray-800);
}

.jwt-algo-dims {
    font-size: 11px;
    color: var(--jwt-gray-500);
}

/* History */
.jwt-history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.jwt-history-empty {
    font-size: 13px;
    color: var(--jwt-gray-400);
    text-align: center;
    padding: 16px;
    margin: 0;
    font-style: italic;
}

.jwt-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--jwt-gray-50);
    border-radius: var(--jwt-radius-xs);
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    border: 1px solid transparent;
    text-align: left;
    width: 100%;
    font-family: inherit;
}

.jwt-history-item:hover {
    background: #fff7ed;
    border-color: var(--jwt-primary);
    transform: translateX(2px);
}

.jwt-history-alg {
    flex-shrink: 0;
    padding: 4px 8px;
    background: var(--jwt-gray-900);
    color: var(--jwt-primary);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--jwt-mono);
}

.jwt-history-preview {
    flex: 1;
    min-width: 0;
    font-family: var(--jwt-mono);
    font-size: 11px;
    color: var(--jwt-gray-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jwt-history-remove {
    background: transparent;
    border: none;
    color: var(--jwt-gray-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.jwt-history-remove:hover {
    color: var(--jwt-danger);
    background: #fef2f2;
}

/* Tips */
.jwt-tips-section {
    background: linear-gradient(135deg, #1e293b, #0f172a);
}

.jwt-tips-section .jwt-section-header h3 {
    color: var(--jwt-white);
}

.jwt-tips-section .jwt-section-header h3 iconify-icon {
    color: var(--jwt-primary);
}

.jwt-tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.jwt-tips-list li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

.jwt-tips-list iconify-icon {
    color: var(--jwt-primary);
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.jwt-tips-list strong {
    color: var(--jwt-white);
}

.jwt-tips-list code {
    background: rgba(255, 140, 0, 0.18);
    color: var(--jwt-primary);
    padding: 1px 5px;
    border-radius: 3px;
    font-family: var(--jwt-mono);
    font-size: 11px;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.jwt-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--jwt-gray-900);
    color: var(--jwt-white);
    border-radius: var(--jwt-radius-sm);
    box-shadow: var(--jwt-shadow-lg);
    font-size: 14px;
    font-weight: 500;
    pointer-events: auto;
    animation: jwt-toast-in 0.3s ease-out;
    max-width: 360px;
}

.jwt-toast.success { background: var(--jwt-success); }
.jwt-toast.error   { background: var(--jwt-danger); }

.jwt-toast.fade-out {
    animation: jwt-toast-out 0.3s ease-in forwards;
}

@keyframes jwt-toast-in {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes jwt-toast-out {
    to { transform: translateY(20px); opacity: 0; }
}

/* ============================================
   Legal & Safety Section (content)
   ============================================ */
.legal-safety-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .legal-safety-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.legal-card {
    padding: 24px;
    border-radius: var(--jwt-radius);
    border: 2px solid;
    background: var(--jwt-white);
}

.legal-card.legal {
    border-color: #c7d2fe;
    background: linear-gradient(135deg, #f5f3ff 0%, #eef2ff 100%);
}

.legal-card.safe {
    border-color: #bbf7d0;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
}

.legal-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.legal-card-head iconify-icon {
    font-size: 28px;
    padding: 8px;
    border-radius: 50%;
    background: var(--jwt-white);
    box-shadow: var(--jwt-shadow);
}

.legal-card.legal .legal-card-head iconify-icon { color: #6366f1; }
.legal-card.safe .legal-card-head iconify-icon  { color: var(--jwt-success); }

.legal-card-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--jwt-gray-900);
}

.legal-card p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--jwt-gray-700);
    margin: 0 0 12px;
}

.legal-card p strong { color: var(--jwt-gray-900); }

.legal-card code {
    background: rgba(255, 255, 255, 0.7);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--jwt-mono);
    color: var(--jwt-gray-800);
}

.safety-checks {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.safety-checks li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--jwt-gray-700);
    line-height: 1.5;
}

.safety-checks iconify-icon {
    color: var(--jwt-success);
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.legal-disclaimer {
    display: flex;
    gap: 12px;
    padding: 16px 18px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-left: 4px solid var(--jwt-primary);
    border-radius: var(--jwt-radius-sm);
    font-size: 13px;
    line-height: 1.6;
    color: var(--jwt-gray-700);
}

.legal-disclaimer iconify-icon {
    color: var(--jwt-primary);
    font-size: 22px;
    flex-shrink: 0;
    margin-top: 1px;
}

.legal-disclaimer strong { color: var(--jwt-gray-900); }

.legal-disclaimer code {
    background: rgba(255, 140, 0, 0.12);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--jwt-mono);
    font-size: 12px;
    color: var(--jwt-primary);
}

/* ============================================
   Use Cases Grid
   ============================================ */
.use-cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.use-case-card {
    padding: 22px;
    background: var(--jwt-white);
    border: 1px solid var(--jwt-gray-200);
    border-radius: var(--jwt-radius-sm);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.use-case-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--jwt-shadow-lg);
    border-color: var(--jwt-primary);
}

.use-case-card iconify-icon {
    font-size: 28px;
    color: var(--jwt-primary);
    padding: 10px;
    background: #fff7ed;
    border-radius: 12px;
    margin-bottom: 12px;
}

.use-case-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--jwt-gray-900);
}

.use-case-card p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--jwt-gray-600);
}

/* ============================================
   SEO Table
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: var(--jwt-radius-sm);
    border: 1px solid var(--jwt-gray-200);
}

.seo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--jwt-white);
    min-width: 640px;
}

.seo-table thead {
    background: linear-gradient(135deg, var(--jwt-gray-900), var(--jwt-gray-800));
    color: var(--jwt-white);
}

.seo-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.seo-table tbody tr {
    border-bottom: 1px solid var(--jwt-gray-200);
    transition: background 0.15s;
}

.seo-table tbody tr:hover { background: var(--jwt-gray-50); }
.seo-table tbody tr:last-child { border-bottom: none; }

.seo-table td {
    padding: 14px 16px;
    color: var(--jwt-gray-700);
    line-height: 1.5;
    vertical-align: top;
}

.seo-table td strong { color: var(--jwt-gray-900); font-weight: 700; }

.seo-table code {
    background: var(--jwt-gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--jwt-primary);
    font-family: var(--jwt-mono);
    font-weight: 600;
}

/* ============================================
   Comparison Grid
   ============================================ */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .comparison-grid { grid-template-columns: 1fr; }
}

.comparison-card {
    padding: 22px;
    border-radius: var(--jwt-radius-sm);
    border: 2px solid;
}

.comparison-card.good {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-color: #bbf7d0;
}

.comparison-card.bad {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-color: #fecaca;
}

.comparison-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.comparison-head iconify-icon { font-size: 24px; }
.comparison-card.good .comparison-head iconify-icon { color: var(--jwt-success); }
.comparison-card.bad .comparison-head iconify-icon  { color: var(--jwt-danger); }

.comparison-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--jwt-gray-900);
}

.comparison-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comparison-card li {
    font-size: 13px;
    line-height: 1.5;
    color: var(--jwt-gray-700);
    padding-left: 22px;
    position: relative;
}

.comparison-card.good li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--jwt-success);
    font-weight: 700;
    font-size: 14px;
}

.comparison-card.bad li::before {
    content: "✕";
    position: absolute;
    left: 0;
    color: var(--jwt-danger);
    font-weight: 700;
    font-size: 14px;
}

/* ============================================
   Device Grid
   ============================================ */
.device-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 20px;
}

.device-card {
    padding: 20px 22px;
    background: var(--jwt-white);
    border: 1px solid var(--jwt-gray-200);
    border-radius: var(--jwt-radius-sm);
}

.device-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 700;
    color: var(--jwt-gray-900);
}

.device-card h3 iconify-icon {
    color: var(--jwt-primary);
    font-size: 22px;
}

.device-card ol {
    margin: 0;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.device-card li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--jwt-gray-700);
}

.device-card strong { color: var(--jwt-gray-900); }

.device-card code {
    background: var(--jwt-gray-100);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--jwt-primary);
    font-family: var(--jwt-mono);
}

.device-card kbd {
    background: var(--jwt-gray-100);
    border: 1px solid var(--jwt-gray-300);
    border-bottom-width: 2px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: var(--jwt-mono);
    color: var(--jwt-gray-700);
}

/* ============================================
   Best Practices List
   ============================================ */
.best-practices-list {
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.best-practices-list li {
    padding: 14px 16px 14px 44px;
    background: var(--jwt-gray-50);
    border-radius: var(--jwt-radius-xs);
    border-left: 3px solid var(--jwt-primary);
    font-size: 14px;
    line-height: 1.6;
    color: var(--jwt-gray-700);
    position: relative;
}

.best-practices-list li::before {
    content: "★";
    position: absolute;
    left: 16px;
    top: 14px;
    color: var(--jwt-primary);
    font-size: 16px;
    font-weight: 700;
}

.best-practices-list strong { color: var(--jwt-gray-900); }

.best-practices-list code {
    background: var(--jwt-gray-200);
    color: var(--jwt-gray-900);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: var(--jwt-mono);
    font-size: 12px;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
    .jwt-tool-grid {
        padding: 16px;
        gap: 16px;
    }

    .jwt-main-panel { padding: 18px; }

    .jwt-input-actions .jwt-mini-btn span { display: none; }
    .jwt-input-actions .jwt-mini-btn { padding: 7px 9px; }

    .jwt-empty-state { padding: 40px 16px; }

    .jwt-empty-icon { width: 64px; height: 64px; }
    .jwt-empty-icon iconify-icon { font-size: 32px; }

    .jwt-sections .jwt-decoded { font-size: 12px; }

    .jwt-claims-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .jwt-textarea {
        font-size: 12px;
        padding: 14px 14px 50px;
    }

    .jwt-example-urls {
        flex-direction: column;
        align-items: stretch;
    }

    .jwt-example-chip { justify-content: center; }

    .jwt-trust-row {
        grid-template-columns: 1fr 1fr;
        padding: 10px;
    }

    .jwt-trust-badge { padding: 6px 8px; }
    .jwt-trust-badge iconify-icon { font-size: 18px; }
    .jwt-trust-badge strong { font-size: 12px; }
    .jwt-trust-badge span { font-size: 10px; }

    .legal-card { padding: 18px; }

    .legal-disclaimer {
        flex-direction: column;
        gap: 8px;
    }

    .comparison-card,
    .device-card,
    .use-case-card { padding: 16px; }

    .jwt-validation-bar { padding: 10px 12px; }
}
