/* ============================================================================
   DispHub Portal — Design System
   Typeface: Outfit (geometric sans) + JetBrains Mono
   Aesthetic: Precision-engineered control panel — clean depth, purposeful motion
   ============================================================================ */

/* --- Custom Properties --------------------------------------------------- */
:root {
    /* Primary */
    --color-primary: #4f6df5;
    --color-primary-dark: #3d5bd9;
    --color-primary-light: #7b93f7;
    --color-primary-glow: rgba(79, 109, 245, 0.18);

    /* Accent */
    --color-accent: #8b5cf6;
    --color-accent-light: #a78bfa;

    /* Semantic */
    --color-success: #10b981;
    --color-success-dark: #059669;
    --color-success-glow: rgba(16, 185, 129, 0.18);
    --color-danger: #ef4444;
    --color-danger-dark: #dc2626;
    --color-danger-glow: rgba(239, 68, 68, 0.18);
    --color-warning: #f59e0b;
    --color-warning-dark: #d97706;
    --color-warning-glow: rgba(245, 158, 11, 0.18);

    /* Surfaces */
    --color-bg: #f0f2f7;
    --color-bg-alt: #e4e7ef;
    --color-surface: #ffffff;
    --color-surface-hover: #f8f9fb;
    --color-border: #e0e4ed;
    --color-border-light: #f0f2f7;

    /* Text */
    --color-text: #1a1f36;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;
    --color-text-inverse: #ffffff;

    /* Dark palette */
    --color-dark: #0d1321;
    --color-dark-mid: #1a2138;
    --color-dark-light: #2e364d;
    --color-dark-lighter: #475569;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows — layered for realistic depth */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 8px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 20px -4px rgba(0,0,0,0.08), 0 4px 8px -4px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 40px -8px rgba(0,0,0,0.12), 0 8px 16px -6px rgba(0,0,0,0.05);
    --shadow-card-hover: 0 14px 30px -8px rgba(79,109,245,0.13), 0 4px 10px -4px rgba(0,0,0,0.06);

    /* Transitions */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 150ms var(--ease-out);
    --transition: 220ms var(--ease-out);
    --transition-slow: 350ms var(--ease-out);

    /* Typography */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', monospace;
}

/* --- Reset & Base -------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -20%, rgba(79,109,245,0.06) 0%, transparent 70%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--color-text);
    line-height: 1.55;
}

::selection { background: var(--color-primary-glow); color: var(--color-primary-dark); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* --- Keyframe Animations ------------------------------------------------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 var(--color-primary-glow); }
    50%      { box-shadow: 0 0 0 6px transparent; }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --- Top Bar ------------------------------------------------------------- */
.top-bar {
    background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-dark-mid) 100%);
    color: var(--color-text-inverse);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.top-bar-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}
.logo-img { height: 40px; width: auto; }
.logo-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.user-menu { display: flex; align-items: center; gap: 16px; }
.user-name { color: var(--color-text-muted); font-size: 14px; }
.user-name strong { color: var(--color-text-inverse); }
.logout-btn {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    backdrop-filter: blur(4px);
}
.logout-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--color-text-inverse);
    border-color: rgba(255,255,255,0.2);
}

/* --- Language Selector --------------------------------------------------- */
.lang-selector { display: flex; gap: 4px; }
.lang-btn {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.lang-btn:hover { background: rgba(255,255,255,0.1); color: var(--color-text-inverse); }
.lang-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    box-shadow: 0 2px 8px rgba(79,109,245,0.3);
}

/* --- Navigation Bar ------------------------------------------------------ */
.nav-bar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
}
.nav-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav-links { display: flex; gap: 2px; }
.nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    position: relative;
}
.nav-link:hover {
    color: var(--color-primary);
    background: var(--color-surface-hover);
}
.nav-link.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--color-success), var(--color-success-dark));
    color: var(--color-text-inverse);
    border: none;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.refresh-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--color-success-glow);
}
.refresh-btn:active { transform: translateY(0); }

/* --- Main Content -------------------------------------------------------- */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
    flex: 1 0 auto;
    width: 100%;
    animation: fadeInUp 0.35s var(--ease-out);
}

/* --- Page Header --------------------------------------------------------- */
.page-header { margin-bottom: 24px; }
.page-title {
    color: var(--color-text);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}
.page-subtitle {
    color: var(--color-text-secondary);
    font-size: 15px;
    margin-top: 6px;
    font-weight: 400;
}

/* --- Cards --------------------------------------------------------------- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}
/* Disable lift for cards that contain interactive tables/forms */
.card:has(table):hover,
.card:has(form):hover,
.card.card-static:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}
.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border-light);
}
.card-icon {
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-glow);
    border-radius: var(--radius-md);
}
.card-title { font-size: 16px; font-weight: 600; color: var(--color-text); letter-spacing: -0.01em; }

/* Card with colored left border */
.card-accent-blue { border-left: 4px solid var(--color-primary); }
.card-accent-purple { border-left: 4px solid var(--color-accent); }
.card-accent-green { border-left: 4px solid var(--color-success); }
.card-accent-amber { border-left: 4px solid var(--color-warning); }
.card-accent-red { border-left: 4px solid var(--color-danger); }

/* Tip / warning card */
.card-tip {
    background: #fffbeb;
    border: 1px solid #fde68a;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: var(--color-text-inverse);
    text-decoration: none;
    border-radius: var(--radius-md);
    border: none;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79,109,245,0.3);
}
.btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: none;
}
.btn:disabled, .btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    filter: grayscale(0.3);
}
.btn-secondary {
    background: var(--color-border-light);
    color: var(--color-dark-lighter);
}
.btn-secondary:hover {
    background: var(--color-bg-alt);
    box-shadow: var(--shadow-sm);
    transform: none;
}
.btn-success {
    background: linear-gradient(135deg, var(--color-success), var(--color-success-dark));
}
.btn-success:hover { box-shadow: 0 6px 16px var(--color-success-glow); }
.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), var(--color-danger-dark));
}
.btn-danger:hover { box-shadow: 0 6px 16px var(--color-danger-glow); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-xs { padding: 4px 8px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-block { display: flex; width: 100%; }

/* Tiny action buttons (ordering, table actions) */
.btn-order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 6px;
    font-size: 10px;
    line-height: 1;
    background: var(--color-border-light);
    color: var(--color-dark-lighter);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}
.btn-order:hover { background: var(--color-bg-alt); }

.btn-table {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
}

/* --- Forms --------------------------------------------------------------- */
.form-group { margin-bottom: 18px; }
label {
    display: block;
    margin-bottom: 6px;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
}
input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="file"], select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--color-surface);
    color: var(--color-text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}
input::placeholder, textarea::placeholder {
    color: var(--color-text-muted);
    font-weight: 400;
}
.help-text {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-top: 6px;
    line-height: 1.4;
}
.inline-form { margin: 0; }

/* --- Status Badges ------------------------------------------------------- */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.01em;
}
.status-registered { background: #fef3c7; color: #92400e; }
.status-certified  { background: #dbeafe; color: #1e40af; }
.status-licensed   { background: #d1fae5; color: #065f46; }

/* --- Info Grid ----------------------------------------------------------- */
.info-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
    margin: 12px 0;
}
.info-label { color: var(--color-text-secondary); font-size: 13px; font-weight: 500; }
.info-value { color: var(--color-text); font-size: 14px; }
.info-grid a { color: var(--color-primary); text-decoration: none; }
.info-grid a:hover { text-decoration: underline; }

/* --- Token Display ------------------------------------------------------- */
.token-display {
    background: var(--color-surface-hover);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 12px;
    word-break: break-all;
    border: 1px solid var(--color-border);
    color: var(--color-dark-lighter);
}

/* --- Tables -------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; text-align: left; }
th {
    background: var(--color-surface-hover);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
td {
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-dark-light);
    font-size: 14px;
}
tr { transition: background var(--transition-fast); }
tbody tr:hover td { background: var(--color-surface-hover); }

/* --- Empty State --------------------------------------------------------- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--color-text-secondary); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { color: var(--color-text); margin-bottom: 8px; font-weight: 600; }

/* --- Typography ---------------------------------------------------------- */
h2 {
    color: var(--color-text);
    font-size: 18px;
    font-weight: 600;
    margin: 28px 0 16px;
    letter-spacing: -0.01em;
}
code {
    background: var(--color-border-light);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 12px;
    color: #6d28d9;
    font-family: var(--font-mono);
    font-weight: 500;
}

/* --- Alerts -------------------------------------------------------------- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    animation: slideDown 0.3s var(--ease-out);
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--color-success); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--color-warning); }
.alert-error   { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--color-danger); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left: 4px solid var(--color-primary); }

/* --- Disclaimer Banner --------------------------------------------------- */
.disclaimer-banner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #fbbf24;
    border-left: 4px solid var(--color-warning);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 20px;
    position: relative;
}
.disclaimer-banner .disclaimer-title {
    font-size: 14px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.disclaimer-banner .disclaimer-text {
    font-size: 13px;
    color: #78350f;
    line-height: 1.6;
}
.disclaimer-banner .dismiss-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #92400e;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 4px;
    opacity: 0.6;
    transition: opacity var(--transition);
}
.disclaimer-banner .dismiss-btn:hover { opacity: 1; }

/* --- Info Notice --------------------------------------------------------- */
.info-notice {
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    border: 1px solid #93c5fd;
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #1e40af;
    line-height: 1.6;
}
.info-notice strong { color: #1e3a8a; }

/* --- File Expired State -------------------------------------------------- */
.file-expired {
    opacity: 0.55;
    position: relative;
}
.file-expired-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fef2f2;
    color: #dc2626;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
    border: 1px solid #fecaca;
}

/* --- Status Banners ------------------------------------------------------ */
.status-banner {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}
.status-banner-icon { font-size: 18px; }
.status-banner-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--color-success); }
.status-banner-danger  { background: #fef2f2; color: #991b1b; }
.status-banner-info    { background: #dbeafe; color: #1e40af; }
.status-banner-muted   { background: var(--color-surface-hover); color: var(--color-text-secondary); }

/* --- License-expired banner (gates content UI) --------------------------- */
.license-expired-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    margin: 16px 0;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-left: 5px solid #d97706;
    border-radius: var(--radius-md);
    color: #78350f;
}
.license-expired-banner-icon {
    font-size: 32px;
    flex-shrink: 0;
}
.license-expired-banner-text {
    flex: 1;
}
.license-expired-banner-text strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
    color: #78350f;
}
.license-expired-banner-text p {
    margin: 0;
    font-size: 14px;
    color: #92400e;
}
.license-expired-banner-cta {
    flex-shrink: 0;
    white-space: nowrap;
}

/* --- Floating page-refresh button ---------------------------------------- */
.floating-refresh-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--color-dark);
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    opacity: 0.7;
}
.floating-refresh-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    opacity: 1;
}

/* --- Footer -------------------------------------------------------------- */
.site-footer {
    background: linear-gradient(135deg, var(--color-dark), var(--color-dark-mid));
    color: var(--color-text-muted);
    padding: 32px 24px;
    margin-top: auto;
    flex-shrink: 0;
}
.footer-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}
.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.footer-links a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color var(--transition);
}
.footer-links a:hover { color: var(--color-text-inverse); }
.footer-separator { color: var(--color-dark-lighter); }
.footer-anpc { display: flex; align-items: center; gap: 16px; }
.anpc-logo {
    height: 40px;
    width: auto;
    opacity: 0.85;
    transition: opacity var(--transition);
}
.anpc-logo:hover { opacity: 1; }
.footer-copyright { font-size: 13px; color: var(--color-text-secondary); }

/* ============================================================================
   PAGE-SPECIFIC: Device Detail
   ============================================================================ */

/* Header layout — title left, back button right */
.page-header-split {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

/* Device subtitle status indicators */
.detail-badge {
    margin-left: 12px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}
.detail-badge img { height: 16px; width: 16px; vertical-align: middle; opacity: 0.7; }

/* Device status badge row */
.device-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.device-id-code {
    display: inline-block;
    margin-top: 6px;
    margin-bottom: 2px;
}
.detail-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
}
.detail-badge:hover { filter: brightness(0.95); }
.detail-badge--online {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success-dark);
    border-color: rgba(16, 185, 129, 0.25);
}
.detail-badge--offline {
    background: var(--color-surface-hover);
    color: var(--color-text-muted);
    border-color: var(--color-border);
}
.detail-badge--network {
    background: var(--color-surface-hover);
    color: var(--color-text-secondary);
    border-color: var(--color-border);
}
.detail-badge--storage {
    background: var(--color-surface-hover);
    color: var(--color-text-secondary);
    border-color: var(--color-border);
}
.detail-badge--storage-warn {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning-dark);
    border-color: rgba(245, 158, 11, 0.25);
}
.detail-badge--storage-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger-dark);
    border-color: rgba(239, 68, 68, 0.25);
}
.detail-badge--resolution {
    background: rgba(139, 92, 246, 0.08);
    color: #6d28d9;
    border-color: rgba(139, 92, 246, 0.2);
}
.detail-badge--sub-ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-success-dark);
    border-color: rgba(16, 185, 129, 0.25);
}
.detail-badge--sub-warn {
    background: rgba(245, 158, 11, 0.1);
    color: var(--color-warning-dark);
    border-color: rgba(245, 158, 11, 0.25);
}
.detail-badge--sub-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger-dark);
    border-color: rgba(239, 68, 68, 0.25);
}
.detail-badge--heartbeat {
    color: var(--color-text-secondary);
    font-weight: 400;
    font-size: 11px;
}

/* Screenshot section — dark cinema viewport */
.screenshot-section {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    padding: 24px;
    background: linear-gradient(135deg, var(--color-dark) 0%, var(--color-dark-mid) 100%);
    border-radius: var(--radius-lg);
}
.screenshot-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.screenshot-img {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.screenshot-img:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.screenshot-img--offline {
    filter: grayscale(100%) brightness(90%) contrast(40%);
}
.screenshot-caption {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 10px;
}
.screenshot-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px;
    color: rgba(255, 255, 255, 0.35);
}
.screenshot-empty p { color: inherit; }
.screenshot-empty-icon { font-size: 40px; margin-bottom: 8px; }
.screenshot-section .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-inverse);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.screenshot-section .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.screenshot-section .btn-secondary:disabled { opacity: 0.3; }

/* ============================================================================
   PAGE-SPECIFIC: File Management
   ============================================================================ */

/* File list wrapper */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

/* File item container */
.file-item {
    padding: 16px;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    animation: fadeInUp 0.3s var(--ease-out) both;
}
.file-item:nth-child(2) { animation-delay: 50ms; }
.file-item:nth-child(3) { animation-delay: 100ms; }
.file-item:nth-child(4) { animation-delay: 150ms; }
.file-item:nth-child(5) { animation-delay: 200ms; }
.file-item:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-sm);
}

/* File header row */
.file-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.file-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Order controls (up/down arrows) */
.file-order-controls {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.file-order-spacer { width: 24px; }

/* File index number — pill badge */
.file-number {
    font-size: 11px;
    color: var(--color-text-inverse);
    font-weight: 600;
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border-radius: var(--radius-full);
}
/* File type icon — framed */
.file-type-icon {
    font-size: 18px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-border-light);
    border-radius: var(--radius-sm);
}

/* File metadata */
.file-meta code { font-size: 12px; }
.file-meta-secondary {
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-left: 6px;
}
.file-meta-muted {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-left: 8px;
}

/* Processing controls area — recessed panel */
.processing-controls {
    margin: 12px -16px -16px;
    padding: 12px 16px 14px;
    background: var(--color-surface-hover);
    border-top: 1px solid var(--color-border-light);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Duration form */
.duration-form {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}
.duration-form label {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 0;
    display: inline;
}
.duration-form input[type="number"] {
    width: 60px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
}
.duration-unit {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* Processing table */
.proc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.proc-table tr { transition: none; }
.proc-table tr:hover td { background: transparent; }
.proc-table td {
    padding: 8px 6px;
    border-bottom: none;
    font-size: 12px;
}
.proc-table tr + tr { border-top: 1px solid var(--color-border); }
.proc-td-action   { width: 110px; }
.proc-td-label    { width: 80px; color: var(--color-text); font-weight: 600; font-family: var(--font-sans); }
.proc-td-res      { width: 100px; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.proc-td-size     { width: 80px; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
.proc-td-preview  { width: 40px; text-align: center; }
.proc-td-edit     { width: 60px; text-align: right; }

/* Status indicators in processing table */
.proc-status-playing { color: #059669; font-weight: 600; }
.proc-status-queued  { color: #1e40af; }
.proc-status-active  { color: #92400e; }
.proc-status-failed  { color: #dc2626; }
.proc-status-muted   { color: var(--color-text-muted); font-size: 11px; }

/* Processing error message */
.proc-error {
    margin-top: 6px;
    font-size: 11px;
    color: #991b1b;
    background: #fef2f2;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Preview button (icon-only) */
.btn-preview {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    transition: transform var(--transition-fast);
}
.btn-preview:hover { transform: scale(1.15); }
.btn-preview:disabled,
.btn-preview--disabled {
    cursor: default;
    opacity: 0.3;
}

/* Delete processed button */
.btn-delete-processed {
    padding: 4px 8px;
    font-size: 11px;
    background: #ea580c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}
.btn-delete-processed:hover { background: #c2410c; }

/* ============================================================================
   PAGE-SPECIFIC: Upload Zone & Progress
   ============================================================================ */

.upload-zone {
    padding: 32px 20px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-hover);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.upload-zone:hover {
    border-color: var(--color-primary);
    background: rgba(79,109,245,0.04);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.upload-zone--active {
    border-color: var(--color-primary);
    background: var(--color-primary-glow);
    animation: pulseGlow 1.5s ease infinite;
}
.upload-zone--selected {
    border-color: var(--color-success);
    background: #ecfdf5;
}
.upload-zone-icon { font-size: 36px; margin-bottom: 8px; display: block; }
.upload-zone-text { color: var(--color-text); font-weight: 600; font-size: 15px; margin-top: 8px; }
.upload-zone-hint { font-size: 13px; color: var(--color-text-muted); margin-top: 6px; }

/* Hidden file input overlay */
.upload-input-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

/* Upload progress */
.progress-container { margin-top: 16px; }
.progress-track {
    background: var(--color-border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    height: 36px;
    position: relative;
}
.progress-fill {
    background: linear-gradient(135deg, var(--color-success), var(--color-success-dark));
    height: 100%;
    width: 0%;
    transition: width 0.3s var(--ease-out);
    border-radius: var(--radius-md);
}
.progress-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: var(--color-text);
    font-size: 14px;
}
.progress-status {
    margin-top: 8px;
    color: var(--color-text-secondary);
    font-size: 13px;
    text-align: center;
}

/* ============================================================================
   PAGE-SPECIFIC: Dashboard
   ============================================================================ */

/* Device table row — clickable */
.device-row {
    height: 75px;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.device-row:hover td { background: var(--color-surface-hover); }

.device-cell-name {
    font-weight: 500;
    color: var(--color-text);
}
.device-cell-id {
    font-size: 11px;
}

/* Screenshot thumbnail in table */
.screenshot-thumb {
    max-height: 50px;
    max-width: 90px;
    border-radius: 4px;
    border: 2px solid var(--color-text-muted);
    transition: border-color var(--transition-fast);
}
.screenshot-thumb--online { border-color: #059669; }
.screenshot-thumb--offline {
    border-color: var(--color-text-muted);
    filter: grayscale(100%) brightness(90%) contrast(40%);
}

/* Connection indicator */
.wifi-strength {
    font-size: 11px;
}

/* Quick-start step grid */
.quick-start-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.quick-start-step { font-size: 24px; margin-bottom: 8px; }
.quick-start-title { font-size: 15px; color: var(--color-text); margin-bottom: 6px; font-weight: 600; }
.quick-start-desc { font-size: 13px; color: var(--color-text-secondary); line-height: 1.5; }

/* ============================================================================
   PAGE-SPECIFIC: Register Device
   ============================================================================ */

.register-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    max-width: 1000px;
}

/* Numbered step list */
.step-list { font-size: 14px; color: #475569; line-height: 1.7; }
.step-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-start;
}
.step-item:last-child { margin-bottom: 0; }
.step-number {
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.step-number--blue   { background: var(--color-primary); }
.step-number--purple { background: var(--color-accent); }
.step-number--green  { background: var(--color-success); }
.step-number--amber  { background: var(--color-warning); }

/* Tip card (security notice) */
.tip-icon { font-size: 20px; }
.tip-title { color: #92400e; font-size: 14px; font-weight: 600; }
.tip-text { color: #78350f; font-size: 13px; margin-top: 4px; line-height: 1.5; }

/* Action row */
.action-row {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* ============================================================================
   PAGE-SPECIFIC: FAQ (Support)
   ============================================================================ */

.faq-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border-light);
}
.faq-item:last-child { border-bottom: none; }
.faq-question {
    color: var(--color-text);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}
.faq-answer {
    color: var(--color-text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================================================
   PAGE-SPECIFIC: Legal Content (ToS, Privacy)
   ============================================================================ */

.legal-content { line-height: 1.8; }
.legal-content .intro {
    font-size: 15px;
    color: #475569;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border-light);
}
.legal-content h3 {
    color: var(--color-text);
    font-size: 16px;
    font-weight: 600;
    margin: 24px 0 12px;
    letter-spacing: -0.01em;
}
.legal-content p {
    color: var(--color-text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.8;
}

/* ============================================================================
   PAGE-SPECIFIC: Company Info
   ============================================================================ */

.company-details {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}
.detail-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border-light);
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    flex: 0 0 200px;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
}
.detail-value {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
}
.detail-value a { color: var(--color-primary); text-decoration: none; }
.detail-value a:hover { text-decoration: underline; }
.contact-section h3 {
    color: var(--color-text);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* ============================================================================
   PAGE-SPECIFIC: Subscription
   ============================================================================ */

.subscription-extend {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border-light);
}
.subscription-extend-label {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

/* ============================================================================
   Modals (base styles for JS-created overlays)
   ============================================================================ */

.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s var(--ease-out);
}
.modal-overlay--dark { background: rgba(0,0,0,0.85); }
.modal-overlay--dim  { background: rgba(0,0,0,0.6); }

.modal-panel {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.25s var(--ease-out);
}
.modal-title {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: var(--color-text);
    font-weight: 600;
}
.modal-close-btn {
    margin-top: 16px;
    padding: 10px 24px;
    background: var(--color-danger);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-family: var(--font-sans);
    transition: background var(--transition-fast);
}
.modal-close-btn:hover { background: var(--color-danger-dark); }

/* Clone button */
.btn-clone {
    background: linear-gradient(135deg, var(--color-accent), #7c3aed);
}
.btn-clone:hover {
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    .top-bar-content {
        flex-wrap: wrap;
        gap: 8px;
    }
    .user-menu {
        gap: 8px;
        flex-wrap: wrap;
    }
    .nav-content {
        flex-direction: column;
        padding: 8px 16px;
        gap: 8px;
    }
    .nav-links {
        width: 100%;
        justify-content: center;
    }
    .nav-link { padding: 10px 14px; font-size: 13px; }
    .main-content { padding: 20px 16px; }
    .page-title { font-size: 22px; }
    .card { padding: 18px; border-radius: var(--radius-md); }
    .info-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .info-label { font-weight: 600; }
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    th, td { padding: 10px 12px; white-space: nowrap; }
    .footer-links { gap: 6px; }
    .footer-links a { font-size: 12px; }

    /* Device detail responsive */
    .page-header-split {
        flex-direction: column;
        gap: 12px;
    }
    .device-status-row { gap: 6px; }
    .detail-badge { font-size: 11px; padding: 4px 10px; }
    .screenshot-section {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }
    .screenshot-section > div:first-child { display: none; }
    .screenshot-section > div:last-child { justify-self: center; }

    /* Register responsive */
    .register-grid {
        grid-template-columns: 1fr;
    }

    /* Company info responsive */
    .detail-row {
        flex-direction: column;
        gap: 4px;
    }
    .detail-label { flex: none; }

    /* Dashboard responsive */
    .quick-start-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .top-bar-content { padding: 0 12px; }
    .logo-text { font-size: 15px; }
    .main-content { padding: 16px 12px; }
    .page-title { font-size: 20px; }
    .card { padding: 14px; }
    .btn { padding: 8px 16px; font-size: 13px; }

    /* File items compact */
    .file-item { padding: 10px; }
    .file-item-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .proc-table { font-size: 11px; }
    .proc-table td { padding: 6px 4px; }

    /* Upload zone compact */
    .upload-zone { padding: 16px; }
}
