:root {
    --primary: #C8A96A;
    --primary-hover: #B8924E;
    --primary-light: rgba(200, 169, 106, 0.12);
    --primary-focus: rgba(200, 169, 106, 0.2);

    --secondary: #070608;
    --secondary-elevated: #121014;
    --secondary-muted: #1A181C;

    --background: #F8FAFC;
    --surface: #FFFFFF;

    --text: #111827;
    --text-secondary: #6B7280;
    --text-on-dark: #FFFFFF;
    --text-muted-on-dark: rgba(255, 255, 255, 0.55);

    --border: #E5E7EB;
    --border-dark: rgba(255, 255, 255, 0.08);

    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    --radius-card: 12px;
    --radius-btn: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.12);
    --transition: 180ms ease;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --motion-duration: 0.45s;
}

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

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--background);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
}

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

.sidebar {
    width: 260px;
    background: var(--secondary);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
    border-right: 1px solid var(--border-dark);
}

.sidebar-brand {
    padding: 28px 24px 24px;
    border-bottom: 1px solid var(--border-dark);
}

.sidebar-brand a {
    display: block;
}

.brand-logo {
    display: block;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 14px rgba(200, 169, 106, 0.22));
}

.brand-logo-sidebar {
    max-width: 100%;
    max-height: 52px;
}

.brand-logo-auth {
    max-width: 300px;
    width: 100%;
    margin: 0 auto;
}

.sidebar-tagline {
    display: block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
    margin-top: 12px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-btn);
    color: var(--text-muted-on-dark);
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 4px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-on-dark);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: inset 3px 0 0 var(--primary);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-dark);
}

.sidebar-footer form button {
    background: none;
    border: none;
    color: var(--text-muted-on-dark);
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    font-family: inherit;
    transition: color var(--transition);
}

.sidebar-footer form button:hover {
    color: var(--primary);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text);
}

.page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.search-form {
    position: relative;
    width: 320px;
    max-width: 100%;
}

.search-form input {
    width: 100%;
    padding: 9px 14px 9px 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--background);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-form svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

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

.notifications-widget {
    position: relative;
}

.notifications-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    background: var(--background);
    color: var(--text);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.notifications-trigger:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.notifications-trigger svg {
    width: 18px;
    height: 18px;
}

.notifications-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
    z-index: 100;
}

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

.notifications-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.notifications-mark-all {
    border: none;
    background: none;
    color: var(--primary-hover);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
}

.notifications-mark-all:hover {
    text-decoration: underline;
}

.notifications-list {
    max-height: 360px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item-content {
    flex: 1;
    min-width: 0;
}

.notification-item-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.notification-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.notification-item-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    align-items: stretch;
}

.notification-item-actions .btn {
    width: 100%;
    justify-content: center;
}

.notification-item-actions form {
    margin: 0;
    width: 100%;
}

.notifications-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
}

.notifications-empty svg {
    width: 28px;
    height: 28px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.notifications-empty p {
    margin: 0;
    font-size: 13px;
}

.badge-tarea { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-default { background: rgba(107, 114, 128, 0.1); color: var(--text-secondary); }

.content-area {
    padding: 32px;
    flex: 1;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
}

.card-body {
    padding: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.card-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
}

.stat-card .label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

.stat-card .icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stat-card .icon.gold {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card .icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.stat-card .icon.green {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.stat-card .icon.amber {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-btn);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: #000000;
    border-color: var(--primary);
    font-weight: 600;
}

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

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

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

.btn-danger {
    background: var(--surface);
    color: var(--danger);
    border-color: var(--danger);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn.is-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.92;
}

.btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btnSpin 0.65s linear infinite;
    flex-shrink: 0;
}

.btn-primary .btn-spinner {
    border-color: rgba(0, 0, 0, 0.12);
    border-top-color: #000;
}

.btn-secondary .btn-spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--text);
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

form.is-submitting .form-control {
    opacity: 0.65;
    pointer-events: none;
}

form.is-submitting .form-check {
    opacity: 0.65;
    pointer-events: none;
}

[hidden],
.is-wizard-hidden {
    display: none !important;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

/* File input */
.file-input {
    position: relative;
}

.file-input-native {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-input-zone {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-card);
    background: var(--background);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.file-input-zone:hover,
.file-input-zone:focus-within,
.file-input-zone.is-dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.file-input.has-file .file-input-zone {
    border-style: solid;
    border-color: var(--primary);
    background: var(--surface);
}

.file-input-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-btn);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--primary);
    transition: all var(--transition);
}

.file-input-zone:hover .file-input-icon,
.file-input.has-file .file-input-icon,
.file-input-zone.is-dragover .file-input-icon {
    background: var(--primary-light);
    border-color: var(--primary);
}

.form-group .file-input {
    margin-top: 4px;
}

.file-input-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-input-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

.file-input-name {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-input.has-file .file-input-name {
    color: var(--text);
    font-weight: 500;
}

.file-input-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-top: 2px;
}

.file-input-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 10px 18px;
    border-radius: var(--radius-btn);
    background: var(--primary);
    color: #000000 !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    border: 1px solid var(--primary);
    transition: background var(--transition), border-color var(--transition);
}

.file-input-zone:hover .file-input-btn,
.file-input-zone:focus-within .file-input-btn,
.file-input-zone.is-dragover .file-input-btn,
.file-input.has-file .file-input-btn {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #000000 !important;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.form-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

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

table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    background: var(--background);
}

table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tr:hover td {
    background: rgba(248, 250, 252, 0.8);
}

table tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-nuevo, .badge-pendiente { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-en_proceso { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-esperando_audiencia { background: rgba(168, 85, 247, 0.1); color: #9333ea; }
.badge-apelacion { background: rgba(236, 72, 153, 0.1); color: #db2777; }
.badge-finalizado, .badge-finalizada { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.badge-archivado { background: rgba(107, 114, 128, 0.1); color: var(--text-secondary); }
.badge-baja { background: rgba(107, 114, 128, 0.1); color: var(--text-secondary); }
.badge-media { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-alta { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-audiencia { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-reunion { background: rgba(59, 130, 246, 0.1); color: var(--info); }
.badge-recordatorio { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-vencimiento { background: rgba(168, 85, 247, 0.1); color: #9333ea; }

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-card);
    margin-bottom: 24px;
    font-size: 14px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

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

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.page-header p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

/* List items */
.list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.list-item-meta {
    font-size: 13px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

/* Calendar */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-name {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px;
    text-transform: uppercase;
}

.calendar-day {
    min-height: 80px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.calendar-day.other-month {
    opacity: 0.4;
}

.calendar-day.today {
    border-color: var(--primary);
    background: var(--primary-light);
}

.calendar-day-number {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.calendar-event-dot {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: var(--primary-light);
    color: var(--primary-hover);
}

/* Auth */
.auth-body {
    background: var(--secondary);
}

.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-brand-panel {
    position: relative;
    background: #070608;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 48px;
    border-right: 1px solid var(--border-dark);
}

.auth-brand-panel-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    width: 100%;
    max-width: 380px;
}

.auth-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.brand-logo-auth {
    max-width: 300px;
    width: 100%;
    margin: 0 auto;
    filter: drop-shadow(0 8px 28px rgba(200, 169, 106, 0.28));
}

.auth-tagline {
    margin: 20px 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.5;
}

.auth-brand-extra {
    margin-top: 36px;
}

.auth-benefits {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
}

.auth-benefit {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: border-color 0.2s, transform 0.2s;
}

.auth-benefit:hover {
    border-color: rgba(200, 169, 106, 0.35);
    transform: translateX(4px);
}

.auth-benefit-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-benefit-icon svg {
    width: 18px;
    height: 18px;
}

.auth-benefit-text {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.4;
}

@keyframes authBrandIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-brand-in {
    animation: authBrandIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: var(--auth-delay, 0ms);
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand-in {
        animation: none;
    }

    .auth-benefit:hover {
        transform: none;
    }
}

.auth-form-panel {
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-card);
    padding: 40px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.auth-card--wide {
    max-width: 640px;
}

.auth-form-subtitle {
    margin: -12px 0 24px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.auth-card .form-group label {
    color: var(--text);
}

.auth-form-title {
    margin: 0 0 28px;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.auth-card .btn-primary {
    width: 100%;
    padding: 12px 18px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
}

.auth-links a {
    color: var(--primary-hover);
    font-weight: 600;
}

.auth-links a:hover {
    color: var(--primary);
}

.auth-card--register {
    max-width: 520px;
    padding: 44px 40px;
}

.auth-links--register {
    margin-top: 24px;
}

.auth-links--muted {
    margin-top: 12px;
}

.auth-links--muted a {
    font-weight: 500;
    color: var(--text-secondary);
}

.auth-links--muted a:hover {
    color: var(--primary-hover);
}

.form-group--inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.auth-link-inline {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary-hover);
    white-space: nowrap;
}

.auth-link-inline:hover {
    color: var(--primary);
}

/* Registration wizard */
.register-wizard .wizard-header {
    margin-bottom: 28px;
    text-align: center;
}

.register-wizard .auth-form-title {
    margin-bottom: 8px;
    font-size: 24px;
}

.register-wizard .auth-form-subtitle {
    margin: 0;
}

.wizard-progress {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    margin-bottom: 32px;
    padding: 0 8px;
}

.wizard-progress-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: 72px;
    position: relative;
    z-index: 1;
}

.wizard-progress-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--text-secondary);
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.wizard-progress-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.wizard-progress-item.is-active .wizard-progress-dot {
    background: var(--primary);
    border-color: var(--primary);
    color: #111;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.wizard-progress-item.is-active .wizard-progress-label {
    color: var(--primary-hover);
}

.wizard-progress-item.is-done .wizard-progress-dot {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-hover);
}

.wizard-progress-line {
    flex: 1;
    min-width: 32px;
    max-width: 64px;
    height: 2px;
    background: var(--border);
    margin-top: 17px;
    transition: background var(--transition);
}

.wizard-progress-item.is-done + .wizard-progress-line,
.wizard-progress-line:has(+ .wizard-progress-item.is-active),
.wizard-progress-line:has(+ .wizard-progress-item.is-done) {
    background: var(--primary);
}

.wizard-panel-lead {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.wizard-panel-meta {
    margin: -8px 0 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.wizard-panel-meta strong {
    color: var(--primary-hover);
}

.wizard-trial-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 8px 14px;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary-hover);
    font-size: 13px;
    font-weight: 600;
}

.wizard-trial-badge svg {
    width: 16px;
    height: 16px;
}

.wizard-actions {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-top: 32px;
}

.wizard-actions-primary {
    flex: 1;
    min-width: 0;
}

.wizard-actions-primary .btn-primary {
    width: 100%;
}

.btn-wizard-back {
    flex: 0 0 auto;
    min-width: 100px;
    align-self: stretch;
}

.auth-card--register .wizard-actions .btn-primary {
    width: 100%;
    padding: 13px 18px;
    font-size: 15px;
}

.wizard-actions [data-wizard-submit]:not([hidden]):not(.is-wizard-hidden) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.label-optional {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 12px;
}

.access-type-grid--stack {
    grid-template-columns: 1fr;
}

.access-type-card--large {
    position: relative;
    padding: 20px;
}

.access-type-card--large .access-type-icon {
    width: 44px;
    height: 44px;
}

.access-type-card--large:hover {
    border-color: var(--primary);
}

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

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

    .wizard-progress-label {
        font-size: 10px;
    }

    .wizard-progress-line {
        max-width: 24px;
    }
}

/* Detail view */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.detail-item label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-item p {
    margin: 0;
    font-size: 15px;
}

.actions-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar .form-control {
    width: auto;
    min-width: 180px;
}

.pagination {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    margin: 0;
    list-style: none;
    padding: 0;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.pagination-info {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--background);
    border-radius: 0 0 var(--radius-card) var(--radius-card);
}

.pagination li.disabled span {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination li a,
.pagination li span {
    display: block;
    padding: 8px 14px;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border);
    font-size: 13px;
    background: var(--surface);
    transition: all var(--transition);
}

.pagination li a:hover {
    border-color: var(--primary);
    color: var(--primary-hover);
}

.pagination li.active span {
    background: var(--primary);
    color: #000000;
    border-color: var(--primary);
    font-weight: 600;
}

.pagination li.disabled span {
    background: var(--background);
}

.document-preview {
    max-height: 600px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
}

.document-preview img {
    display: block;
    margin: 0 auto;
}

.document-preview iframe {
    width: 100%;
    height: 600px;
    border: none;
}

.profile-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-card);
    object-fit: cover;
    border: 1px solid var(--border);
}

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

/* Responsive */
@media (max-width: 768px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-brand-panel {
        padding: 36px 24px 28px;
        background: #070608;
        border-right: none;
        border-bottom: 1px solid var(--border-dark);
    }

    .brand-logo-auth {
        max-width: 240px;
    }

    .auth-tagline {
        margin-top: 14px;
        font-size: 15px;
    }

    .auth-brand-extra {
        margin-top: 24px;
    }

    .auth-benefits {
        gap: 8px;
    }

    .auth-benefit {
        padding: 12px 14px;
    }

    .auth-form-panel {
        padding: 24px 16px 32px;
    }

    .auth-card {
        padding: 28px 24px;
        box-shadow: none;
        border: none;
        background: transparent;
    }

    .auth-form-panel {
        background: var(--surface);
    }

    .auth-card--register {
        padding: 28px 20px;
    }

    .wizard-progress-item {
        min-width: 56px;
    }

    .wizard-progress-label {
        font-size: 10px;
    }

    .wizard-progress-line {
        min-width: 20px;
        max-width: 32px;
    }

    .sidebar {
        transform: translateX(-100%);
    }

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

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

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

    .menu-toggle {
        display: block;
    }

    .topbar {
        padding: 12px 16px;
    }

    .content-area {
        padding: 16px;
    }

    .search-form {
        width: 100%;
    }

    .topbar-right {
        width: 100%;
        order: 3;
    }

    .notifications-dropdown {
        right: 0;
        left: auto;
    }

    .topbar {
        flex-wrap: wrap;
    }

    .file-input-zone {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 20px;
    }

    .file-input-icon {
        width: 44px;
        height: 44px;
    }

    .file-input-body {
        gap: 8px;
    }

    .file-input-btn {
        width: 100%;
        margin-top: 4px;
        padding: 12px 18px;
    }
}

/* Modals & toast notifications */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(7, 6, 8, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transform: translateY(12px) scale(0.98);
    transition: transform var(--transition);
}

.modal-overlay.is-open .modal-dialog {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 22px 0;
    position: relative;
}

.modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-icon-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.modal-icon-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.modal-icon-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.modal-icon-info {
    background: var(--primary-light);
    color: var(--primary-hover);
}

.modal-title {
    margin: 8px 0 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    padding-right: 28px;
}

.modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
    background: var(--background);
    color: var(--text);
}

.modal-body {
    padding: 12px 22px 22px 76px;
}

.modal-message {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 22px 22px;
}

.toast-stack {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(420px, calc(100vw - 40px));
    pointer-events: none;
}

.toast-popup {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: var(--surface);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    animation: toast-in 280ms ease forwards;
}

.toast-popup.is-leaving {
    animation: toast-out 220ms ease forwards;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(24px);
    }
}

.toast-popup-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-popup-body {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.toast-popup-title {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.toast-popup-message {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.toast-popup-close {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-popup-close:hover {
    background: var(--background);
    color: var(--text);
}

.toast-popup--success .toast-popup-icon {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.toast-popup--error .toast-popup-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.toast-popup--info .toast-popup-icon {
    background: var(--primary-light);
    color: var(--primary-hover);
}

.toast-popup--warning .toast-popup-icon {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

/* Inline notice (replaces alert banners) */
.notice-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-card);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.notice-banner-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notice-banner-content {
    flex: 1;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.55;
    padding-top: 6px;
}

.notice-banner-content strong {
    color: var(--text);
}

.notice-banner--info .notice-banner-icon {
    background: var(--primary-light);
    color: var(--primary-hover);
}

.notice-banner--warning .notice-banner-icon {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

@media (max-width: 640px) {
    .modal-body {
        padding-left: 22px;
    }

    .modal-body-full {
        padding-left: 22px;
    }

    .toast-stack {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

/* Access type selector */
.access-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.access-type-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.access-type-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.access-type-card.is-selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.access-type-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary-hover);
    display: flex;
    align-items: center;
    justify-content: center;
}

.access-type-title {
    font-weight: 600;
    color: var(--text);
}

.access-type-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.modal-dialog-lg {
    max-width: 520px;
}

.modal-body-full {
    padding: 12px 22px 22px;
}

.credentials-box {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    overflow: hidden;
}

.credentials-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.credentials-row:last-child {
    border-bottom: none;
}

.credentials-label {
    width: 90px;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.credentials-value {
    flex: 1;
    font-size: 14px;
    color: var(--text);
    word-break: break-all;
}

@media (max-width: 640px) {
    .access-type-grid {
        grid-template-columns: 1fr;
    }

    .credentials-row {
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   Motion — fluid UI animations
   ========================================================================== */

@keyframes motionFadeUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes motionFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes motionSlideInRight {
    from {
        opacity: 0;
        transform: translateX(18px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes motionScaleIn {
    from {
        opacity: 0;
        transform: scale(0.97);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Auth — login & register */
.motion-enabled .auth-form-panel .auth-card {
    animation: motionSlideInRight 0.55s var(--ease-out) 0.08s both;
}

.motion-enabled .auth-benefit {
    opacity: 0;
    animation: motionFadeUp 0.45s var(--ease-out) forwards;
}

.motion-enabled .auth-benefit:nth-child(1) { animation-delay: 0.26s; }
.motion-enabled .auth-benefit:nth-child(2) { animation-delay: 0.34s; }
.motion-enabled .auth-benefit:nth-child(3) { animation-delay: 0.42s; }
.motion-enabled .auth-benefit:nth-child(4) { animation-delay: 0.5s; }

.motion-enabled .wizard-panel--enter {
    animation: motionFadeUp 0.35s var(--ease-out) both;
}

.motion-enabled .wizard-progress-dot {
    transition: background 0.3s var(--ease-out), border-color 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}

.motion-enabled .wizard-progress-item.is-active .wizard-progress-dot {
    transform: scale(1.06);
}

.motion-enabled .access-type-card {
    transition: border-color 0.2s, box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.motion-enabled .access-type-card:hover {
    transform: translateY(-2px);
}

/* App — layout & navigation */
.motion-enabled .motion-content {
    animation: motionFadeIn 0.35s var(--ease-out) both;
}

.motion-enabled .motion-nav-item {
    opacity: 0;
    animation: motionFadeUp 0.4s var(--ease-out) both;
    animation-delay: var(--motion-delay, 0ms);
}

.motion-enabled .sidebar-overlay {
    transition: opacity 0.25s var(--ease-out), visibility 0.25s;
}

.motion-enabled .sidebar {
    transition: transform 0.3s var(--ease-out);
}

/* Scroll reveal */
.motion-reveal {
    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 0.5s var(--ease-out),
        transform 0.5s var(--ease-out);
    transition-delay: var(--motion-delay, 0ms);
}

.motion-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Cards & stats */
.motion-enabled .stat-card {
    transition: box-shadow 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.motion-enabled .stat-card:hover {
    transform: translateY(-3px);
}

.motion-enabled .card {
    transition: box-shadow 0.25s var(--ease-out);
}

.motion-enabled .motion-table-row {
    opacity: 0;
    animation: motionFadeUp 0.35s var(--ease-out) both;
    animation-delay: var(--motion-delay, 0ms);
}

.motion-enabled .table tbody tr {
    transition: background 0.15s var(--ease-out);
}

/* Forms & buttons */
.motion-enabled .form-control {
    transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.motion-enabled .form-control:focus {
    transform: translateY(-1px);
}

.motion-enabled .btn {
    transition: background 0.18s var(--ease-out), border-color 0.18s var(--ease-out), transform 0.15s var(--ease-out), box-shadow 0.18s var(--ease-out);
}

.motion-enabled .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(200, 169, 106, 0.28);
}

.motion-enabled .btn:active:not(:disabled) {
    transform: scale(0.98);
}

.motion-enabled .nav-item {
    transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}

.motion-enabled .nav-item:hover {
    transform: translateX(3px);
}

.motion-enabled .nav-item.active {
    transform: translateX(2px);
}

/* Modals & toasts — smoother */
.motion-enabled .modal-overlay {
    transition: opacity 0.25s var(--ease-out), visibility 0.25s;
}

.motion-enabled .modal-dialog {
    transition: transform 0.3s var(--ease-out), opacity 0.25s var(--ease-out);
    transform: translateY(16px) scale(0.97);
    opacity: 0;
}

.motion-enabled .modal-overlay.is-open .modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.motion-enabled .toast-popup {
    animation: motionToastIn 0.35s var(--ease-out) forwards;
}

@keyframes motionToastIn {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.motion-enabled .notifications-dropdown {
    animation: motionScaleIn 0.22s var(--ease-out) both;
    transform-origin: top right;
}

/* Reduced motion */
.motion-reduced *,
.motion-reduced *::before,
.motion-reduced *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

.motion-reduced .motion-reveal {
    opacity: 1;
    transform: none;
}
