:root {
    --sidebar: #0f172a;
    --sidebar-soft: #1e293b;
    --surface: #ffffff;
    --line: #e2e8f0;
    --ink: #0f172a;
    --muted: #64748b;
    --accent: #10b981;
    --accent-dark: #059669;
    --accent-light: #d1fae5;
    --accent-2: #f59e0b;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f8fafc;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6, .brand strong {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* Auth Layout */
.auth-body {
    align-items: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    min-height: 100vh;
}

.auth-shell {
    margin: 0 auto;
    max-width: 440px;
    padding: 24px;
    width: 100%;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-card h1 {
    font-size: 32px;
    margin: 24px 0 8px;
    color: var(--sidebar);
}

.login-card .text-muted {
    margin-bottom: 32px;
    display: block;
}

/* App Shell */
.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-is-collapsed .app-shell,
.app-shell.collapsed {
    grid-template-columns: 84px minmax(0, 1fr);
}

.sidebar {
    background: var(--sidebar);
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 1px solid var(--sidebar-soft);
    overflow-x: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle {
    background: var(--sidebar-soft);
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
    margin-bottom: 24px;
    transition: all 0.2s;
}

.sidebar-toggle:hover {
    background: var(--accent);
    color: white;
}

.app-shell.collapsed .sidebar-toggle {
    margin-left: 0;
    margin-right: auto;
}

.app-shell.collapsed .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 16px;
}

.sidebar-is-collapsed .brand div,
.sidebar-is-collapsed .nav-link span,
.sidebar-is-collapsed .nav-group-label,
.sidebar-is-collapsed .sidebar-user strong,
.sidebar-is-collapsed .sidebar-user small,
.app-shell.collapsed .brand div,
.app-shell.collapsed .nav-link span,
.app-shell.collapsed .nav-group-label,
.app-shell.collapsed .sidebar-user strong,
.app-shell.collapsed .sidebar-user small {
    display: none;
}

.app-shell.collapsed .nav-link {
    justify-content: center;
    padding: 12px;
}

.app-shell.collapsed .nav-link i {
    margin: 0;
}

.app-shell.collapsed .sidebar-user {
    padding: 8px;
    justify-content: center;
}

.app-shell.collapsed .sidebar-user .btn-link {
    display: none;
}

.brand {
    align-items: center;
    color: #ffffff;
    display: flex;
    gap: 16px;
    margin-bottom: 48px;
    text-decoration: none;
}

.brand:hover {
    color: #ffffff;
    transform: scale(1.02);
}

.brand-mark {
    align-items: center;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    border-radius: var(--radius-md);
    color: #ffffff;
    display: inline-flex;
    font-weight: 800;
    height: 48px;
    justify-content: center;
    width: 48px;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
    font-size: 20px;
}

.brand strong {
    font-size: 20px;
    display: block;
}

.brand small {
    color: #94a3b8;
    display: block;
    font-size: 13px;
    font-weight: 400;
}

.sidebar .nav-link {
    align-items: center;
    border-radius: var(--radius-md);
    color: #94a3b8;
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
    font-weight: 500;
    text-decoration: none;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.sidebar .nav-link.active {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.sidebar .nav-link i {
    font-size: 20px;
}

.sidebar-user {
    align-items: center;
    background: var(--sidebar-soft);
    border-radius: var(--radius-md);
    display: flex;
    gap: 12px;
    margin-top: auto;
    padding: 16px;
}

.user-avatar {
    align-items: center;
    background: var(--accent);
    border-radius: var(--radius-sm);
    color: #ffffff;
    display: flex;
    flex: 0 0 40px;
    font-weight: 700;
    height: 40px;
    justify-content: center;
    width: 40px;
    font-family: 'Outfit';
}

/* Main Panel */
.main-panel {
    padding: 40px;
}

.topbar {
    margin-bottom: 0px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.topbar h1 {
    font-size: 36px;
    margin: 0;
    color: var(--sidebar);
}

.topbar-date {
    background: var(--surface);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 14px;
    font-weight: 500;
}

/* Cards */
.metric-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 40px;
}

.metric-card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, transparent 0%, rgba(16, 185, 129, 0.05) 100%);
    border-radius: 0 0 0 100%;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.metric-card span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 12px;
}

.metric-card strong {
    font-size: 28px;
    color: var(--sidebar);
    display: block;
}

.metric-card i {
    background: var(--accent-light);
    color: var(--accent-dark);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 24px;
}

.panel-card {
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.section-title {
    margin-bottom: 24px;
}

.section-title h2 {
    font-size: 22px;
    color: var(--sidebar);
}

/* Tables */
.table {
    --bs-table-hover-bg: #f8fafc;
}

.table thead th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px;
    border: none;
}

.table tbody td {
    padding: 16px;
    border-color: #f1f5f9;
    vertical-align: middle;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    font-weight: 600;
    border-radius: var(--radius-md);
}

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

.btn-primary:hover {
    background: #1e293b;
    border-color: #1e293b;
}

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

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

/* POS Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 440px;
    gap: 32px;
}

.product-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding-right: 8px;
}

.product-button {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: left;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-button:hover:not(:disabled) {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
    transform: translateY(-2px);
}

.product-button strong {
    font-size: 16px;
    margin-bottom: 4px;
    color: var(--sidebar);
}

.product-button small {
    color: var(--muted);
    font-size: 13px;
}

/* Status Pills */
.status-pill {
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
}

.status-ok { background: var(--accent-light); color: var(--accent-dark); }
.status-low { background: #fef3c7; color: #92400e; }
.status-empty { background: #fee2e2; color: #991b1b; }

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media (max-width: 1400px) {
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1100px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { height: auto; position: relative; border-right: none; border-bottom: 1px solid var(--sidebar-soft); }
    .pos-layout { grid-template-columns: 1fr; }
    .main-panel { padding: 24px; }
}

@media (max-width: 640px) {
    .metric-grid { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 16px; }
}
