/* ===== Premium theme layer (overrides base styles) ===== */
:root {
  --font: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bg: #F5F4EF;
  --border: #E9EAE4;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(20, 35, 27, .04), 0 2px 8px -4px rgba(20, 35, 27, .06);
  --shadow: 0 1px 2px rgba(20, 35, 27, .05), 0 12px 28px -12px rgba(20, 35, 27, .18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 30, 22, .35);
  --ornament: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220' fill='none' stroke='%23C6A15B' stroke-opacity='.35'%3E%3Ccircle cx='110' cy='110' r='100'/%3E%3Ccircle cx='110' cy='110' r='78' stroke-dasharray='2 6'/%3E%3Ccircle cx='110' cy='110' r='56'/%3E%3Ccircle cx='110' cy='110' r='30' stroke-dasharray='1 4'/%3E%3Cg%3E%3Cpath d='M110 10 Q130 60 110 110 Q90 60 110 10Z'/%3E%3Cpath d='M110 210 Q130 160 110 110 Q90 160 110 210Z'/%3E%3Cpath d='M10 110 Q60 90 110 110 Q60 130 10 110Z'/%3E%3Cpath d='M210 110 Q160 90 110 110 Q160 130 210 110Z'/%3E%3Cpath d='M39 39 Q85 70 110 110 Q70 85 39 39Z'/%3E%3Cpath d='M181 181 Q135 150 110 110 Q150 135 181 181Z'/%3E%3Cpath d='M181 39 Q150 85 110 110 Q135 70 181 39Z'/%3E%3Cpath d='M39 181 Q70 135 110 110 Q85 150 39 181Z'/%3E%3C/g%3E%3C/svg%3E");
}
body { background: var(--bg); letter-spacing: -0.005em; }
.main { background: radial-gradient(1200px 380px at 70% -120px, rgba(198,161,91,.10), transparent 70%); min-height: 100vh; }

/* Sidebar */
.sidebar { background: linear-gradient(185deg, #1B3D30 0%, #132B21 55%, #0F241B 100%); box-shadow: 1px 0 0 rgba(255,255,255,.04); overflow: clip; }
.sidebar::after { content: ''; position: absolute; width: 300px; height: 300px; left: -90px; bottom: -110px; background: var(--ornament) center/contain no-repeat; opacity: .35; pointer-events: none; }
.sidebar > * { position: relative; z-index: 1; }
.brand-mark { border-radius: 12px; box-shadow: 0 6px 18px -6px rgba(198,161,91,.6), inset 0 0 0 1px rgba(255,255,255,.35); }
.login-brand .brand-mark { align-self: flex-start; position: relative; }
.brand-mark.lg { width: 72px; height: 72px; font-size: 38px; border-radius: 18px; }
.nav-item { border-radius: 10px; padding: 10px 12px; color: #BFCDC5; }
.nav-item.active { background: linear-gradient(90deg, rgba(198,161,91,.24), rgba(198,161,91,.04)); color: #fff; box-shadow: inset 0 0 0 1px rgba(198,161,91,.18); }
.nav-item.active::before { left: -10px; top: 9px; bottom: 9px; width: 4px; background: linear-gradient(#E2C485, #A9853F); }
.nav-section { color: rgba(198,161,91,.55); }
.sidebar-tour { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 10px; padding: 10px 12px; border-radius: 10px; border: 1px dashed rgba(198,161,91,.45); background: rgba(198,161,91,.08); color: #E8D4A6; font: 600 12.5px var(--font); cursor: pointer; transition: background .15s; white-space: nowrap; }
.sidebar-tour:hover { background: rgba(198,161,91,.16); }
.sidebar-tour svg { width: 17px; height: 17px; flex: 0 0 17px; }
body.sidebar-collapsed .sidebar-tour span { display: none; }
body.sidebar-collapsed .sidebar-tour { justify-content: center; }

/* Topbar */
.topbar { background: rgba(255,255,255,.78); border-bottom: 1px solid rgba(233,234,228,.9); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset; }
.global-search input { border-radius: 12px; background: #F4F4EF; border-color: transparent; padding-right: 40px; }
.global-search input:focus { box-shadow: 0 0 0 4px rgba(36,75,58,.08); }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: #fff; color: var(--muted); font: 600 11px var(--font); }
.global-search > .kbd { position: absolute; right: 10px; top: 10px; }
.profile-btn { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border: 1px solid var(--border); background: #fff; border-radius: 999px; cursor: pointer; color: var(--muted); }
.profile-btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.profile-btn > svg { width: 15px; height: 15px; }
.profile-head { display: flex; gap: 10px; align-items: center; padding: 10px 11px 6px; }
.profile-menu { min-width: 290px; }

/* Role chips */
.role-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; background: var(--primary-50); color: var(--primary); }
.role-chip.sm { height: 19px; font-size: 10px; padding: 0 7px; }
.role-chip[data-role="Admin"] { background: linear-gradient(135deg, #F6E8C8, #EBD5A2); color: #6E5320; }
.role-chip[data-role="Manager"] { background: #E3EEF7; color: #2F6690; }
.role-chip[data-role="Sales Staff"] { background: #E7F4EC; color: #2E7D4F; }
.role-chip[data-role="Inventory Staff"] { background: #F0EBF7; color: #6B4E9B; }

/* Page header */
.page-title { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: 0; line-height: 1.1; color: #1B3328; }
.page-title .mono { font-family: var(--font); font-size: 18px; color: var(--muted); }
.page-title .badge { vertical-align: middle; }
.page-subtitle { margin-top: 4px; }

/* Cards */
.card { border-color: var(--border); box-shadow: var(--shadow-sm); }
.card-header { padding: 16px 20px; }
.card-title { font-size: 15px; font-weight: 700; }
.card-title svg { width: 18px; height: 18px; }

/* Buttons */
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { background: linear-gradient(180deg, #2B5845, #20473A); border-color: #1D4133; box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 4px 12px -4px rgba(36,75,58,.5); }
.btn-primary:hover { background: linear-gradient(180deg, #24503E, #1A3B2E); }
.btn-gold { background: linear-gradient(180deg, #D4B271, #BF9850); border-color: #B48D45; color: #23180A; box-shadow: 0 4px 12px -4px rgba(169,133,63,.55); }

/* KPI cards */
.kpi { position: relative; overflow: hidden; border-radius: 16px; padding: 18px 18px 16px; transition: transform .18s, box-shadow .18s; }
.kpi::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--kpi-c, var(--primary)); opacity: .9; }
.kpi::after { content: ''; position: absolute; right: -40px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%; background: var(--kpi-c, var(--primary)); opacity: .05; }
.kpi[onclick]:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi:not([onclick]) { cursor: default; }
.kpi-icon { width: 40px; height: 40px; border-radius: 12px; }
.kpi-icon svg { width: 19px; height: 19px; }
.kpi-value { font-size: 27px; font-weight: 800; letter-spacing: -0.03em; color: #172B21; }
.kpi-label { font-weight: 600; }
.kpi-green { --kpi-c: #2E7D4F; } .kpi-gold { --kpi-c: #C6A15B; } .kpi-red { --kpi-c: #B4423A; } .kpi-blue { --kpi-c: #2F6690; }
.kpi-orange { --kpi-c: #B7791F; } .kpi-purple { --kpi-c: #6B4E9B; } .kpi-dark { --kpi-c: #244B3A; }

/* Welcome banner */
.welcome { background: linear-gradient(115deg, #17362A 0%, #244B3A 55%, #2E5C48 100%); border-radius: 20px; padding: 26px 30px; box-shadow: 0 20px 40px -24px rgba(19,42,32,.7); }
.welcome::after { border: none; width: 300px; height: 300px; right: -40px; top: -70px; background: var(--ornament) center/contain no-repeat; opacity: .7; }
.welcome h2 { font-size: 34px; }

/* Tables */
.table th { background: transparent; font-size: 11px; letter-spacing: .08em; border-bottom: 1px solid var(--border); }
.table tbody tr:hover { background: #FBF9F3; }
.table td { border-bottom-color: #F0F0EB; }

/* Tabs / segments */
.tab.active { color: var(--primary); border-bottom-width: 3px; }
.seg { background: #EFEFEA; }

/* Modals & dropdowns */
.modal-backdrop { background: rgba(14, 28, 21, .5); backdrop-filter: blur(3px); }
.modal { border-radius: 20px; }
.modal-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.dropdown-menu { border-radius: 14px; }

/* Gallery */
.p-card { border-radius: 16px; }
.p-price { font-size: 16px; }

/* Access denied */
.denied .empty-state { padding: 70px 20px; }
.denied-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; background: var(--gold-50); color: var(--gold-600); }
.denied-icon svg { width: 32px; height: 32px; color: inherit; margin: 0; }

/* Permission matrix */
.perm-table td, .perm-table th { padding: 9px 14px; }
.perm-table .perm-group td { background: var(--surface-2); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-600); }
.switch input:disabled + span { opacity: .55; cursor: not-allowed; }

/* ===== Login screen ===== */
.login-screen { position: fixed; inset: 0; z-index: 300; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); animation: fadeIn .25s ease; }
.login-screen.leaving { opacity: 0; transition: opacity .25s; }
.login-brand { position: relative; overflow: hidden; background: linear-gradient(160deg, #1B3D30, #0F241B); color: #fff; padding: 64px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.login-ornament { position: absolute; width: 560px; height: 560px; right: -180px; bottom: -180px; background: var(--ornament) center/contain no-repeat; opacity: .55; }
.login-brand h1 { font-family: var(--font-display); font-size: 48px; font-weight: 700; line-height: 1.05; margin-top: 10px; position: relative; }
.login-brand p { color: #C9D9CF; font-size: 16px; margin: 0; position: relative; }
.login-points { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; position: relative; }
.login-points li { display: flex; align-items: center; gap: 12px; color: #E2EBE5; }
.login-points svg { width: 18px; height: 18px; color: var(--gold); }
.login-panel { display: grid; place-items: center; padding: 32px; overflow-y: auto; }
.login-card { width: 100%; max-width: 460px; }
.login-card h2 { font-family: var(--font-display); font-size: 36px; font-weight: 700; color: #1B3328; }
.login-card > p { margin: 6px 0 20px; }
.login-list { display: grid; gap: 10px; }
.login-user { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: #fff; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.login-user:hover { border-color: var(--gold); box-shadow: var(--shadow); transform: translateY(-1px); }
.lu-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }

/* ===== Tour ===== */
.tour-root { position: fixed; inset: 0; z-index: 500; }
.tour-blocker { position: fixed; inset: 0; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(10, 24, 17, .58), 0 0 0 3px rgba(198,161,91,.9), 0 0 30px 6px rgba(198,161,91,.35); transition: all .32s cubic-bezier(.4,.1,.2,1); pointer-events: none; }
.tour-pop { position: fixed; width: 360px; max-width: calc(100vw - 24px); background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); padding: 16px 18px 14px; transition: left .32s cubic-bezier(.4,.1,.2,1), top .32s cubic-bezier(.4,.1,.2,1), opacity .2s; }
.tour-pop.loading { opacity: .6; }
.tour-pop.center { width: 440px; }
.tour-pop.nudge { animation: nudge .35s; }
@keyframes nudge { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.tour-pop::before { content: ''; position: absolute; width: 14px; height: 14px; background: #fff; transform: rotate(45deg); border-radius: 3px; display: none; }
.tour-pop.place-bottom::before { display: block; top: -6px; left: calc(var(--ax) - 7px); }
.tour-pop.place-top::before { display: block; bottom: -6px; left: calc(var(--ax) - 7px); }
.tour-pop.place-right::before { display: block; left: -6px; top: calc(var(--ay) - 7px); }
.tour-pop.place-left::before { display: block; right: -6px; top: calc(var(--ay) - 7px); }
.tour-head { display: flex; justify-content: space-between; align-items: center; }
.tour-step { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-600); }
.tour-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: #1B3328; margin: 2px 0 6px; line-height: 1.15; }
.tour-body { color: #4B554E; font-size: 13.5px; line-height: 1.6; }
.tour-progress { height: 4px; background: #EFEFEA; border-radius: 4px; margin: 14px 0 12px; overflow: hidden; }
.tour-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--gold)); border-radius: 4px; transition: width .3s; }
.tour-foot { display: flex; justify-content: space-between; align-items: center; }
.tour-next { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tour-offer { position: fixed; left: calc(var(--sidebar-w) + 24px); bottom: 24px; z-index: 150; display: flex; gap: 14px; width: 380px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 16px; box-shadow: var(--shadow-lg); animation: slideUp .3s ease; }
.tour-offer.leaving { opacity: 0; transform: translateY(10px); transition: .25s; }
.tour-offer-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #E2C485, #A9853F); color: #fff; }
.tour-offer-icon svg { width: 22px; height: 22px; }
.tour-menu { min-width: 300px; }
.tour-item { align-items: flex-start; }
.tour-item.disabled { opacity: .45; cursor: not-allowed; }

body.sidebar-collapsed .tour-offer { left: calc(var(--sidebar-w-collapsed) + 24px); }
@media (max-width: 900px) {
  .tour-offer, body.sidebar-collapsed .tour-offer { left: 16px; bottom: 90px; }
  .login-screen { grid-template-columns: 1fr; overflow-y: auto; }
  .login-brand { padding: 32px 24px; }
  .login-brand h1 { font-size: 34px; }
  .login-points { display: none; }
  .page-title { font-size: 26px; }
}
