:root {
    --brand: #6C3BFF;
    --brand-soft: #F5F1FF;
    --ink: #111827;
    --muted: #6B7280;
    --line: #E8EAF0;
    --canvas: #F7F8FB;
    --white: #FFFFFF;
    --success: #16A34A;
    --warning: #D97706;
    --danger: #DC2626;
    --blue: #2563EB;
    --sidebar-width: 248px;
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: var(--sidebar-width); flex-direction: column; border-right: 1px solid var(--line); background: var(--white); transition: transform .22s ease; }
.brand { display: flex; align-items: center; gap: 11px; height: 76px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.brand img { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; }
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 17px; }
.brand-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 18px 12px; overflow-y: auto; }
.nav-caption { margin: 8px 12px 9px; color: #9CA3AF; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 4px; padding: 0 12px; border-radius: 7px; color: #4B5563; font-weight: 650; }
.nav-link svg { width: 19px; height: 19px; stroke-width: 2; }
.nav-link:hover { background: #F8F7FF; color: var(--brand); }
.nav-link.active { background: var(--brand-soft); color: var(--brand); }
.nav-badge { margin-left: auto; padding: 2px 7px; border-radius: 10px; background: #FEE2E2; color: #B91C1C; font-size: 10px; }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--line); }
.support-box { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #FAFAFC; }
.support-box strong, .support-box span { display: block; }
.support-box strong { margin-bottom: 4px; font-size: 12px; }
.support-box span { color: var(--muted); font-size: 11px; line-height: 1.45; }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; height: 76px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.mobile-menu { display: none !important; }
.icon-button { position: relative; display: inline-grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: #4B5563; cursor: pointer; }
.icon-button:hover { border-color: #D5CAFF; color: var(--brand); }
.icon-button svg { width: 19px; height: 19px; }
.notice-dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border: 2px solid white; border-radius: 50%; background: #EC2B72; }
.search { position: relative; width: min(420px, 42vw); }
.search svg { position: absolute; top: 50%; left: 13px; width: 18px; height: 18px; color: #9CA3AF; transform: translateY(-50%); }
.search input { width: 100%; height: 40px; padding: 0 14px 0 41px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: #FAFAFC; color: var(--ink); }
.search input:focus { border-color: #B9A6FF; background: white; box-shadow: 0 0 0 3px #F1EDFF; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.admin-profile { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.admin-profile > svg { width: 16px; }
.profile-logout { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 7px; color: var(--muted); }
.profile-logout:hover { background: var(--brand-soft); color: var(--brand); }
.profile-logout svg { width: 17px; height: 17px; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--brand); color: white; font-size: 12px; font-weight: 800; }
.admin-copy strong, .admin-copy small { display: block; }
.admin-copy strong { font-size: 12px; }
.admin-copy small { margin-top: 2px; color: var(--muted); font-size: 10px; }

main { padding: 28px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-heading h1 { margin: 0; font-size: 25px; line-height: 1.2; }
.page-heading p { margin: 7px 0 0; color: var(--muted); }
.page-actions, .toolbar { display: flex; align-items: center; gap: 9px; }
.select, .button, .input { height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); color: var(--ink); }
.select { padding: 0 34px 0 12px; cursor: pointer; font-weight: 700; }
.input { padding: 0 12px; outline: none; }
.input:focus, textarea:focus { border-color: #B9A6FF; box-shadow: 0 0 0 3px #F1EDFF; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; font-weight: 700; cursor: pointer; }
.button svg { width: 17px; height: 17px; }
.button.primary { border-color: var(--brand); background: var(--brand); color: white; }
.button.danger { border-color: #FECACA; color: var(--danger); }
.button:hover { box-shadow: 0 4px 14px rgba(17,24,39,.08); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card, .panel { border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: 0 4px 18px rgba(17,24,39,.035); }
.stat-card { padding: 18px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stat-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.stat-icon svg { width: 20px; height: 20px; }
.stat-change { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 800; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }
.stat-label { margin-top: 16px; color: var(--muted); font-size: 12px; font-weight: 650; }
.stat-value { margin-top: 6px; font-size: 24px; font-weight: 800; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 18px; margin-bottom: 18px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .7fr); gap: 18px; }
.panel { min-width: 0; }
.panel + .panel { margin-top: 18px; }
.dashboard-grid .panel + .panel, .content-grid .panel + .panel, .lower-grid .panel + .panel { margin-top: 0; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 15px; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 18px; }
.text-link { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-size: 12px; font-weight: 750; }
.text-link svg { width: 15px; height: 15px; }

.chart-summary { display: flex; align-items: baseline; gap: 9px; margin-bottom: 18px; }
.chart-summary strong { font-size: 22px; }
.chart-summary span { color: var(--success); font-size: 11px; font-weight: 800; }
.bar-chart { display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 13px; height: 210px; padding: 12px 4px 0; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 51px, #F0F1F5 52px); }
.bar-item { display: flex; height: 100%; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; }
.bar { width: min(34px, 68%); min-height: 14px; border-radius: 5px 5px 0 0; background: var(--brand); }
.bar-item span { color: var(--muted); font-size: 10px; font-weight: 650; }
.service-list, .stack-list { display: grid; gap: 18px; }
.service-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.service-icon, .list-icon { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 7px; background: #F7F7FA; }
.service-icon svg, .list-icon svg { width: 17px; height: 17px; }
.service-name { flex: 1; min-width: 0; font-size: 12px; font-weight: 750; }
.service-count { color: var(--muted); font-size: 11px; font-weight: 700; }
.progress { height: 6px; overflow: hidden; border-radius: 6px; background: #EFF0F4; }
.progress span { display: block; height: 100%; border-radius: inherit; }

.table-panel { margin-bottom: 18px; }
.table-tools { display: flex; align-items: center; gap: 8px; }
.table-search { height: 34px; width: 200px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; outline: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 18px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: #FBFBFC; font-size: 10px; font-weight: 800; text-transform: uppercase; }
td { font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FCFBFF; }
.transaction-id, .link-text { color: var(--brand); font-weight: 800; }
.primary-cell strong, .primary-cell span { display: block; }
.primary-cell strong { font-size: 12px; }
.primary-cell span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.amount { font-weight: 800; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 12px; font-size: 10px; font-weight: 800; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ''; }
.status.success, .status.active, .status.verified, .status.resolved, .status.paid { background: #EAF8EE; color: var(--success); }
.status.pending, .status.review, .status.open { background: #FFF5DF; color: var(--warning); }
.status.failed, .status.blocked, .status.expired, .status.overdue { background: #FEECEC; color: var(--danger); }
.status.draft, .status.inactive, .status.processing { background: #EEF2FF; color: var(--blue); }

.lower-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.user-row, .activity-row, .detail-row { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.user-row:last-child, .activity-row:last-child, .detail-row:last-child { border-bottom: 0; }
.user-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 800; }
.row-info { flex: 1; min-width: 0; }
.row-info strong, .row-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-info strong { font-size: 12px; }
.row-info span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.row-meta { color: #9CA3AF; font-size: 10px; white-space: nowrap; }
.activity-icon { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 8px; }
.activity-icon svg { width: 18px; height: 18px; }
.purple { background: var(--brand-soft); color: var(--brand); }
.green { background: #EAF8EE; color: var(--success); }
.amber { background: #FFF5DF; color: var(--warning); }
.red { background: #FEECEC; color: var(--danger); }
.blue { background: #EFF6FF; color: var(--blue); }

.metric-strip { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 8px; background: white; margin-bottom: 18px; }
.metric-item { padding: 17px 18px; border-right: 1px solid var(--line); }
.metric-item:last-child { border-right: 0; }
.metric-item span { display: block; color: var(--muted); font-size: 11px; font-weight: 650; }
.metric-item strong { display: block; margin-top: 7px; font-size: 19px; }

.filter-bar { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.filter-bar .input { flex: 1; min-width: 160px; }
.filter-bar .select { min-width: 130px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field { display: grid; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 11px; font-weight: 800; }
.form-field small { color: var(--muted); font-size: 10px; }
.form-field input, .form-field select, .form-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; outline: none; background: white; color: var(--ink); }
.form-field input, .form-field select { height: 40px; padding: 0 12px; }
.form-field textarea { min-height: 96px; padding: 11px 12px; resize: vertical; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch-copy strong, .switch-copy span { display: block; }
.switch-copy strong { font-size: 12px; }
.switch-copy span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.switch { width: 42px; height: 24px; padding: 3px; border: 0; border-radius: 14px; background: #D1D5DB; cursor: pointer; }
.switch::after { display: block; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.2); content: ''; transition: transform .18s; }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(18px); }
.empty-state { display: none; padding: 30px; color: var(--muted); text-align: center; }
.overlay { position: fixed; inset: 0; z-index: 25; display: none; background: rgba(17,24,39,.35); }

.alert { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 16px; padding: 13px 15px; border: 1px solid; border-radius: 8px; background: white; }
.alert > svg { width: 19px; height: 19px; flex: 0 0 auto; }
.alert strong { display: block; margin-bottom: 5px; font-size: 12px; }
.alert ul { margin: 0; padding-left: 18px; font-size: 11px; line-height: 1.55; }
.success-alert { border-color: #BBE8C8; background: #F2FBF5; color: #15803D; }
.error-alert { border-color: #FECACA; background: #FFF7F7; color: #B91C1C; }
.coupon-list { display: grid; gap: 14px; padding: 16px; background: #FAFAFC; }
.coupon-editor { border: 1px solid var(--line); border-radius: 8px; background: white; }
.coupon-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.coupon-editor-head span, .coupon-editor-head small { display: block; }
.coupon-editor-head span { font-size: 12px; font-weight: 800; }
.coupon-editor-head small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.coupon-fields { padding: 15px; grid-template-columns: repeat(3, 1fr); }
.coupon-actions { display: flex; justify-content: space-between; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.coupon-table-panel { margin-top: 18px; }
.remove-coupon:disabled { cursor: not-allowed; opacity: .35; }

.login-body { min-height: 100vh; background: #F7F8FB; }
.login-layout { position: relative; display: grid; min-height: 100vh; grid-template-columns: minmax(360px, .9fr) minmax(440px, 1.1fr); padding: 18px; }
.login-brand-panel { position: relative; display: flex; min-height: calc(100vh - 36px); overflow: hidden; flex-direction: column; justify-content: space-between; padding: 42px; border-radius: 8px; background: #6C3BFF; color: white; }
.login-brand-panel::after { position: absolute; right: -100px; bottom: -135px; width: 390px; height: 390px; border: 90px solid rgba(255,255,255,.08); border-radius: 50%; content: ''; }
.login-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; width: fit-content; }
.login-brand img { width: 44px; height: 44px; border-radius: 8px; background: white; object-fit: cover; }
.login-brand strong, .login-brand small { display: block; }
.login-brand strong { font-size: 20px; }
.login-brand small { margin-top: 3px; color: rgba(255,255,255,.72); font-size: 11px; font-weight: 650; }
.login-message { position: relative; z-index: 1; max-width: 530px; }
.login-eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 22px; font-size: 12px; font-weight: 750; }
.login-eyebrow svg { width: 18px; height: 18px; }
.login-message h1 { max-width: 520px; margin: 0; font-size: clamp(42px, 5vw, 70px); line-height: 1.02; letter-spacing: 0; }
.login-message p { max-width: 480px; margin: 22px 0 0; color: rgba(255,255,255,.78); font-size: 15px; line-height: 1.7; }
.login-trust { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; max-width: 410px; padding: 16px; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; background: rgba(255,255,255,.1); }
.login-trust > svg { width: 22px; height: 22px; }
.login-trust strong, .login-trust small { display: block; }
.login-trust strong { font-size: 12px; }
.login-trust small { margin-top: 4px; color: rgba(255,255,255,.7); font-size: 10px; }
.login-form-side { display: grid; place-items: center; padding: 42px; }
.login-card { width: min(430px, 100%); }
.login-card-head { margin-bottom: 30px; }
.login-icon { display: grid; width: 46px; height: 46px; margin-bottom: 20px; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.login-icon svg { width: 23px; height: 23px; }
.login-card h2 { margin: 0; font-size: 30px; }
.login-card-head p { margin: 9px 0 0; color: var(--muted); }
.login-error { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; padding: 12px; border: 1px solid #FECACA; border-radius: 8px; background: #FFF7F7; color: #B91C1C; font-size: 11px; font-weight: 700; }
.login-error svg { width: 18px; height: 18px; flex: 0 0 auto; }
.login-form { display: grid; gap: 18px; }
.login-field { display: grid; gap: 8px; }
.login-field > span { font-size: 11px; font-weight: 800; }
.login-field > div { position: relative; }
.login-field div > svg { position: absolute; top: 50%; left: 14px; width: 18px; height: 18px; color: #9CA3AF; transform: translateY(-50%); }
.login-field input { width: 100%; height: 48px; padding: 0 46px 0 44px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: white; }
.login-field input:focus { border-color: #B9A6FF; box-shadow: 0 0 0 3px #F1EDFF; }
.login-field button { position: absolute; top: 50%; right: 7px; display: grid; width: 34px; height: 34px; place-items: center; border: 0; background: transparent; color: var(--muted); transform: translateY(-50%); cursor: pointer; }
.login-field button svg { width: 18px; height: 18px; }
.remember-row { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; font-weight: 650; }
.remember-row input { width: 16px; height: 16px; accent-color: var(--brand); }
.login-submit { display: flex; align-items: center; justify-content: space-between; height: 48px; padding: 0 17px; border: 0; border-radius: 8px; background: var(--brand); color: white; font-weight: 800; cursor: pointer; }
.login-submit:hover { background: #5D2EF0; box-shadow: 0 8px 24px rgba(108,59,255,.2); }
.login-submit svg { width: 18px; height: 18px; }
.login-help { margin: 24px 0 0; color: #9CA3AF; font-size: 10px; text-align: center; }
.login-footer { position: absolute; right: 28px; bottom: 22px; color: #9CA3AF; font-size: 10px; }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid, .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .login-layout { grid-template-columns: 1fr; padding: 0; }
    .login-brand-panel { min-height: auto; padding: 28px; border-radius: 0; }
    .login-message { margin: 62px 0 52px; }
    .login-message h1 { font-size: 44px; }
    .login-trust { display: none; }
    .login-form-side { padding: 48px 24px 72px; }
    .login-footer { right: 0; bottom: 20px; width: 100%; text-align: center; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .overlay.show { display: block; }
    .workspace { margin-left: 0; }
    .mobile-menu { display: inline-grid !important; }
    .search { flex: 1; width: auto; }
    .admin-copy { display: none; }
    main { padding: 22px 18px; }
    .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .login-brand-panel { padding: 22px; }
    .login-message { margin: 45px 0 32px; }
    .login-message h1 { font-size: 36px; }
    .login-message p { margin-top: 14px; font-size: 13px; }
    .login-form-side { align-items: start; padding: 34px 20px 72px; }
    .login-card h2 { font-size: 26px; }
    .topbar { gap: 9px; height: 68px; padding: 0 14px; }
    .search { display: none; }
    main { padding: 18px 12px; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .page-actions { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
    .page-actions > :only-child { grid-column: 1 / -1; }
    .stats-grid { grid-template-columns: 1fr; gap: 10px; }
    .stat-card { padding: 15px; }
    .table-tools { display: none; }
    .panel-header { padding: 0 14px; }
    .panel-body { padding: 14px; }
    .row-meta { display: none; }
    .metric-strip { grid-template-columns: 1fr; }
    .metric-item { border-right: 0; border-bottom: 1px solid var(--line); }
    .metric-item:last-child { border-bottom: 0; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .filter-bar .select { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .form-field.full { grid-column: auto; }
    .coupon-fields { grid-template-columns: 1fr; }
    .coupon-actions { align-items: stretch; flex-direction: column; }
}
