/* ═══════════════════════════════════════════════════════════════════════
   Wealth Manager — Modern UI Redesign
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ─────────────────────────────────────────────────── */
:root {
    --primary: #1677FF;
    --primary-hover: #0958d9;
    --primary-light: #e6f4ff;
    --primary-border: #91caff;
    --sidebar-bg: #0B2340;
    --sidebar-hover: #143458;
    --sidebar-active-bg: rgba(22, 119, 255, 0.15);
    --sidebar-text: rgba(255, 255, 255, 0.72);
    --sidebar-text-hover: #ffffff;
    --sidebar-width: 250px;
    --sidebar-collapsed: 0px;
    --header-height: 64px;
    --bg: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #E5EAF0;
    --border-light: #f1f3f6;
    --success: #22c55e;
    --success-bg: #f0fdf4;
    --success-text: #166534;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --transition: 0.2s ease;
    --z-sidebar: 1000;
    --z-overlay: 900;
    --z-header: 800;
}

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

/* ─── Typography & Base ────────────────────────────────────────────── */
html {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

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

img {
    max-width: 100%;
    height: auto;
}

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

/* ─── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* Sidebar Logo */
.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.sidebar-logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    display: flex;
    flex-direction: column;
}

.sidebar-logo .logo-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sidebar-logo .logo-subtitle {
    font-size: 11px;
    color: var(--sidebar-text);
    line-height: 1.3;
    margin-top: 1px;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255, 255, 255, 0.35);
    padding: 16px 14px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
}

.nav-item:hover {
    color: var(--sidebar-text-hover);
    background: var(--sidebar-hover);
    text-decoration: none;
}

.nav-item.active {
    color: #fff;
    background: var(--sidebar-active-bg);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
    font-size: 18px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

.nav-item .nav-label {
    flex: 1;
}

.nav-item .nav-badge {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

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

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.sidebar-version {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ─── Main Wrapper ──────────────────────────────────────────────────── */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Header ────────────────────────────────────────────────────────── */
.header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    flex-shrink: 0;
}

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

.hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    line-height: 1;
}

.hamburger:hover {
    background: var(--border-light);
}

.header-search {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    height: 38px;
    max-width: 360px;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
}

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

.header-search .search-icon {
    color: var(--text-muted);
    font-size: 16px;
    margin-right: 8px;
    flex-shrink: 0;
    line-height: 1;
}

.header-search input {
    border: none;
    background: none;
    outline: none;
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-primary);
    width: 100%;
    height: 100%;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    position: relative;
    line-height: 1;
}

.header-btn:hover {
    background: var(--border-light);
}

.header-btn .notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--card-bg);
}

.header-avatar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    margin-left: 4px;
}

.header-avatar:hover {
    background: var(--border-light);
}

.header-avatar .avatar-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.header-avatar .avatar-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.header-avatar .avatar-dropdown {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1;
}

/* ─── Main Content ──────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 28px 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ─── Breadcrumb ────────────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}

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

.breadcrumb .separator {
    color: var(--border);
    font-size: 12px;
}

.breadcrumb .current {
    color: var(--text-secondary);
    font-weight: 500;
}

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

.page-header-content h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    line-height: 1.3;
}

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

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ─── Summary Cards ─────────────────────────────────────────────────── */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.summary-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.summary-card .card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.summary-card .card-icon.blue {
    background: var(--primary-light);
    color: var(--primary);
}

.summary-card .card-icon.green {
    background: var(--success-bg);
    color: var(--success);
}

.summary-card .card-icon.orange {
    background: var(--warning-bg);
    color: var(--warning);
}

.summary-card .card-icon.gray {
    background: var(--border-light);
    color: var(--text-muted);
}

.summary-card .card-value {
    font-size: clamp(18px, 4vw, 26px);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 10px 0;
    word-break: break-word;
    overflow-wrap: break-word;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.summary-card .card-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 5px 0;
}

.summary-card .card-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* ─── Card Component ────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 0;
}

.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* Card stack spacing + padded variant */
.card + .card {
    margin-top: 20px;
}

.card--padded .card-body {
    padding: 18px 22px;
}

.card--padded .summary-cards {
    margin-bottom: 0;
}

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 20px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    height: 38px;
    text-decoration: none;
}

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

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

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

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

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

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: var(--danger-text);
}

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

.btn-outline-danger:hover {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
    height: 32px;
    border-radius: 6px;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 12px;
    height: 26px;
    border-radius: 5px;
}

/* ─── Tables ────────────────────────────────────────────────────────── */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
}

.data-table thead th {
    padding: 12px 18px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    background: var(--bg);
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table thead th:first-child {
    padding-left: 22px;
}

.data-table thead th:last-child {
    padding-right: 22px;
    text-align: right;
}

.data-table tbody tr {
    transition: background var(--transition);
}

.data-table tbody tr:hover td {
    background: #fafbfc;
}

.data-table tbody td {
    padding: 14px 18px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    white-space: nowrap;
}

.data-table tbody td:first-child {
    padding-left: 22px;
}

.data-table tbody td:last-child {
    padding-right: 22px;
}

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

/* Cell types */
.col-name-cell .asset-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.col-name-cell .asset-name a {
    color: var(--text-primary);
    text-decoration: none;
}

.col-name-cell .asset-name a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.col-name-cell .asset-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.col-actions-cell {
    text-align: right;
    white-space: nowrap;
}

.col-actions-cell .btn {
    margin-left: 6px;
}

.col-actions-cell .btn:first-child {
    margin-left: 0;
}

/* Number columns - allow wrapping and smaller font for large numbers */
.data-table tbody td.num {
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
    max-width: 120px;
}

/* ─── Badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-active {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge-active .badge-dot {
    background: var(--success);
}

.badge-inactive {
    background: var(--border-light);
    color: var(--text-muted);
}

.badge-inactive .badge-dot {
    background: var(--text-muted);
}

.badge-warning {
    background: var(--warning-bg);
    color: #b45309;
}

.badge-warning .badge-dot {
    background: var(--warning);
}

/* ─── Alert / Flash ─────────────────────────────────────────────────── */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: #bbf7d0;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: #fecaca;
}

.alert-info {
    background: var(--primary-light);
    color: #0050b3;
    border-color: var(--primary-border);
}

/* ─── Empty State ───────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 15px;
}

.empty-state .btn {
    margin-top: 12px;
}

/* ─── Forms ─────────────────────────────────────────────────────────── */
.form-card {
    max-width: 680px;
}

.form-group {
    margin-bottom: 18px;
}

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

.form-row .form-group {
    margin-bottom: 0;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    outline: none;
}

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

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

textarea.form-control {
    height: auto;
    padding: 12px 14px;
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.field-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-hint {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 5px;
}

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* ─── Detail Page ───────────────────────────────────────────────────── */
.detail-card {
    max-width: 780px;
}

.detail-header-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 24px 28px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.detail-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 200px;
}

.detail-asset-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}

.detail-asset-info h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 2px;
    color: var(--text-primary);
    line-height: 1.2;
}

.detail-asset-info .detail-type-line {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 6px;
}

.detail-asset-info .detail-type-line span {
    color: var(--text-muted);
}

.detail-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.detail-info-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 0;
    overflow: hidden;
}

.detail-info-card .info-section {
    padding: 20px 24px;
}

.detail-info-card .info-section + .info-section {
    border-top: 1px solid var(--border-light);
}

.detail-info-card .info-section h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 4px 16px;
}

.detail-row {
    display: contents;
}

.detail-row dt {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 7px 0;
    font-weight: 500;
}

.detail-row dd {
    font-size: 14px;
    color: var(--text-primary);
    padding: 7px 0;
    margin: 0;
}

.detail-notes {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.7;
    white-space: pre-wrap;
}

.detail-notes-empty {
    color: var(--text-muted);
    font-style: italic;
}

/* ─── Footer ────────────────────────────────────────────────────────── */
.app-footer {
    text-align: center;
    padding: 20px 32px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    background: var(--card-bg);
    flex-shrink: 0;
}

.app-footer p {
    margin: 0;
}

/* ─── Inline Form ───────────────────────────────────────────────────── */
.inline-form {
    display: inline;
}

/* ─── Asset Cards (Mobile List) ─────────────────────────────────────── */
.asset-cards-mobile {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.asset-card-item {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 16px;
}

.asset-card-item .card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.asset-card-item .card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.asset-card-item .card-info {
    flex: 1;
    min-width: 0;
}

.asset-card-item .card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.asset-card-item .card-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.asset-card-item .card-title a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.asset-card-item .card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.asset-card-item .card-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.asset-card-item .card-details .detail-unit {
    color: var(--text-muted);
    font-size: 12px;
}

.asset-card-item .card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.asset-card-item .card-actions .btn {
    flex: 1;
    justify-content: center;
}

.asset-card-item .card-actions .btn-more {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 18px;
}

.asset-card-item .card-actions .btn-more:hover {
    background: var(--border-light);
}

/* ─── Card Toolbar (filters/search above table) ─────────────────────── */
.card-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-search {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 320px;
}

.toolbar-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

.toolbar-search input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg);
    outline: none;
    transition: all var(--transition);
}

.toolbar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--card-bg);
}

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

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-select {
    height: 38px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--card-bg);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: not-allowed;
    opacity: 0.7;
    outline: none;
    transition: border-color var(--transition);
}

/* ─── Error Page ────────────────────────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 80px 20px;
}

.error-page h1 {
    font-size: 64px;
    color: var(--danger);
    margin-bottom: 8px;
    font-weight: 800;
}

.error-page p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ─── Code / Misc ───────────────────────────────────────────────────── */
code {
    background: var(--border-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

h1, h2, h3, h4 {
    margin-bottom: 12px;
    color: var(--text-primary);
}

p {
    margin-bottom: 12px;
}

/* ─── Asset Detail Page ─────────────────────────────────────────────── */

/* Info grid — label over value, 2 columns on desktop */
.asset-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 0;
    padding: 18px 22px 22px;
}

.asset-info-item {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}

.asset-info-item--wide {
    grid-column: 1 / -1;
}

.asset-info-item dt {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.asset-info-item dd {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.5;
}

/* Detail tables (purchase lots & transaction history) */
.table-detail thead th:last-child,
.table-detail tbody td:last-child {
    text-align: left;
}

.table-detail .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Tablet & Below (hide sidebar, show hamburger) ─────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .hamburger {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .header {
        padding: 0 16px;
    }

    .main-content {
        padding: 20px 16px;
    }

    .summary-cards {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .summary-card .card-value {
        font-size: clamp(16px, 3.5vw, 22px);
    }
}

/* ─── Mobile ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --header-height: 56px;
    }

    .header-search {
        display: none;
    }

    .header-right .header-btn:not(.header-avatar) {
        display: none;
    }

    .header-avatar .avatar-name,
    .header-avatar .avatar-dropdown {
        display: none;
    }

    .main-content {
        padding: 16px 12px;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
    }

    .page-header-content h1 {
        font-size: 20px;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
        justify-content: center;
    }

    /* Table → Card list */
    .data-table {
        display: none;
    }

    .asset-cards-mobile {
        display: flex;
    }

    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .summary-card {
        padding: 14px 16px;
    }

    .summary-card .card-value {
        font-size: clamp(14px, 3vw, 20px);
    }

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

    .form-card {
        max-width: 100%;
    }

    .detail-header-card {
        padding: 18px 20px;
        flex-direction: column;
    }

    .detail-header-right {
        width: 100%;
    }

    .detail-header-right .btn {
        flex: 1;
        justify-content: center;
    }

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

    .detail-row dt {
        padding: 4px 0 0;
        font-size: 12px;
    }

    .detail-row dd {
        padding: 0 0 8px;
    }

    .detail-info-card .info-section {
        padding: 16px 18px;
    }

    /* Asset detail: keep tables scrollable instead of hidden */
    .table-detail .data-table {
        display: table;
        min-width: 680px;
    }

    .asset-info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 16px 16px;
    }

    .card--padded .card-body {
        padding: 14px 16px;
    }

    .breadcrumb {
        font-size: 12px;
        margin-bottom: 12px;
    }

    .card-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-search {
        max-width: 100%;
    }

    .toolbar-filters {
        flex-wrap: wrap;
    }

    .toolbar-filters .filter-select {
        flex: 1;
        min-width: 120px;
    }

    .app-footer {
        padding: 16px;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .empty-state h3 {
        font-size: 18px;
    }
    
    .empty-state p {
        font-size: 14px;
    }
}

/* ─── Large Desktop ─────────────────────────────────────────────────── */
@media (min-width: 1440px) {
}
