/* ── Global ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #0f1117;
    color: #e2e8f0;
    line-height: 1.5;
    font-size: 15px;
}

body { min-height: 100vh; }

a { color: #8b5cf6; text-decoration: none; }
a:hover { color: #c4b5fd; }

hr {
    border: none;
    border-top: 1px solid rgba(139, 92, 246, 0.12);
    margin: 1.5rem 0;
}

code {
    background: rgba(139, 92, 246, 0.1);
    color: #c4b5fd;
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.9em;
}

h1 {
    background: linear-gradient(135deg, #c4b5fd, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

h2, h3 {
    color: #c4b5fd;
    font-weight: 600;
}

h2 { font-size: 1.4rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }

/* ── Layout ────────────────────────────────────────────── */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: linear-gradient(180deg, #1a1c2e 0%, #151725 100%);
    border-right: 1px solid rgba(139, 92, 246, 0.15);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
}

.sidebar-brand {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #c4b5fd;
    padding: 0 8px 20px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.12);
    margin-bottom: 16px;
    text-decoration: none;
}

.sidebar-brand:hover {
    color: #e2e8f0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 16px;
}

.sidebar-user img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-handle {
    color: #94a3b8;
    font-size: 0.8rem;
}

.sidebar-wallet {
    padding: 6px 8px;
    margin-bottom: 16px;
    color: #94a3b8;
    font-size: 0.8rem;
    font-family: monospace;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.sidebar-nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.sidebar-nav a:hover {
    background: rgba(139, 92, 246, 0.1);
    color: #e2e8f0;
}

.sidebar-nav a.active {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(139, 92, 246, 0.12);
}

/* ── Breadcrumbs ───────────────────────────────────────── */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.breadcrumbs a {
    color: #94a3b8;
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: #c4b5fd;
}

.breadcrumb-sep {
    color: #475569;
}

.breadcrumb-current {
    color: #e2e8f0;
    font-weight: 500;
}

.main {
    flex: 1;
    margin-left: 260px;
    padding: 32px 40px;
}

.main-content {
    width: 85%;
    max-width: 1400px;
    margin: 0 auto;
}

.full-width {
    margin-left: 0;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
    background: linear-gradient(145deg, #1e2035, #1a1c2e);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.25s ease;
}

.card:hover {
    border-color: rgba(139, 92, 246, 0.35);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: #e2e8f0;
}

/* ── Metrics ───────────────────────────────────────────── */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric {
    background: linear-gradient(145deg, #1e2035, #1a1c2e);
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 12px;
    padding: 16px 20px;
}

.metric-label {
    color: #94a3b8;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.metric-value {
    color: #e2e8f0;
    font-weight: 700;
    font-size: 1.5rem;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: transparent;
    color: #e2e8f0;
    text-decoration: none;
}

.btn:hover {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
    transform: translateY(-1px);
    color: #e2e8f0;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    border-color: transparent;
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}

.btn-twitter {
    background: linear-gradient(135deg, #1d9bf0, #0c7abf);
    border-color: transparent;
    color: white;
    padding: 14px 36px;
    border-radius: 12px;
    font-size: 15px;
}

.btn-twitter:hover {
    box-shadow: 0 8px 24px rgba(29, 155, 240, 0.3);
    color: white;
}

.btn-danger {
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-danger:hover {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.btn-amber {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: transparent;
    color: white;
}

.btn-amber:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.3);
    color: white;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Forms ──────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: rgba(15, 17, 23, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    color: #e2e8f0;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    accent-color: #8b5cf6;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.form-check label {
    color: #e2e8f0;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.form-hint {
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* ── Badges ────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-live {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-paused {
    background: rgba(148, 163, 184, 0.1);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.badge-nosub {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

/* ── Alerts ────────────────────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.alert-info {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* ── Toggle Switch ─────────────────────────────────────── */
.toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #334155;
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #e2e8f0;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: #8b5cf6;
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ── Table ─────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.12);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

thead th {
    background: rgba(139, 92, 246, 0.08);
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-top: 1px solid rgba(139, 92, 246, 0.06);
    color: #e2e8f0;
}

tbody tr:hover {
    background: rgba(139, 92, 246, 0.04);
}

/* ── Nav Cards (home) ──────────────────────────────────── */
.nav-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.nav-card {
    display: block;
    padding: 24px;
    background: linear-gradient(145deg, #1e2035, #1a1c2e);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px;
    transition: all 0.25s ease;
    cursor: pointer;
    min-height: 120px;
    text-decoration: none;
}

.nav-card:hover {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.12);
    transform: translateY(-2px);
    color: inherit;
}

.nav-card-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.nav-card h3 {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    color: #e2e8f0;
}

.nav-card p {
    color: #94a3b8;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ── Sale Row ──────────────────────────────────────────── */
.sale-row {
    padding: 14px 18px;
    background: linear-gradient(145deg, #1e2035, #1a1c2e);
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.sale-row-name {
    font-weight: 600;
    color: #e2e8f0;
}

.sale-row-project {
    color: #94a3b8;
}

.sale-row-price {
    font-weight: 600;
    color: #c4b5fd;
}

.sale-row-usd {
    color: #64748b;
    margin: 0 6px;
}

.sale-row-meta {
    color: #64748b;
    font-size: 0.8rem;
}

/* ── Toast ─────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: toast-in 0.3s ease-out;
    max-width: 400px;
}

.toast-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}

.toast-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.toast-info {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #c4b5fd;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ── Modal ─────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modal-fade-in 0.15s ease-out;
}

.modal {
    background: #1a1c2e;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 14px;
    padding: 28px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal h3 {
    color: #f87171;
    margin-bottom: 12px;
}

.modal p {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

.modal .project-name-confirm {
    color: #e2e8f0;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Project Card ──────────────────────────────────────── */
.project-card {
    margin-bottom: 16px;
}

.project-card .card {
    padding: 0;
}

.project-card-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.project-card-header:hover {
    background: rgba(139, 92, 246, 0.04);
}

.project-card-body {
    padding: 0 20px 20px;
    border-top: 1px solid rgba(139, 92, 246, 0.08);
}

.project-card-body[hidden] {
    display: none;
}

.project-info {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    margin-bottom: 16px;
    padding-top: 16px;
}

.project-detail {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.project-detail strong {
    color: #e2e8f0;
}

/* ── Muted text ────────────────────────────────────────── */
.text-muted { color: #94a3b8; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.8rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

/* ── Landing page ──────────────────────────────────────── */
.main.full-width {
    padding: 0;
    max-width: none;
}

.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 40px 24px;
}

.landing h1 {
    font-size: 2.8rem;
    margin-bottom: 12px;
}

.landing .subtitle {
    color: #94a3b8;
    font-size: 1.15rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
    max-width: 480px;
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 820px;
    margin: 3rem 0 1rem;
    text-align: left;
}

.feature {
    background: linear-gradient(145deg, #1e2035, #1a1c2e);
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 12px;
    padding: 24px;
}

.feature-icon {
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.feature h3 {
    color: #e2e8f0;
    font-size: 1rem;
    margin-bottom: 6px;
}

.feature p {
    color: #94a3b8;
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
}

.landing .hint {
    color: #64748b;
    font-size: 0.85rem;
    margin-top: 2rem;
    max-width: 480px;
}

/* ── Team Members ──────────────────────────────────────── */
.team-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.team-member {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(15, 17, 23, 0.4);
    border: 1px solid rgba(139, 92, 246, 0.1);
    border-radius: 8px;
    gap: 12px;
}

.team-member-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.team-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.team-avatar-placeholder {
    background: rgba(139, 92, 246, 0.15);
}

.team-member-name {
    font-weight: 500;
    color: #e2e8f0;
    font-size: 0.9rem;
}

.team-member-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.team-role-select {
    padding: 4px 8px;
    background: rgba(15, 17, 23, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 6px;
    color: #e2e8f0;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
}

.team-role-select:focus {
    outline: none;
    border-color: #8b5cf6;
}

.team-invite-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.team-invite-input {
    flex: 1;
    padding: 6px 12px;
    background: rgba(15, 17, 23, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    color: #e2e8f0;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
}

.team-invite-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.team-invite-input::placeholder {
    color: #64748b;
}

/* Autocomplete dropdown */
.ac-wrap {
    position: relative;
    flex: 1;
}

.ac-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1c2e;
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.ac-dropdown.ac-open {
    display: block;
}

.ac-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.1s;
}

.ac-item:hover {
    background: rgba(139, 92, 246, 0.1);
}

.ac-name {
    color: #e2e8f0;
    font-weight: 500;
    font-size: 0.9rem;
}

.ac-empty {
    padding: 10px 12px;
    color: #64748b;
    font-size: 0.85rem;
}

/* Role badges for shared projects */
.badge-role-viewer {
    background: rgba(139, 92, 246, 0.1);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-role-editor {
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ── Mobile Menu ───────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    width: 40px;
    height: 40px;
    background: linear-gradient(145deg, #1e2035, #1a1c2e);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 10px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: #c4b5fd;
    border-radius: 2px;
    transition: all 0.2s ease;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 40;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .mobile-menu-btn { display: flex; }

    .sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
        transition: transform 0.25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open ~ .sidebar-overlay {
        display: block;
    }

    .main { margin-left: 0; padding: 20px; }
    .nav-cards { grid-template-columns: 1fr; }
    .metrics { grid-template-columns: 1fr 1fr; }
    .features { grid-template-columns: 1fr; }
}
