/* Ticsign — Estilos principais */
/* Tema Claro/Escuro/Dispositivo */

:root {
    color-scheme: light;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-sidebar: #f0f2f5;
    --bg-sidebar-hover: #e2e6eb;
    --bg-sidebar-active: #4361ee;
    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --text-sidebar: #5a6070;
    --text-sidebar-active: #ffffff;
    --text-sidebar-brand: #1a1a2e;
    --sidebar-border: #dce0e6;
    --sidebar-section-title: #8a8fa0;
    --border: #e2e8f0;
    --border-focus: #4361ee;
    --accent: #4361ee;
    --accent-hover: #3a56d4;
    --accent-light: #e8ecfd;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --logo-dark: #1e3a5f;
    --logo-light: #0ea5e9;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #0f0f1a;
    --bg-secondary: #161625;
    --bg-card: #1c1c30;
    --bg-input: #1c1c30;
    --bg-sidebar: #0a0a15;
    --bg-sidebar-hover: #161625;
    --bg-sidebar-active: #4361ee;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-sidebar: #94a3b8;
    --text-sidebar-active: #ffffff;
    --text-sidebar-brand: #ffffff;
    --sidebar-border: rgba(255,255,255,0.08);
    --sidebar-section-title: rgba(255,255,255,0.3);
    --border: #2d2d4a;
    --border-focus: #4361ee;
    --accent: #6366f1;
    --accent-hover: #5558e0;
    --accent-light: #1e1b4b;
    --success: #10b981;
    --success-light: #064e3b;
    --warning: #f59e0b;
    --warning-light: #78350f;
    --danger: #ef4444;
    --danger-light: #7f1d1d;
    --info: #3b82f6;
    --info-light: #1e3a5f;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.25);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.35);
    --logo-dark: #e2e8f0;
    --logo-light: #38bdf8;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── App Layout (Sidebar + Main) ── */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-sidebar-brand);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.sidebar-brand:hover { text-decoration: none; color: var(--text-sidebar-brand); }

.sidebar-brand svg { color: var(--accent); flex-shrink: 0; }

/* Logo SVG adaptativa para tema claro/escuro */
.logo-fill-dark { fill: var(--logo-dark); }
.logo-fill-light { fill: var(--logo-light); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

.sidebar-section {
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sidebar-section-title);
    padding: 0.75rem 0.75rem 0.35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-sidebar);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link:hover svg {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--sidebar-border);
    position: relative;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

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

.sidebar-user-name {
    color: var(--text-sidebar-brand);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    color: var(--text-sidebar);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-bottom-actions {
    display: flex;
    gap: 0.5rem;
}

.sidebar-bottom-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem;
    border-radius: var(--radius);
    border: 1px solid var(--sidebar-border);
    background: transparent;
    color: var(--text-sidebar);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.sidebar-bottom-btn:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.qr-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    animation: qrFadeIn 0.15s ease;
}

@keyframes qrFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.qr-popup-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    padding: 1.25rem;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,0.15));
    text-align: center;
    min-width: 220px;
}

.qr-popup-content img {
    display: block;
    margin: 0 auto 0.75rem;
}

.qr-popup-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.qr-popup-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Main Content Area ── */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ── */

.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.topbar-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.topbar-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-menu {
    position: relative;
}

.user-menu-btn {
    background: none;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    padding: 2px;
    transition: border-color 0.15s;
}
.user-menu-btn:hover {
    border-color: var(--border);
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 200;
    overflow: hidden;
}
.user-menu-dropdown.open {
    display: block;
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.user-menu-info {
    overflow: hidden;
}

.user-menu-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-email {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-divider {
    height: 1px;
    background: var(--border);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.1s;
    border: none;
    background: none;
    width: 100%;
}
.user-menu-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-decoration: none;
}

.user-menu-logout {
    color: var(--danger);
}
.user-menu-logout:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* ── Notification bell menu ── */
.notif-menu {
    position: relative;
}

.notif-bell-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: var(--text-secondary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.notif-bell-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 99px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    pointer-events: none;
}

.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: -40px;
    width: 360px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 200;
    overflow: hidden;
}
.notif-dropdown.open {
    display: block;
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.notif-dropdown-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.notif-mark-read-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: background 0.15s, color 0.15s;
}
.notif-mark-read-btn:hover {
    background: var(--bg-secondary);
    color: var(--accent);
}

.notif-dropdown-body {
    max-height: 340px;
    overflow-y: auto;
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: background 0.1s;
    border-left: 3px solid transparent;
}
.notif-item:hover {
    background: var(--bg-secondary);
    text-decoration: none;
}
.notif-item.unread {
    background: var(--bg-secondary);
    border-left-color: var(--accent);
}

.notif-item-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.notif-item-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.notif-item-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item-message {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--text-muted, var(--text-secondary));
    margin-top: 3px;
}

.notif-dropdown-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.notif-view-all {
    font-size: 0.82rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.notif-view-all:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .notif-dropdown {
        right: -16px;
        width: calc(100vw - 32px);
        max-width: 360px;
    }
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.25rem;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.45rem 0.85rem;
    max-width: 400px;
    flex: 1;
    transition: border-color 0.15s;
}

.search-box:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-box svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* ── Page Content ── */

.content {
    flex: 1;
    padding: 1.5rem;
    width: 100%;
}

/* Narrower content for standalone pages (login-like) */
.content-narrow {
    max-width: 600px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.15rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb svg { width: 14px; height: 14px; }

/* ── Cards ── */

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

/* ── Stats Grid ── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.blue { background: var(--info-light); color: var(--info); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: var(--accent-light); color: var(--accent); }

.stat-info { flex: 1; }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.65rem 1.5rem;
    font-size: 0.95rem;
}

.btn-icon {
    padding: 0.45rem;
    width: 36px;
    height: 36px;
    justify-content: center;
}

.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Tabs ── */

.tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--border);
    width: fit-content;
}
.tab {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .2s;
}
.tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}
.tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

/* ── Table ── */

.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
}

.table tbody tr {
    transition: background 0.1s;
}

.table tbody tr:hover {
    background: var(--bg-secondary);
}

.table td a {
    font-weight: 500;
}

/* ── Data Table (admin pages) ── */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-secondary);
}

.data-table tbody tr {
    transition: background 0.1s;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table td a {
    font-weight: 500;
    color: var(--accent);
}

/* ── Status badges ── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.3rem;
}

.badge-draft { background: var(--bg-secondary); color: var(--text-secondary); }
.badge-pending { background: var(--warning-light); color: #92400e; }
.badge-signing { background: var(--info-light); color: #1e40af; }
.badge-completed { background: var(--success-light); color: #065f46; }
.badge-cancelled { background: var(--danger-light); color: #991b1b; }
.badge-expired { background: #e2e3e5; color: #383d41; }
.badge-active { background: var(--success-light); color: #065f46; }
.badge-revoked { background: var(--danger-light); color: #991b1b; }

[data-theme="dark"] .badge-pending { color: var(--warning); }
[data-theme="dark"] .badge-signing { color: var(--info); }
[data-theme="dark"] .badge-completed { color: var(--success); }
[data-theme="dark"] .badge-cancelled { color: var(--danger); }
[data-theme="dark"] .badge-active { color: var(--success); }
[data-theme="dark"] .badge-revoked { color: var(--danger); }

/* ── Forms ── */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-inline {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

/* ── Filter tabs ── */

.filter-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover {
    background: var(--bg-secondary);
}

.filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ── Theme toggle ── */

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.4rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    transition: all 0.15s;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ── Upload area ── */

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-light);
}

/* ── Empty state ── */

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state p {
    margin-bottom: 0.5rem;
}

/* ── Notification toasts ── */

#notifications {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 380px;
}

.notification-success { background: var(--success); color: #fff; }
.notification-error { background: var(--danger); color: #fff; }
.notification-info { background: var(--info); color: #fff; }
.notification-warning { background: var(--warning); color: #fff; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Detail grid ── */

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 0.9rem;
}

/* ── Code/mono ── */

code {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── Toolbar ── */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Color swatch ── */

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    cursor: pointer;
}

.color-input {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ── Modal/Dialog ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* ── Sidebar overlay (mobile) ── */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
}

/* ── Responsive ── */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }
}

@media (max-width: 768px) {
    .content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .topbar {
        padding: 0 1rem;
    }

    .search-box {
        display: none;
    }

    .card {
        padding: 1rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .filter-tabs {
        gap: 0.2rem;
    }

    .filter-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
    }

    .table th, .table td {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }

    .data-table th, .data-table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .modal {
        width: 95%;
        padding: 1rem;
    }
}

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

    .content {
        padding: 0.75rem;
    }

    .page-title {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
    }

    .btn-lg {
        padding: 0.55rem 1rem;
        font-size: 0.875rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }
}

/* Drop Zone */
.drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.drop-zone:hover {
    border-color: var(--accent);
    background: var(--accent-light, #e8ecfd);
    color: var(--accent);
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light, #e8ecfd);
    color: var(--accent);
    transform: scale(1.01);
}

.drop-zone.uploading {
    opacity: 0.6;
    pointer-events: none;
}

.drop-zone-hint {
    font-size: 0.85rem;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.35rem 1rem;
    border-radius: 20px;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Sidebar Badge */
.sidebar-badge {
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 5px;
    margin-left: auto;
}

/* Badge types */
.badge-info {
    background: var(--accent-light, #e8ecfd);
    color: var(--accent);
}

.badge-success {
    background: var(--success-light, #d1fae5);
    color: var(--success);
}
