/* ========================================
   PayLedger MVP — Dashboard
   Colors: Black, White, #B13E31 (accent)
   Font: Unageo
   ======================================== */

@font-face {
    font-family: 'Unageo';
    src: url('assets/Fonts/unageo/variable/Unageo[wght].ttf') format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --white: #ffffff;
    --black: #0a0a0a;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;

    --accent: #B13E31;
    --accent-light: #d4564a;
    --accent-subtle: rgba(177, 62, 49, 0.08);
    --accent-border: rgba(177, 62, 49, 0.2);

    --green: #16a34a;
    --green-subtle: rgba(22, 163, 74, 0.08);
    --yellow: #ca8a04;
    --yellow-subtle: rgba(202, 138, 4, 0.08);
    --red: #dc2626;
    --red-subtle: rgba(220, 38, 38, 0.08);

    --font: 'Unageo', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px rgba(0,0,0,0.07);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

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

html { -webkit-font-smoothing: antialiased; }

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

/* ========================================
   Layout
   ======================================== */
.app-layout {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--black);
    color: var(--white);
    padding: 2.5rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 270px;
    z-index: 100;
}
.sidebar__logo {
    padding: 0 1.75rem;
    margin-bottom: 3rem;
}
.sidebar__logo-text {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.sidebar__logo-sub {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-top: 0.25rem;
}
.sidebar__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0 1rem;
}
.sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.8125rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--gray-400);
    text-decoration: none;
    transition: all var(--transition);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font);
}
.sidebar__link:hover {
    color: var(--white);
    background: var(--gray-800);
}
.sidebar__link.active {
    color: var(--white);
    background: var(--gray-800);
    font-weight: 500;
}
.sidebar__link-icon {
    width: 20px;
    height: 20px;
    opacity: 0.6;
}
.sidebar__link.active .sidebar__link-icon {
    opacity: 1;
}
.sidebar__divider {
    height: 1px;
    background: var(--gray-800);
    margin: 1.25rem 1rem;
}
.sidebar__footer {
    padding: 1.75rem;
    border-top: 1px solid var(--gray-800);
    margin-top: auto;
}
.sidebar__user {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}
.sidebar__avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 600;
}
.sidebar__user-info {
    display: flex;
    flex-direction: column;
}
.sidebar__user-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--white);
}
.sidebar__user-email {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Main Content */
.main {
    margin-left: 270px;
    padding: 2.5rem 3rem;
    min-height: 100vh;
}
.main__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
}
.main__title {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.main__subtitle {
    font-size: 0.9375rem;
    color: var(--gray-500);
    margin-top: 0.375rem;
}

/* ========================================
   Cards & Components
   ======================================== */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: box-shadow var(--transition);
}
.card:hover {
    box-shadow: var(--shadow);
}
.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}
.card__title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--black);
}
.card__subtitle {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.metric-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
}
.metric-card__label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    margin-bottom: 0.625rem;
}
.metric-card__value {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--black);
}
.metric-card__change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
    padding: 0.1875rem 0.625rem;
    border-radius: 100px;
}
.metric-card__change--up {
    color: var(--green);
    background: var(--green-subtle);
}
.metric-card__change--down {
    color: var(--red);
    background: var(--red-subtle);
}
.metric-card__change--neutral {
    color: var(--gray-500);
    background: var(--gray-100);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}
thead th {
    text-align: left;
    padding: 0.875rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
tbody td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    white-space: nowrap;
}
tbody tr:last-child td {
    border-bottom: none;
}
tbody tr:hover {
    background: var(--gray-50);
}
.td-name {
    font-weight: 500;
    color: var(--black);
}
.td-amount {
    font-weight: 600;
    color: var(--black);
    font-variant-numeric: tabular-nums;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3125rem 0.75rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge--good {
    color: var(--green);
    background: var(--green-subtle);
}
.badge--warning {
    color: var(--yellow);
    background: var(--yellow-subtle);
}
.badge--bad {
    color: var(--red);
    background: var(--red-subtle);
}
.badge--neutral {
    color: var(--gray-600);
    background: var(--gray-100);
}

/* Progress/Bar */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.bar-row {
    display: grid;
    grid-template-columns: 160px 1fr 55px;
    align-items: center;
    gap: 1.25rem;
}
.bar-row__label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bar-row__track {
    height: 8px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}
.bar-row__fill {
    height: 100%;
    border-radius: 4px;
    background: var(--black);
    transition: width 0.8s ease;
}
.bar-row__fill--accent {
    background: var(--accent);
}
.bar-row__fill--warning {
    background: var(--yellow);
}
.bar-row__fill--bad {
    background: var(--red);
}
.bar-row__value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-600);
    text-align: right;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 2rem;
}
.tab {
    padding: 1rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-400);
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font);
    position: relative;
    transition: color var(--transition);
}
.tab:hover { color: var(--gray-700); }
.tab.active {
    color: var(--black);
}
.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 2px;
    background: var(--black);
    border-radius: 1px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.8125rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
}
.btn--primary {
    background: var(--black);
    color: var(--white);
}
.btn--primary:hover {
    background: var(--gray-800);
}
.btn--accent {
    background: var(--accent);
    color: var(--white);
}
.btn--accent:hover {
    background: var(--accent-light);
}
.btn--outline {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}
.btn--outline:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}
.btn--sm {
    padding: 0.5625rem 1rem;
    font-size: 0.8125rem;
}

/* Upload Zone */
.upload-zone {
    border: 1.5px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 3.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}
.upload-zone:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}
.upload-zone__icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}
.upload-zone__title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--black);
    margin-bottom: 0.5rem;
}
.upload-zone__desc {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

/* ========================================
   Onboarding
   ======================================== */
.onboarding {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
}
.onboarding__container {
    max-width: 560px;
    width: 100%;
    padding: 3rem 2rem;
}
.onboarding__logo {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}
.onboarding__logo-sub {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 3.5rem;
}
.onboarding__step-indicator {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 3rem;
}
.onboarding__step-dot {
    width: 40px; height: 4px;
    border-radius: 2px;
    background: var(--gray-200);
    transition: background var(--transition);
}
.onboarding__step-dot.active {
    background: var(--black);
}
.onboarding__step-dot.completed {
    background: var(--accent);
}
.onboarding__title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.625rem;
    letter-spacing: -0.02em;
}
.onboarding__desc {
    font-size: 1rem;
    color: var(--gray-500);
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

/* Form */
.form-group {
    margin-bottom: 1.5rem;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--gray-200);
}
.auth-tab {
    padding: 0.875rem 1.5rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-400);
    cursor: pointer;
    border: none;
    background: none;
    position: relative;
    transition: color var(--transition);
}
.auth-tab:hover { color: var(--gray-600); }
.auth-tab.active { color: var(--black); }
.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 2px;
    background: var(--black);
    border-radius: 1px;
}
.auth-link {
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
}
.auth-link:hover {
    text-decoration: underline;
}
.auth-footer-text {
    margin-top: 2rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    text-align: center;
}
.auth-note {
    margin-top: 1.25rem;
    padding: 0.875rem 1.25rem;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--gray-500);
    text-align: center;
}
.form-error {
    padding: 0.875rem 1.25rem;
    background: var(--red-subtle);
    border: 1px solid rgba(220, 38, 38, 0.15);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--red);
    margin-bottom: 1.5rem;
}
.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 0.625rem;
}
.form-input {
    width: 100%;
    padding: 0.9375rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    font-family: var(--font);
    font-size: 1rem;
    color: var(--black);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: var(--white);
}
.form-input:focus {
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.05);
}
.form-input::placeholder {
    color: var(--gray-400);
}

/* Custom Select — fully custom dropdown */
.custom-select {
    position: relative;
    width: 100%;
}
.custom-select__trigger {
    width: 100%;
    padding: 0.9375rem 1.25rem;
    padding-right: 3rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200);
    font-family: var(--font);
    font-size: 1rem;
    color: var(--black);
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: border-color var(--transition), box-shadow var(--transition);
    position: relative;
    user-select: none;
}
.custom-select__trigger::after {
    content: '';
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--gray-400);
    transition: transform var(--transition);
}
.custom-select.open .custom-select__trigger {
    border-color: var(--black);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.05);
}
.custom-select.open .custom-select__trigger::after {
    transform: translateY(-50%) rotate(180deg);
}
.custom-select__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s var(--transition);
    max-height: 240px;
    overflow-y: auto;
}
.custom-select.open .custom-select__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.custom-select__option {
    padding: 0.8125rem 1.25rem;
    font-size: 0.9375rem;
    color: var(--gray-700);
    cursor: pointer;
    transition: background var(--transition);
}
.custom-select__option:hover {
    background: var(--gray-50);
}
.custom-select__option.selected {
    color: var(--black);
    font-weight: 500;
    background: var(--gray-50);
}
.custom-select__option:not(:last-child) {
    border-bottom: 1px solid var(--gray-100);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
}
.form-actions .btn {
    flex: 1;
    justify-content: center;
    padding: 0.9375rem 1.5rem;
    font-size: 1rem;
}

/* ========================================
   Dashboard Grid
   ======================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    margin-bottom: 1.75rem;
}
.dashboard-grid--full {
    grid-template-columns: 1fr;
}

/* ========================================
   Payment Behavior Chart (CSS-only)
   ======================================== */
.behavior-chart {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    height: 150px;
    padding-top: 1rem;
}
.behavior-chart__bar {
    flex: 1;
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.6s ease;
    position: relative;
}
.behavior-chart__bar:hover {
    opacity: 0.8;
}
.behavior-chart__bar[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6875rem;
    white-space: nowrap;
    background: var(--black);
    color: var(--white);
    padding: 0.375rem 0.625rem;
    border-radius: 5px;
}
.behavior-chart__legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--gray-500);
}
.legend-dot {
    width: 10px; height: 10px;
    border-radius: 3px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .metrics-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .app-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main { margin-left: 0; padding: 1.5rem; }
    .metrics-grid { grid-template-columns: 1fr 1fr; }
    .bar-row { grid-template-columns: 100px 1fr 40px; }
}
