@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,300&display=swap');

:root {
    --bg:        #0b0f1a;
    --bg2:       #111827;
    --bg3:       #1a2235;
    --border:    #1f2d45;
    --accent:    #00e5a0;
    --accent2:   #0099ff;
    --accent3:   #f59e0b;
    --danger:    #ef4444;
    --text:      #e8edf5;
    --muted:     #6b7a99;
    --card:      #131c2e;
    --card-hover:#17243a;
    --radius:    12px;
    --radius-lg: 20px;
    --shadow:    0 4px 24px rgba(0,0,0,0.4);
    --font-head: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── LAYOUT ── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-text {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.sidebar-logo .logo-sub {
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-logo .logo-dot {
    color: var(--accent);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-label {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 12px 12px 6px;
    font-family: var(--font-head);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg3);
    color: var(--text);
}

.nav-item.active {
    background: rgba(0, 229, 160, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 229, 160, 0.2);
}

.nav-item .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 12px 20px;
    border-top: 1px solid var(--border);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--bg3);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--bg);
    font-family: var(--font-head);
    flex-shrink: 0;
}

.user-info .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.user-info .user-role {
    font-size: 11px;
    color: var(--muted);
}

.btn-logout {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    font-family: var(--font-body);
}

.btn-logout:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 32px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-family: var(--font-head);
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--muted);
    font-size: 14px;
    margin-top: 4px;
}

/* ── CARDS ── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: background 0.2s;
}

.card:hover { background: var(--card-hover); }

.card-title {
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.card-value {
    font-family: var(--font-head);
    font-size: 30px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1px;
}

.card-value.green { color: var(--accent); }
.card-value.blue  { color: var(--accent2); }
.card-value.amber { color: var(--accent3); }
.card-value.red   { color: var(--danger); }

.card-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

/* ── GRID ── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: var(--font-body);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}
.btn-primary:hover { background: #00c98c; transform: translateY(-1px); }

.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: white; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font-body);
    transition: border-color 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,229,160,0.1);
}

.form-control option { background: var(--bg2); }

/* ── TABLES ── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

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

thead th {
    background: var(--bg3);
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-family: var(--font-head);
}

tbody td {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
}

tbody tr:hover td { background: var(--bg3); }

/* ── BADGES ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-green { background: rgba(0,229,160,0.12); color: var(--accent); }
.badge-blue  { background: rgba(0,153,255,0.12); color: var(--accent2); }
.badge-amber { background: rgba(245,158,11,0.12); color: var(--accent3); }
.badge-red   { background: rgba(239,68,68,0.12);  color: var(--danger); }
.badge-gray  { background: rgba(107,122,153,0.15); color: var(--muted); }

/* ── MODAL ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modal-in 0.25s ease;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

.modal-title {
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 800;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg3);
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}
.modal-close:hover { background: var(--danger); color: white; }

/* ── ALERT ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-error   { background: rgba(239,68,68,0.1);   border: 1px solid rgba(239,68,68,0.3);   color: #fca5a5; }
.alert-success { background: rgba(0,229,160,0.1);   border: 1px solid rgba(0,229,160,0.3);   color: var(--accent); }
.alert-info    { background: rgba(0,153,255,0.1);   border: 1px solid rgba(0,153,255,0.3);   color: var(--accent2); }

/* ── DIVIDER ── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ── SECTION HEADER ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-family: var(--font-head);
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

/* ── DEUDA CARD ── */
.deuda-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.deuda-item:last-child { border-bottom: none; }

.deuda-names {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.deuda-arrow { color: var(--danger); font-size: 16px; }
.deuda-amount { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--accent3); }

/* ── LOGIN PAGE ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.login-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 20% 50%, rgba(0,229,160,0.05) 0%, transparent 70%),
        radial-gradient(ellipse 40% 60% at 80% 30%, rgba(0,153,255,0.05) 0%, transparent 70%);
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-big {
    font-family: var(--font-head);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.login-logo .logo-sub {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 4px;
}

/* ── MOBILE ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 16px;
    }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }

    .menu-toggle {
        display: flex;
        position: fixed;
        top: 16px; left: 16px;
        z-index: 200;
        width: 40px; height: 40px;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 10px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: 18px;
    }
}

.menu-toggle { display: none; }

/* ── FADE IN ── */
.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── PROGRESS BAR ── */
.progress-bar {
    height: 6px;
    background: var(--bg3);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: width 0.5s ease;
}

/* ── AVATAR GROUP ── */
.avatar-group { display: flex; gap: -4px; }
.avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--bg);
    font-family: var(--font-head);
    border: 2px solid var(--card);
    margin-left: -4px;
    flex-shrink: 0;
}
.avatar-sm:first-child { margin-left: 0; }

/* ── TOOLTIP ── */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}
.tooltip-wrap:hover .tooltip { opacity: 1; }

/* ── INLINE AMOUNT INPUT ── */
.input-prefix {
    position: relative;
}
.input-prefix span {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
}
.input-prefix .form-control { padding-left: 28px; }

/* eye icon for passwords */
.input-eye {
    position: relative;
}
.input-eye .form-control { padding-right: 40px; }
.eye-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
    transition: color 0.2s;
}
.eye-btn:hover { color: var(--text); }
