@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&display=swap');

*,
*::after,
*::before {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Geist', sans-serif;
}

:root {
    --bg: #ffffff;
    --bg-subtle: #f9fafb;
    --bg-muted: #f3f4f6;
    --border: #e5e7eb;
    --border-focus: #111827;

    --text: #111827;
    --text-muted: #6b7280;
    --text-subtle: #9ca3af;

    --sidebar-bg: #111827;
    --sidebar-text: #d1d5db;
    --sidebar-muted: #6b7280;
    --sidebar-active-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-text: #ffffff;

    --primary: #111827;
    --primary-hover: #374151;
    --primary-text: #ffffff;

    --success-bg: #dcfce7;
    --success-text: #15803d;
    --success-border: #bbf7d0;

    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;
    --danger-border: #fecaca;

    --blue: #3b82f6;
    --green: #22c55e;
    --amber: #f59e0b;
    --purple: #a855f7;

    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    --sidebar-w: 240px;
    --topbar-h: 56px;
}

body.dark-theme {
    --bg: #09090b;
    --bg-subtle: #111113;
    --bg-muted: #18181b;
    --border: #27272a;
    --border-focus: #ffffff;

    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-subtle: #71717a;

    --sidebar-bg: #000000;
    --sidebar-text: #a1a1aa;
    --sidebar-muted: #52525b;
    --sidebar-active-bg: rgba(255, 255, 255, 0.06);
    --sidebar-active-text: #ffffff;

    --primary: #fafafa;
    --primary-hover: #e4e4e7;
    --primary-text: #09090b;

    --success-bg: rgba(34, 197, 94, 0.1);
    --success-text: #4ade80;
    --success-border: rgba(34, 197, 94, 0.2);

    --danger-bg: rgba(239, 68, 68, 0.1);
    --danger-text: #f87171;
    --danger-border: rgba(239, 68, 68, 0.2);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

html,
body {
    height: 100%;
}

body {
    background: var(--bg-subtle);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

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

.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon .material-symbols-rounded {
    font-size: 18px;
    color: #111827;
}

.logo-text {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--sidebar-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0 8px;
    margin-bottom: 8px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 450;
    color: var(--sidebar-text);
    transition: background 0.15s, color 0.15s;
}

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

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

.nav-icon {
    font-size: 18px;
    font-variation-settings: 'FILL' 0;
}

.nav-item.active .nav-icon {
    font-variation-settings: 'FILL' 1;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

.user-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.6875rem;
    color: var(--sidebar-muted);
}

.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.topbar {
    height: var(--topbar-h);
    flex-shrink: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
}

.breadcrumb-home {
    color: var(--text-muted);
}

.breadcrumb-sep {
    font-size: 16px;
    color: var(--text-subtle);
}

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

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

.topbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    position: relative;
    transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
    background: var(--bg-muted);
    color: var(--text);
}

.icon-btn .material-symbols-rounded {
    font-size: 20px;
}

.notif-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    border: 1.5px solid var(--bg);
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
}

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

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

.stat-icon .material-symbols-rounded {
    font-size: 22px;
}

.stat-icon--blue {
    background: #eff6ff;
    color: var(--blue);
}

.stat-icon--green {
    background: #f0fdf4;
    color: var(--green);
}

.stat-icon--amber {
    background: #fffbeb;
    color: var(--amber);
}

.stat-icon--purple {
    background: #faf5ff;
    color: var(--purple);
}

body.dark-theme .stat-icon--blue {
    background: rgba(59, 130, 246, 0.12);
}

body.dark-theme .stat-icon--green {
    background: rgba(34, 197, 94, 0.12);
}

body.dark-theme .stat-icon--amber {
    background: rgba(245, 158, 11, 0.12);
}

body.dark-theme .stat-icon--purple {
    background: rgba(168, 85, 247, 0.12);
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.stat-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 450;
    white-space: nowrap;
}

.table-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.table-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.table-card-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.table-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon-inner {
    position: absolute;
    left: 10px;
    font-size: 16px;
    color: var(--text-subtle);
    pointer-events: none;
}

.search-input {
    height: 36px;
    padding: 0 12px 0 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    width: 220px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

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

.search-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}

body.dark-theme .search-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.btn-primary {
    height: 36px;
    padding: 0 14px;
    background: var(--primary);
    color: var(--primary-text);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}

.btn-primary .material-symbols-rounded {
    font-size: 16px;
}

.btn-ghost {
    height: 36px;
    padding: 0 14px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 450;
    transition: background 0.15s, color 0.15s;
}

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

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

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

.table thead th {
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

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

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

.table tbody td {
    padding: 13px 16px;
    color: var(--text);
    vertical-align: middle;
}

.td-id {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-subtle);
    font-variant-numeric: tabular-nums;
}

.td-name {
    font-weight: 500;
    color: var(--text);
}

.td-brand {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 450;
    color: var(--text-muted);
    white-space: nowrap;
}

.td-category {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 450;
    color: #1d4ed8;
    white-space: nowrap;
}

body.dark-theme .td-category {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.td-price {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
}

.td-date {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.action-btns {
    display: flex;
    gap: 6px;
}

.btn-action {
    height: 30px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn-action .material-symbols-rounded {
    font-size: 14px;
}

.btn-edit {
    background: var(--bg-muted);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.btn-edit:hover {
    background: var(--bg);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.btn-delete {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
}

.btn-delete:hover {
    box-shadow: var(--shadow-sm);
    filter: brightness(0.95);
}

.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-icon {
    font-size: 40px;
    color: var(--text-subtle);
    margin-bottom: 12px;
}

.empty-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
}

.empty-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-subtle) 50%, var(--bg-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    height: 14px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.table-card-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
}

.footer-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    position: relative;
    z-index: 2;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px 24px 0;
    gap: 16px;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.modal-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: -4px;
    transition: background 0.15s, color 0.15s;
}

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

.modal-close .material-symbols-rounded {
    font-size: 18px;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px 24px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input {
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.form-group input::placeholder {
    color: var(--text-subtle);
}

.form-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}

body.dark-theme .form-group input:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--text);
    color: var(--bg);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 450;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 320px;
}

.toast.toast--success {
    background: #166534;
    color: #fff;
}

.toast.toast--error {
    background: #991b1b;
    color: #fff;
}

.toast .material-symbols-rounded {
    font-size: 18px;
    flex-shrink: 0;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(12px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(12px);
    }
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-subtle);
}

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

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

    .table-card-actions {
        width: 100%;
    }

    .search-input {
        width: 100%;
    }
}

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

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

    .sidebar {
        display: none;
    }

    .page-content {
        padding: 16px;
    }
}