
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #8b5cf6;
    --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #1a1744 100%);
    --bg: #f0f2f5;
    --surface: #fff;
    --border: #e0e0e0;
    --text: #333;
    --text-muted: #888;
    --danger: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    --radius: 10px;
    --shadow: 0 1px 4px rgba(0,0,0,.06);
    --sidebar-width: 240px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 13px; }

.layout { display: flex; height: 100vh; }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* Sidebar */
.sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); background: var(--sidebar-bg); color: #fff; display: flex; flex-direction: column; box-shadow: 2px 0 12px rgba(0,0,0,.15); }
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 12px; }
.sidebar-logo .logo-icon { width: 36px; height: 36px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; }
.sidebar-logo .logo-text { font-size: 14px; font-weight: 700; }
.sidebar-logo .logo-sub { font-size: 10px; opacity: .6; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.nav-section { padding: 12px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: rgba(255,255,255,.4); font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 20px; color: rgba(255,255,255,.7); text-decoration: none; font-size: 12.5px; font-weight: 500; transition: all .15s; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(124,58,237,.3); color: #fff; border-right: 3px solid var(--primary); }
.nav-icon { font-size: 14px; width: 20px; text-align: center; }

.sidebar-footer { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user { color: rgba(255,255,255,.7); font-size: 13px; margin-bottom: 4px; }
.sidebar-footer .logout { padding: 6px 0; font-size: 13px; }

/* Topbar */
.topbar { padding: 16px 32px; border-bottom: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: space-between; }
.topbar-title { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.topbar-greeting { font-size: 1rem; font-weight: 500; color: var(--text); }.topbar-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card h3 { font-size: 0.9rem; color: var(--text); margin-bottom: 1rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; box-shadow: var(--shadow); }
.stat-card:hover { border-color: var(--primary, #7c3aed); transition: border-color 0.2s; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); margin-top: 0.25rem; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.2rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 2px solid var(--border); font-size: 0.7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 600; }
td { padding: 0.5rem 0.75rem; border-bottom: 1px solid #f0f0f0; font-size: 0.82rem; }
td a { color: var(--primary); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }
code { background: #f5f5f5; padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; }

/* Badges */
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.badge-active { background: #d4edda; color: #155724; }
.badge-provisioning { background: #fff3cd; color: #856404; }
.badge-suspended { background: #f8d7da; color: #721c24; }
.badge-trial { background: #cce5ff; color: #004085; }
.badge-cancelled { background: #e2e3e5; color: #383d41; }
.badge-archived { background: #e0e7ff; color: #3730a3; }

/* Forms */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.78rem; font-weight: 500; color: #555; margin-bottom: 0.3rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.5rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem; font-family: inherit; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,.1); }
.form-group small { display: block; color: var(--text-muted); font-size: 0.78rem; margin-top: 0.25rem; }

/* Buttons */
.btn { display: inline-block; padding: 0.5rem 1rem; border-radius: 6px; font-size: 0.82rem; font-weight: 600; text-decoration: none; border: none; cursor: pointer; font-family: inherit; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f5f5f5; }

/* Alerts */
.alert { padding: 0.6rem 0.9rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.82rem; }
.alert-success { background: #d4edda; border: 1px solid #c3e6cb; color: #155724; }
.alert-error { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }

/* Detail grid */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.detail-grid .card dl { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; }
.detail-grid .card dt { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.detail-grid .card dd { font-size: 0.9rem; }

/* Lifecycle Steps */
.lifecycle-steps { display: flex; flex-direction: column; gap: 0; }
.lifecycle-step { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid #f0f0f0; }
.lifecycle-step:last-child { border-bottom: none; }
.step-indicator { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; margin-top: 0.1rem; }
.step-disabled { background: #f0f0f0; color: #bbb; }
.step-available { background: var(--primary); color: #fff; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2); }
.step-done { background: var(--success); color: #fff; }
.step-danger { background: var(--danger); box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2); }
.step-body { flex: 1; }
.step-label { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.step-desc { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.15rem; }
.lifecycle-step .step-disabled + .step-body .step-label { color: #bbb; }
.lifecycle-step .step-disabled + .step-body .step-desc { color: #ddd; }

/* Button variants */
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e67e22; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-active { background: var(--success); }
.dot-warning { background: var(--warning); }
.dot-danger { background: var(--danger); }
.dot-info { background: var(--primary); }
.timeline-label { font-weight: 600; font-size: 0.9rem; min-width: 100px; }
.timeline-date { color: var(--text-muted); font-size: 0.85rem; }

/* Archive table action buttons */
td .btn-sm + form, td .btn-sm + .btn-sm { margin-left: 0.4rem; }
td form { display: inline-block; }
@media (max-width: 900px) {
    td .btn-sm, td form .btn-sm { display: block; width: 100%; margin: 0.2rem 0; }
    td form { display: block; }
}

/* Billing badges */
.badge-pending { background: #fff3cd; color: #856404; }
.badge-paid { background: #d4edda; color: #155724; }
.badge-overdue { background: #f8d7da; color: #721c24; }
.badge-waived { background: #e2e3e5; color: #383d41; }
.badge-refunded { background: #cce5ff; color: #004085; }

/* Support badges */
.badge-open { background: #cce5ff; color: #004085; }
.badge-in_progress { background: #fff3cd; color: #856404; }
.badge-waiting { background: #e2e3e5; color: #383d41; }
.badge-resolved { background: #d4edda; color: #155724; }
.badge-closed { background: #e2e3e5; color: #383d41; }

/* Priority badges */
.priority-low { color: var(--text-muted); }
.priority-normal { color: var(--text); }
.priority-high { color: var(--warning); font-weight: 600; }
.priority-urgent { color: var(--danger); font-weight: 700; }
