:root {
    --fnx-green: #0b8457;
    --fnx-green-dark: #096945;
    --fnx-green-light: #e6f4ee;
    --fnx-sidebar: #12352a;
    --fnx-sidebar-hover: #1d4a3a;
    --fnx-text: #1f2933;
    --fnx-muted: #6b7280;
    --fnx-border: #e3e8ee;
    --fnx-bg: #f4f6f8;
    --fnx-danger: #c0392b;
    --fnx-warn: #b8860b;
    --fnx-radius: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--fnx-text);
    background: var(--fnx-bg);
    font-size: 14px;
}

a { color: var(--fnx-green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px;
    background: var(--fnx-sidebar);
    color: #cfe5da;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
}
.sidebar .brand {
    padding: 18px 20px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand span { color: #5fd6a0; }
.sidebar nav { padding: 10px 0; flex: 1; }
.sidebar .nav-section {
    padding: 14px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #6f9485;
}
.sidebar a.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: #cfe5da;
    font-size: 13.5px;
    border-left: 3px solid transparent;
}
.sidebar a.nav-link:hover { background: var(--fnx-sidebar-hover); text-decoration: none; }
.sidebar a.nav-link.active {
    background: var(--fnx-sidebar-hover);
    color: #fff;
    border-left-color: #5fd6a0;
    font-weight: 600;
}

.main { flex: 1; margin-left: 230px; display: flex; flex-direction: column; }
.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--fnx-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .company-switcher select {
    border: 1px solid var(--fnx-border);
    border-radius: var(--fnx-radius);
    padding: 7px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--fnx-text);
    background: #fff;
    min-width: 240px;
}
.topbar .user-menu { display: flex; align-items: center; gap: 14px; color: var(--fnx-muted); }
.topbar .user-menu .name { font-weight: 600; color: var(--fnx-text); }

.content { padding: 24px; flex: 1; }
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.page-header h1 { font-size: 22px; margin: 0; font-weight: 700; }

/* Cards */
.card {
    background: #fff;
    border: 1px solid var(--fnx-border);
    border-radius: var(--fnx-radius);
    margin-bottom: 18px;
}
.card .card-head { padding: 14px 18px; border-bottom: 1px solid var(--fnx-border); font-weight: 600; }
.card .card-body { padding: 18px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--fnx-border);
    background: #fff;
    color: var(--fnx-text);
    padding: 8px 14px;
    border-radius: var(--fnx-radius);
    font-size: 13.5px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}
.btn:hover { background: #f7f9fb; text-decoration: none; }
.btn-primary { background: var(--fnx-green); border-color: var(--fnx-green); color: #fff; }
.btn-primary:hover { background: var(--fnx-green-dark); }
.btn-danger { background: var(--fnx-danger); border-color: var(--fnx-danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--fnx-border); }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--fnx-muted); background: #fafbfc; }
.table tbody tr:hover { background: var(--fnx-green-light); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Filters bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .field { display: flex; flex-direction: column; gap: 4px; }
.filters label { font-size: 12px; color: var(--fnx-muted); font-weight: 600; }
.filters input, .filters select {
    border: 1px solid var(--fnx-border);
    border-radius: var(--fnx-radius);
    padding: 7px 10px;
    font-size: 13.5px;
    min-width: 160px;
}

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12.5px; font-weight: 600; color: var(--fnx-muted); }
.form-field input, .form-field select, .form-field textarea {
    border: 1px solid var(--fnx-border);
    border-radius: var(--fnx-radius);
    padding: 9px 11px;
    font-size: 14px;
    width: 100%;
}

/* Badges */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.badge-green { background: var(--fnx-green-light); color: var(--fnx-green-dark); }
.badge-grey { background: #eef1f4; color: var(--fnx-muted); }
.badge-red { background: #fdecea; color: var(--fnx-danger); }
.badge-amber { background: #fcf3df; color: var(--fnx-warn); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--fnx-radius); margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: var(--fnx-green-light); color: var(--fnx-green-dark); }
.alert-error { background: #fdecea; color: var(--fnx-danger); }
.alert-info { background: #eaf2fb; color: #1c5d99; }

.muted { color: var(--fnx-muted); }
.text-right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--fnx-sidebar); }
.auth-card { background: #fff; border-radius: 12px; padding: 36px; width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }
.auth-card h1 { font-size: 22px; margin: 0 0 4px; }
.auth-card .sub { color: var(--fnx-muted); margin-bottom: 22px; font-size: 13.5px; }
.auth-card .form-field { margin-bottom: 14px; }
.auth-card .btn-primary { width: 100%; justify-content: center; padding: 11px; }
