:root {
    --bg: #101512;
    --surface: #171d19;
    --text: #e8ece8;
    --primary: #b86a2f;
    --primary-hover: #c8783b;
    --secondary: #4f6b5b;
    --border: #29332d;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--primary);
}

.sidebar-user {
    font-size: 0.75rem;
    color: var(--secondary);
    margin-top: 0.5rem;
    display: block;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
}

.sidebar-nav li a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--text);
    opacity: 0.7;
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    opacity: 1;
    color: var(--primary);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
    background: var(--bg);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
}

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

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

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}

.btn-secondary:hover {
    opacity: 0.9;
}

.btn-danger {
    background: #d63031;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.hidden {
    display: none;
}

.launch-form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.launch-form h3 {
    margin-bottom: 1rem;
}

.launch-form input[type="text"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg);
    color: var(--text);
}

.error-message {
    color: #d63031;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
}

.instance-list, .notification-list, .backup-list {
    background: var(--surface);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    overflow: hidden;
}

.loading, .empty-state, .error {
    padding: 2rem;
    text-align: center;
    color: var(--text);
    opacity: 0.7;
}

.error {
    color: #d63031;
    opacity: 1;
}

.instance-table {
    width: 100%;
    border-collapse: collapse;
}

.instance-table th {
    background: var(--surface);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
    opacity: 0.7;
    border-bottom: 1px solid var(--border);
}

.instance-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.instance-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-running {
    background: #00b894;
    color: #fff;
}

.status-provisioning {
    background: #fdcb6e;
    color: #2d3436;
}

.status-failed {
    background: #d63031;
    color: #fff;
}

.status-terminated {
    background: #636e72;
    color: #fff;
}

.status-suspended {
    background: #e17055;
    color: #fff;
}

.instance-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.instance-link:hover {
    text-decoration: underline;
}

.instance-detail {
    background: var(--surface);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    padding: 1.5rem;
}

.detail-card {
    margin-bottom: 1.5rem;
}

.detail-row {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.detail-label {
    width: 150px;
    font-weight: 600;
    color: var(--text);
    opacity: 0.7;
}

.detail-value {
    flex: 1;
}

.detail-actions {
    padding-top: 1rem;
}

.notification-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.notification-item.unread {
    background: rgba(184, 106, 47, 0.08);
}

.notification-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.notification-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
}

.notification-date {
    font-size: 0.75rem;
    color: var(--text);
    opacity: 0.5;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.notification-message {
    color: var(--text);
    opacity: 0.7;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.btn-logout {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text);
    opacity: 0.7;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-logout:hover {
    opacity: 1;
    border-color: var(--primary);
    color: var(--primary);
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.filter-bar label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    opacity: 0.7;
}

.filter-bar input[type="date"] {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    font-family: inherit;
}

.filter-bar input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-bar .btn {
    font-size: 0.8125rem;
    padding: 0.5rem 0.75rem;
}

.billing-content {
    background: var(--surface);
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    overflow: hidden;
}

.billing-card {
    padding: 2rem;
}

.billing-plan-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.billing-plan-header h2 {
    font-size: 1.5rem;
    color: var(--text);
}

.billing-plan-description {
    color: var(--text);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.billing-plan-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.billing-details {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-bottom: 1.5rem;
}

.billing-details .detail-row {
    display: flex;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.billing-details .detail-label {
    width: 150px;
    font-weight: 600;
    color: var(--text);
    opacity: 0.7;
}

.billing-details .detail-value {
    flex: 1;
}

.status-active {
    background: #00b894;
    color: #fff;
}

.status-canceled {
    background: #e17055;
    color: #fff;
}

.status-inactive {
    background: #636e72;
    color: #fff;
}

.billing-cancel-btn,
.billing-setup-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.billing-cancel-message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.billing-cancel-success {
    background: rgba(0, 184, 148, 0.15);
    color: #00b894;
    border: 1px solid rgba(0, 184, 148, 0.3);
}

.billing-cancel-error {
    background: rgba(214, 48, 49, 0.15);
    color: #d63031;
    border: 1px solid rgba(214, 48, 49, 0.3);
}

/* ───── Analytics Page ───── */

.analytics-content {
    background: transparent;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.analytics-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.analytics-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.analytics-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.analytics-card-body {
    padding: 1rem 1.25rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text);
    opacity: 0.7;
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
}

/* ───── Support Page ───── */

.support-content {
    background: transparent;
}

.support-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.support-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.support-card-danger {
    border-color: rgba(214, 48, 49, 0.3);
}

.support-card-wide {
    grid-column: 1 / -1;
}

.support-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.support-card-danger .support-card-header {
    border-bottom-color: rgba(214, 48, 49, 0.3);
}

.support-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.support-card-body {
    padding: 1.25rem;
}

.support-description {
    font-size: 0.875rem;
    color: var(--text);
    opacity: 0.7;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.support-actions {
    display: flex;
    gap: 0.75rem;
}

.support-actions .btn {
    flex: 1;
    text-align: center;
    text-decoration: none;
}

/* ───── Instance Card (My Instance page) ───── */

.instance-card {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.instance-card:last-child {
    border-bottom: none;
}

.instance-card .detail-row:last-child {
    border-bottom: none;
}
