/**
 * AddonsCare — Client Area Layout
 * ===========================================
 * Full-page dashboard shell: sidebar + main.
 * Depends on: /assets/style.css (loaded first)
 * All colours use the --ac-* variables defined
 * inside .addonscare in style.css.
 * ===========================================
 */

/* -----------------------------------------------
   Page-level reset
   --------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    background: #f1f5f9;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }

/* -----------------------------------------------
   Root wrapper — inherits .addonscare variables
   --------------------------------------------- */
.ca-page {
    display: flex;
    min-height: 100vh;
    background: #f1f5f9;
}

/* -----------------------------------------------
   Sidebar
   --------------------------------------------- */
.ca-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #0f172a;           /* --ac-slate-900 */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.ca-sidebar::-webkit-scrollbar { display: none; }

.ca-sidebar-header {
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.ca-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -.01em;
    margin-bottom: 14px;
}

.ca-sidebar-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
    font-weight: 800;
    color: white;
    flex-shrink: 0;
}

.ca-sidebar-logo-img {
    height: 36px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.ca-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ca-sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.ca-sidebar-user-info { overflow: hidden; }

.ca-sidebar-user-name {
    font-size: .8125rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ca-sidebar-user-email {
    font-size: .6875rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nav */
.ca-sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ca-sidebar-section {
    font-size: .625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #475569;
    padding: 10px 10px 4px;
    margin-top: 4px;
}

.ca-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: .8125rem;
    font-weight: 500;
    color: #94a3b8;
    transition: background 160ms ease, color 160ms ease;
    cursor: pointer;
}

.ca-sidebar-link:hover {
    background: rgba(255,255,255,.06);
    color: #f1f5f9;
}

.ca-sidebar-link.active {
    background: rgba(20,184,166,.15);
    color: #14b8a6;
    font-weight: 600;
}

.ca-sidebar-link .ca-nav-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ca-sidebar-link .ca-nav-icon svg {
    width: 20px;
    height: 20px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ca-sidebar-link .ca-nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: .6rem;
    font-weight: 700;
    border-radius: 99px;
    padding: 2px 7px;
    line-height: 1.4;
}

/* Footer */
.ca-sidebar-footer {
    padding: 12px 10px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
    flex-shrink: 0;
}

.ca-sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: .8125rem;
    color: #64748b;
    transition: background 160ms ease, color 160ms ease;
}

.ca-sidebar-logout:hover {
    background: rgba(239,68,68,.1);
    color: #ef4444;
}

/* Mobile toggle */
.ca-topbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: #475569;
    padding: 4px;
    border-radius: 6px;
    line-height: 1;
    font-size: 1.25rem;
}

/* Overlay (mobile) */
.ca-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
}

/* -----------------------------------------------
   Main area
   --------------------------------------------- */
.ca-main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* Topbar */
.ca-topbar {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
}

.ca-topbar-left { display: flex; align-items: center; gap: 12px; }

.ca-topbar-title {
    font-size: .9375rem;
    font-weight: 600;
    color: #0f172a;
}

.ca-topbar-right {
    display: flex;
    align-items: center;
    flex-shrink: 1;
    min-width: 0;
    gap: 12px;
}

.ca-topbar-link {
    font-size: .8125rem;
    color: #64748b;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 160ms ease;
    white-space: nowrap;
}

.ca-topbar-link:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #0f172a;
}

/* Content */
.ca-content {
    flex: 1;
    padding: 28px 28px 40px;
}

/* Page header */
.ca-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.ca-page-header h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.ca-page-header p {
    color: #64748b;
    font-size: .875rem;
}

/* -----------------------------------------------
   Welcome banner
   --------------------------------------------- */
.ca-welcome-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 14px;
    padding: 22px 28px;
    margin-bottom: 24px;
    color: #f8fafc;
}

.ca-welcome-banner h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 4px;
}

.ca-welcome-banner p {
    font-size: .875rem;
    color: #94a3b8;
}

.ca-btn-white {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.18);
    color: #f8fafc;
    border-radius: 8px;
    font-size: .8125rem;
    font-weight: 500;
    transition: background 160ms ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.ca-btn-white:hover {
    background: rgba(255,255,255,.18);
    color: white;
}

/* -----------------------------------------------
   Auth page (login / register)
   --------------------------------------------- */
.ca-auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ca-auth-card {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0,0,0,.28);
    padding: 40px;
    width: 100%;
    max-width: 440px;
}

.ca-auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    font-size: 1.0625rem;
    font-weight: 800;
    color: #0f172a;
}

.ca-auth-logo-img {
    height: 48px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
}

.ca-auth-logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 900;
    color: white;
}

.ca-auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
}

.ca-auth-card > p {
    color: #64748b;
    font-size: .875rem;
    margin-bottom: 24px;
}

/* Tabs */
.ca-auth-tabs {
    display: flex;
    gap: 0;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 24px;
}

.ca-auth-tab {
    flex: 1;
    text-align: center;
    padding: 9px;
    border-radius: 7px;
    font-size: .8125rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 160ms ease;
    user-select: none;
}

.ca-auth-tab.active {
    background: #ffffff;
    color: #0f172a;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.ca-auth-tab-content { display: none; }
.ca-auth-tab-content.active { display: block; }

/* -----------------------------------------------
   Form fields (used in auth + profile + support)
   --------------------------------------------- */
.ca-field {
    margin-bottom: 18px;
}

.ca-field label {
    display: block;
    font-size: .8125rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.ca-input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-family: inherit;
    font-size: .875rem;
    color: #1e293b;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
    min-height: 42px;
    line-height: 1.4;
}

.ca-input:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20,184,166,.18);
}

.ca-input::placeholder { color: #9ca3af; }

.ca-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.ca-textarea { resize: vertical; min-height: 100px; }

/* File input (support attachments) */
.ca-input[type="file"] {
    padding: 8px 12px;
    line-height: 1.2;
}

.ca-input[type="file"]::file-selector-button {
    margin-right: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
    border-radius: 8px;
    padding: 8px 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 160ms ease;
}

.ca-input[type="file"]::file-selector-button:hover {
    border-color: #14b8a6;
    background: rgba(20,184,166,.06);
    color: #0d9488;
}

/* -----------------------------------------------
   Buttons
   --------------------------------------------- */
.ca-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1;
    min-height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 160ms ease;
    text-decoration: none;
    white-space: nowrap;
}

.ca-btn-primary {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(20,184,166,.35);
}

.ca-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(20,184,166,.45);
    transform: translateY(-1px);
    color: white;
}

.ca-btn-outline {
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.ca-btn-outline:hover {
    border-color: #14b8a6;
    color: #14b8a6;
    background: rgba(20,184,166,.06);
    transform: translateY(-1px);
}

.ca-btn-ghost {
    background: transparent;
    color: #64748b;
}

.ca-btn-ghost:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.ca-btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 14px rgba(239,68,68,.3);
}

.ca-btn-sm {
    padding: 7px 14px;
    font-size: .8125rem;
    min-height: 32px;
    border-radius: 6px;
}

.ca-btn-full { width: 100%; }

/* -----------------------------------------------
   Alerts / notices
   --------------------------------------------- */
.ca-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: .875rem;
    margin-bottom: 16px;
}

.ca-error {
    display: none;
    color: #ef4444;
    font-size: .875rem;
    margin-top: 6px;
    padding: 8px 12px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 4px;
}

.ca-alert-success { background: rgba(34,197,94,.1); color: #166534; border: 1px solid rgba(34,197,94,.2); }
.ca-alert-error   { background: rgba(239,68,68,.1); color: #991b1b; border: 1px solid rgba(239,68,68,.2); }
.ca-alert-info    { background: rgba(59,130,246,.1); color: #1e40af; border: 1px solid rgba(59,130,246,.2); }
.ca-alert-warning { background: rgba(245,158,11,.1); color: #92400e; border: 1px solid rgba(245,158,11,.2); }

/* -----------------------------------------------
   Cards
   --------------------------------------------- */
.ca-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15,23,42,.05);
    overflow: hidden;
    margin-bottom: 20px;
}

.ca-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.ca-card-top h3 {
    font-size: .9375rem;
    font-weight: 600;
    color: #0f172a;
}

.ca-card-body { padding: 20px 24px; }
.ca-card-flush .ca-card-body { padding: 0; }

/* -----------------------------------------------
   Stat row
   --------------------------------------------- */
.ca-stat-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.ca-stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(15,23,42,.05);
    position: relative;
    overflow: hidden;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.ca-stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 4px 0 0 4px;
}

.ca-stat-card--teal::before   { background: #14b8a6; }
.ca-stat-card--emerald::before{ background: #22c55e; }
.ca-stat-card--amber::before  { background: #f59e0b; }
.ca-stat-card--rose::before   { background: #ef4444; }
.ca-stat-card--blue::before   { background: #3b82f6; }

.ca-stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(15,23,42,.1); }

.ca-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.ca-stat-icon svg {
    width: 24px;
    height: 24px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ca-stat-icon--teal    { background: rgba(20,184,166,.12); color: #14b8a6; }
.ca-stat-icon--emerald { background: rgba(34,197,94,.12); color: #22c55e; }
.ca-stat-icon--amber   { background: rgba(245,158,11,.12); color: #f59e0b; }
.ca-stat-icon--rose    { background: rgba(239,68,68,.12); color: #ef4444; }
.ca-stat-icon--blue    { background: rgba(59,130,246,.12); color: #3b82f6; }

.ca-stat-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.ca-stat-label {
    font-size: .75rem;
    color: #64748b;
    font-weight: 500;
    margin-top: 2px;
}

/* -----------------------------------------------
   Table
   --------------------------------------------- */
.ca-table-wrap { overflow-x: auto; }

.ca-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.ca-table thead th {
    padding: 10px 20px;
    text-align: left;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.ca-table tbody td {
    padding: 13px 20px;
    border-bottom: 1px solid rgba(226,232,240,.5);
    color: #334155;
    vertical-align: middle;
}

.ca-table tbody tr:last-child td { border-bottom: none; }
.ca-table tbody tr { transition: background 120ms ease; }
.ca-table tbody tr:hover { background: rgba(20,184,166,.03); }

/* -----------------------------------------------
   Status chips
   --------------------------------------------- */
.ca-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 11px;
    font-size: .75rem;
    font-weight: 600;
    border-radius: 99px;
    white-space: nowrap;
}

.ca-chip::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.ca-chip--success { background: rgba(34,197,94,.12); color: #16a34a; }
.ca-chip--warning { background: rgba(245,158,11,.12); color: #b45309; }
.ca-chip--danger  { background: rgba(239,68,68,.12);  color: #dc2626; }
.ca-chip--info    { background: rgba(59,130,246,.12); color: #1d4ed8; }
.ca-chip--neutral { background: #f1f5f9;              color: #64748b; }

/* -----------------------------------------------
   Empty state
   --------------------------------------------- */
.ca-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 52px 24px;
    color: #94a3b8;
}

.ca-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
}

.ca-empty-icon svg {
    width: 56px;
    height: 56px;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.ca-empty h3   { font-size: .9375rem; font-weight: 600; color: #475569; margin-bottom: 6px; }
.ca-empty p    { font-size: .875rem; color: #94a3b8; max-width: 280px; }
.ca-empty p a  { color: #14b8a6; }
.ca-empty p a:hover { text-decoration: underline; }

/* -----------------------------------------------
   License / download card
   --------------------------------------------- */
.ca-download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.ca-download-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(15,23,42,.05);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.ca-download-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(15,23,42,.1); }

.ca-download-platform {
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #14b8a6;
    margin-bottom: 8px;
}

.ca-download-name {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.ca-download-version {
    font-size: .75rem;
    color: #94a3b8;
    margin-bottom: 14px;
}

.ca-license-key {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    padding: 8px 12px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: .75rem;
    color: #475569;
    margin-bottom: 14px;
    word-break: break-all;
}

/* -----------------------------------------------
   Profile grid
   --------------------------------------------- */
.ca-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.ca-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.ca-profile-header h1 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.ca-profile-header p { font-size: .8125rem; color: #64748b; }

.ca-profile-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* -----------------------------------------------
   Support / tickets
   --------------------------------------------- */
.ca-support .ca-card { margin-bottom: 18px; }

.ca-support-form--new {
    max-width: 980px;
}

.ca-support .ca-profile-grid {
    grid-template-columns: 1.7fr 1fr;
    gap: 16px;
    align-items: end;
}

.ca-support .ca-field { margin-bottom: 16px; }

.ca-support-form--new .ca-textarea {
    min-height: 160px;
}

.ca-support-priority {
    max-width: 220px;
}

.ca-support-actions {
    margin-top: 6px;
    flex-wrap: wrap;
}

.ca-support-actions .ca-btn {
    min-width: 140px;
}

@media (max-width: 480px) {
    .ca-support-actions .ca-btn { width: 100%; }
    .ca-support-priority { max-width: 100%; }
}

.ca-attachments {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(226,232,240,.8);
}

.ca-attachments-title {
    font-size: .75rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
}

.ca-attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ca-attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    border-radius: 999px;
    text-decoration: none;
    color: #0f172a;
    font-size: .8125rem;
    max-width: 100%;
}

.ca-attachment:hover {
    border-color: #14b8a6;
    background: rgba(20,184,166,.06);
    color: #0d9488;
}

.ca-attachment-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 320px;
}

.ca-attachment-size {
    font-size: .75rem;
    color: #94a3b8;
}

.ca-ticket-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(226,232,240,.5);
    text-decoration: none;
    transition: background 120ms ease;
}

.ca-ticket-row:last-child { border-bottom: none; }
.ca-ticket-row:hover { background: rgba(20,184,166,.03); }

.ca-ticket-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(20,184,166,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .875rem;
    flex-shrink: 0;
    color: #14b8a6;
}

.ca-ticket-icon svg {
    width: 20px;
    height: 20px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ca-ticket-subject {
    font-size: .8750rem;
    font-weight: 500;
    color: #0f172a;
    margin-bottom: 2px;
}

.ca-ticket-meta {
    font-size: .75rem;
    color: #94a3b8;
}

/* Reply thread */
.ca-reply {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: .8750rem;
    line-height: 1.55;
    margin-bottom: 10px;
}

.ca-reply--client {
    background: rgba(20,184,166,.08);
    margin-left: 0;
    margin-right: 0;
}

.ca-reply--staff {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    margin-left: 0;
    margin-right: 0;
}

.ca-reply-meta {
    font-size: .6875rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* -----------------------------------------------
   Utility
   --------------------------------------------- */
.ca-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; min-width: 0; }
.ca-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; min-width: 0; }
.ca-grid-2 > *, .ca-grid-3 > * { min-width: 0; }
.ca-text-sm   { font-size: .8125rem; }
.ca-text-xs   { font-size: .75rem; }
.ca-text-muted{ color: #94a3b8; }
.ca-mono      { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: .75rem; }
.ca-fw-600    { font-weight: 600; }
.ca-mb-4      { margin-bottom: 16px; }
.ca-mb-6      { margin-bottom: 24px; }
.ca-divider   { border: none; border-top: 1px solid #e2e8f0; margin: 20px 0; }

/* -----------------------------------------------
   Responsive
   --------------------------------------------- */
@media (max-width: 1024px) {
    .ca-sidebar {
        transform: translateX(-100%);
        transition: transform 200ms ease;
    }

    .ca-sidebar.open {
        transform: translateX(0);
    }

    .ca-sidebar-overlay {
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity 200ms ease;
    }

    .ca-sidebar-overlay.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .ca-main { margin-left: 0; }
    .ca-topbar-toggle { display: flex; }
    .ca-stat-row { grid-template-columns: repeat(2, 1fr); }
    .ca-profile-grid { grid-template-columns: 1fr; }
    .ca-topbar { padding: 0 16px; justify-content: space-between; gap: 8px; }
    .ca-topbar-left { flex-shrink: 0; }
    .ca-topbar-right { gap: 6px; flex-shrink: 1; min-width: 0; justify-content: flex-end; }
    .ca-topbar-link { padding: 4px 6px; font-size: .75rem; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .theme-switch { margin-right: 4px !important; flex-shrink: 0; }
}

@media (max-width: 768px) {
    .ca-topbar-title { display: none; }
    .ca-content { padding: 16px; overflow-x: hidden; }
    .ca-page-header { flex-direction: column; align-items: stretch; gap: 12px; }
    .ca-stat-row { grid-template-columns: 1fr 1fr; }
    .ca-welcome-banner { flex-direction: column; align-items: flex-start; }
    .ca-download-grid { grid-template-columns: 1fr; }
    .ca-grid-2, .ca-grid-3 { grid-template-columns: 1fr; }
    .ca-auth-card { padding: 28px 20px; }
    .ca-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    .ca-table { display: block; width: 100%; }
    .ca-table tbody { display: block; width: 100%; }
    .ca-table thead { display: none; }
    .ca-table tbody tr { display: block; width: 100%; margin-bottom: 16px; border: 1px solid #e2e8f0; border-radius: 8px; }
    .ca-table tbody td {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        border-bottom: 1px solid rgba(226,232,240,.5);
        padding: 12px 16px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        gap: 4px;
        min-width: 0;
        word-break: break-word;
    }
    .ca-table tbody td > div,
    .ca-table tbody td > span,
    .ca-table tbody td > a {
        min-width: 0;
        overflow-wrap: break-word;
        word-break: break-word;
        width: 100%;
    }
    .ca-card {
        max-width: 100%;
    }
    .ca-card-top {
        flex-wrap: wrap;
        gap: 12px;
    }
    .ca-table tbody td:last-child { border-bottom: none; }
    .ca-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: .75rem;
        text-transform: uppercase;
        flex-shrink: 0;
        margin-bottom: 2px;
    }
}

@media (max-width: 480px) {
    .ca-stat-row { grid-template-columns: 1fr; }
}

/* -----------------------------------------------
   Dark Theme Overrides
   --------------------------------------------- */
[data-theme="dark"] .ca-page { background: #0d1117; }
[data-theme="dark"] .ca-sidebar { background: #010409; border-right: 1px solid rgba(255,255,255,0.08); }
[data-theme="dark"] .ca-sidebar-header { border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .ca-sidebar-user-name { color: #f0f6fc; }
[data-theme="dark"] .ca-sidebar-user-email { color: #8b949e; }
[data-theme="dark"] .ca-sidebar-section { color: #8b949e; }
[data-theme="dark"] .ca-sidebar-link { color: #8b949e; }
[data-theme="dark"] .ca-sidebar-link:hover { background: rgba(255,255,255,0.06); color: #f0f6fc; }
[data-theme="dark"] .ca-sidebar-link.active { background: rgba(56,189,248,0.15); color: #38bdf8; }
[data-theme="dark"] .ca-sidebar-footer { border-top-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .ca-topbar { background: #161b22; border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .ca-topbar-title { color: #f0f6fc; }
[data-theme="dark"] .ca-topbar-link { color: #8b949e; }
[data-theme="dark"] .ca-topbar-link:hover { background: rgba(255,255,255,0.06); color: #f0f6fc; border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .ca-topbar-toggle { color: #8b949e; }
[data-theme="dark"] .ca-page-header h1 { color: #f0f6fc; }
[data-theme="dark"] .ca-page-header p { color: #8b949e; }
[data-theme="dark"] .ca-card { background: #161b22; border-color: rgba(255,255,255,0.08); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
[data-theme="dark"] .ca-card-top { border-bottom-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .ca-card-top h3 { color: #f0f6fc; }
[data-theme="dark"] .ca-stat-card { background: #161b22; border-color: rgba(255,255,255,0.08); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
[data-theme="dark"] .ca-stat-value { color: #f0f6fc; }
[data-theme="dark"] .ca-stat-label { color: #8b949e; }
[data-theme="dark"] .ca-table thead th { background: rgba(255,255,255,0.03); color: #8b949e; border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .ca-table tbody td { color: #c9d1d9; border-bottom-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .ca-table tbody tr:hover { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .ca-empty h3 { color: #f0f6fc; }
[data-theme="dark"] .ca-empty p { color: #8b949e; }
[data-theme="dark"] .ca-download-card { background: #161b22; border-color: rgba(255,255,255,0.08); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
[data-theme="dark"] .ca-download-name { color: #f0f6fc; }
[data-theme="dark"] .ca-download-version { color: #8b949e; }
[data-theme="dark"] .ca-license-key { background: #0d1117; border-color: rgba(255,255,255,0.08); color: #c9d1d9; }
[data-theme="dark"] .ca-profile-header h1 { color: #f0f6fc; }
[data-theme="dark"] .ca-profile-header p { color: #8b949e; }
[data-theme="dark"] .ca-field label { color: #8b949e; }
[data-theme="dark"] .ca-input { background: #0d1117; border-color: rgba(255,255,255,0.1); color: #f0f6fc; }
[data-theme="dark"] .ca-input:focus { border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56,189,248,0.18); }
[data-theme="dark"] .ca-btn-outline { background: #161b22; border-color: rgba(255,255,255,0.1); color: #f0f6fc; }
[data-theme="dark"] .ca-btn-outline:hover { background: rgba(255,255,255,0.06); border-color: #38bdf8; color: #38bdf8; }
[data-theme="dark"] .ca-btn-ghost { color: #8b949e; }
[data-theme="dark"] .ca-btn-ghost:hover { background: rgba(255,255,255,0.06); color: #f0f6fc; }
[data-theme="dark"] .ca-btn { color: #f0f6fc; }
[data-theme="dark"] .ca-btn-primary { color: #ffffff; }
[data-theme="dark"] .ca-btn-danger { color: #ffffff; }
[data-theme="dark"] .ca-ticket-row { border-bottom-color: rgba(255,255,255,0.05); }
[data-theme="dark"] .ca-ticket-row:hover { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .ca-ticket-subject { color: #f0f6fc; }
[data-theme="dark"] .ca-ticket-meta { color: #8b949e; }
[data-theme="dark"] .ca-reply--client { background: rgba(56,189,248,0.08); }
[data-theme="dark"] .ca-reply--staff { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .ca-attachments { border-top-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .ca-attachments-title { color: #8b949e; }
[data-theme="dark"] .ca-attachment { background: #0d1117; border-color: rgba(255,255,255,0.1); color: #c9d1d9; }
[data-theme="dark"] .ca-attachment:hover { border-color: #38bdf8; background: rgba(56,189,248,0.06); color: #38bdf8; }
[data-theme="dark"] .ca-divider { border-top-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .theme-switch .slider { background: #374151 !important; }
[data-theme="dark"] .theme-switch input:checked + .slider { background: #14b8a6 !important; }
[data-theme="dark"] .theme-switch input:checked + .slider .toggle-circle { transform: translateX(20px); background-color: #0f172a !important; }

/* License Display overrides */
[data-theme="dark"] .ac-license-container { background: #0d1117; border-color: rgba(255,255,255,0.08); color: #c9d1d9; }
[data-theme="dark"] .ac-copy-btn { background: #161b22; border-color: rgba(255,255,255,0.08); color: #8b949e; }
[data-theme="dark"] .ac-copy-btn:hover { background: rgba(255,255,255,0.06); color: #f0f6fc; border-color: rgba(255,255,255,0.15); }
[data-theme="dark"] .ac-copy-btn::after { background: #c9d1d9; color: #0d1117; }
[data-theme="dark"] .ac-copy-btn::before { border-color: #c9d1d9 transparent transparent transparent; }


/* -----------------------------------------------
   Print
   --------------------------------------------- */
@media print {
    .ca-sidebar, .ca-topbar { display: none !important; }
    .ca-main { margin-left: 0; }
}

/* Client Area Breadcrumb Overrides */
.ca-main .breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--ca-text-muted, #64748b);
    margin-bottom: 20px;
}
.ca-main .breadcrumb a {
    color: var(--ca-primary, #0ea5e9);
    text-decoration: none;
    transition: color 0.2s;
}
.ca-main .breadcrumb a:hover {
    color: var(--ca-primary-hover, #0284c7);
    text-decoration: underline;
}
.ca-main .breadcrumb .separator {
    color: var(--ca-border, #e2e8f0);
}
.ca-main .breadcrumb .current {
    color: var(--ca-text, #0f172a);
    font-weight: 500;
}
[data-theme="dark"] .ca-main .breadcrumb .current {
    color: var(--ca-text, #e2e8f0);
}
[data-theme="dark"] .ca-main .breadcrumb .separator {
    color: var(--ca-border, #334155);
}

/* Select2 Overrides for .ca-input matching */
.select2-container--default .select2-selection--single {
    height: 42px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background-color: #ffffff;
    display: flex;
    align-items: center;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: normal;
    padding-left: 14px;
    padding-right: 36px;
    font-size: .875rem;
    color: #1e293b;
    font-family: inherit;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    right: 8px;
    top: 0;
    display: flex;
    align-items: center;
}
.select2-dropdown {
    border-color: #14b8a6;
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
    font-family: inherit;
    font-size: .875rem;
}
.select2-container--open .select2-selection--single {
    border-color: #14b8a6;
    box-shadow: 0 0 0 3px rgba(20,184,166,.18);
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #14b8a6;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
    border-radius: 6px;
    border: 1px solid #d1d5db;
    padding: 6px 10px;
    font-family: inherit;
    font-size: .875rem;
}
[data-theme="dark"] .select2-container--default .select2-selection--single {
    background-color: #0d1117;
    border-color: rgba(255,255,255,0.1);
}
[data-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #f0f6fc;
}
[data-theme="dark"] .select2-dropdown {
    background-color: #161b22;
    border-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: #0d1117;
    border-color: rgba(255,255,255,0.1);
    color: #f0f6fc;
}
[data-theme="dark"] .select2-container--default .select2-results__option[aria-selected=true] {
    background-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #38bdf8;
    color: #ffffff;
}
[data-theme="dark"] .select2-container--open .select2-selection--single {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56,189,248,.18);
}
