:root {
    --navy: #102a43;
    --navy-dark: #0b1f33;
    --blue: #2563eb;
    --blue-soft: #eaf1ff;
    --green: #16845b;
    --green-soft: #e8f7f0;
    --orange: #d97706;
    --orange-soft: #fff4df;
    --red: #dc2626;
    --red-soft: #fdecec;
    --text: #172033;
    --text-soft: #667085;
    --border: #e7ebf0;
    --background: #f5f7fa;
    --white: #ffffff;
    --shadow: 0 8px 24px rgba(16, 42, 67, 0.07);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: var(--background);
}

button,
a {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    flex: 0 0 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--navy-dark);
    color: #fff;
    padding: 22px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 28px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #fff;
    color: var(--navy);
    font-size: 21px;
    font-weight: 800;
}

.brand-name {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: .4px;
}

.brand-subtitle {
    margin-top: 2px;
    font-size: 11px;
    opacity: .65;
}

.main-nav {
    display: grid;
    gap: 8px;
}

.nav-item {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 15px;
    border-radius: 14px;
    color: rgba(255,255,255,.72);
    text-decoration: none;
    transition: .18s ease;
}

.nav-item:hover,
.nav-item.active {
    color: #fff;
    background: rgba(255,255,255,.10);
}

.nav-item span:first-child {
    width: 23px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 8px 4px;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    opacity: .76;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
}

.main-area {
    flex: 1;
    min-width: 0;
}

.topbar {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 32px;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.menu-button {
    display: none;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 12px;
    background: var(--blue-soft);
    color: var(--navy);
}

.page-title h1 {
    margin: 0;
    font-size: 24px;
}

.page-title p {
    margin: 4px 0 0;
    color: var(--text-soft);
    font-size: 13px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-button {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 800;
}

.user-info {
    display: grid;
    gap: 2px;
}

.user-info strong {
    font-size: 13px;
}

.user-info span {
    font-size: 11px;
    color: var(--text-soft);
}

.content {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 30px 32px 50px;
}

.welcome-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    background: var(--navy);
    color: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.eyebrow,
.panel-kicker {
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.eyebrow {
    opacity: .65;
}

.welcome-panel h2 {
    margin: 8px 0;
    font-size: clamp(23px, 3vw, 32px);
}

.welcome-panel p {
    margin: 0;
    max-width: 700px;
    color: rgba(255,255,255,.75);
    line-height: 1.55;
}

.primary-button {
    min-height: 46px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: var(--navy);
    font-weight: 700;
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 16px;
    margin-top: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    font-size: 20px;
    font-weight: 700;
}

.stat-icon.clients {
    background: var(--blue-soft);
    color: var(--blue);
}

.stat-icon.pending {
    background: var(--orange-soft);
    color: var(--orange);
}

.stat-icon.today {
    background: var(--green-soft);
    color: var(--green);
}

.stat-icon.balance {
    background: var(--red-soft);
    color: var(--red);
}

.stat-content {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.stat-label {
    color: var(--text-soft);
    font-size: 12px;
}

.stat-value {
    font-size: 25px;
}

.stat-note {
    color: #98a2b3;
    font-size: 11px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.panel {
    min-width: 0;
    padding: 22px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.panel-kicker {
    color: var(--text-soft);
}

.panel h3,
.section-heading h3 {
    margin: 5px 0 0;
    font-size: 19px;
}

.text-button {
    padding: 7px 11px;
    border: 0;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
}

.empty-state {
    min-height: 260px;
    display: grid;
    place-content: center;
    justify-items: center;
    padding: 30px 15px 15px;
    text-align: center;
}

.empty-state.compact {
    min-height: 230px;
}

.empty-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    background: var(--background);
    font-size: 21px;
}

.empty-state h4 {
    margin: 14px 0 6px;
    font-size: 15px;
}

.empty-state p {
    max-width: 360px;
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.5;
}

.quick-actions {
    margin-top: 28px;
}

.section-heading {
    margin-bottom: 14px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 14px;
}

.action-card {
    min-height: 84px;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    text-align: left;
    box-shadow: var(--shadow);
    transition: .18s ease;
}

.action-card:hover {
    transform: translateY(-1px);
}

.action-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 800;
}

.action-card span:last-child {
    display: grid;
    gap: 3px;
}

.action-card strong {
    font-size: 13px;
}

.action-card small {
    color: var(--text-soft);
    font-size: 11px;
}

.mobile-overlay {
    display: none;
}

@media (max-width: 1200px) {
    .stats-grid,
    .action-grid {
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        z-index: 30;
        left: -280px;
        top: 0;
        bottom: 0;
        transition: left .2s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        z-index: 20;
        background: rgba(0,0,0,.35);
    }

    .mobile-overlay.visible {
        display: block;
    }

    .menu-button {
        display: inline-grid;
        place-items: center;
    }

    .topbar {
        padding: 14px 18px;
    }

    .content {
        padding: 20px 18px 40px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .topbar-actions .icon-button,
    .user-info {
        display: none;
    }

    .content {
        padding: 16px 13px 32px;
    }

    .welcome-panel {
        align-items: stretch;
        flex-direction: column;
        padding: 22px;
    }

    .primary-button {
        width: 100%;
    }

    .stats-grid,
    .action-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 17px;
    }

    .panel {
        padding: 18px;
    }

    .page-title h1 {
        font-size: 20px;
    }
}

.page-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.page-intro h2 {
    margin: 6px 0;
    font-size: clamp(24px, 3vw, 32px);
}

.page-intro p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.5;
}

.client-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 8px;
}

.search-box label,
.form-field label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-soft);
}

.search-box input,
.form-field input,
.form-field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
    color: var(--text);
    padding: 12px 14px;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.search-box input:focus,
.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-soft);
}

.client-counter {
    min-width: 150px;
    display: grid;
    gap: 3px;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--blue-soft);
}

.client-counter span {
    color: var(--text-soft);
    font-size: 11px;
}

.client-counter strong {
    font-size: 22px;
    color: var(--blue);
}

.client-cards {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.client-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 17px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    transition: .18s ease;
}

.client-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.client-card-main {
    min-width: 0;
}

.client-code {
    display: inline-block;
    margin-bottom: 4px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
}

.client-card h4 {
    margin: 0 0 8px;
    font-size: 16px;
}

.client-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    color: var(--text-soft);
    font-size: 12px;
}

.client-status {
    flex: 0 0 auto;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.client-status.active {
    color: var(--green);
    background: var(--green-soft);
}

.client-status.inactive {
    color: var(--red);
    background: var(--red-soft);
}

.client-form-panel {
    margin-top: 20px;
}

.client-form {
    margin-top: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-field {
    min-width: 0;
    display: grid;
    gap: 7px;
}

.form-field-wide {
    grid-column: 1 / -1;
}

.form-field textarea {
    resize: vertical;
    min-height: 100px;
}

.form-message {
    min-height: 22px;
    margin-top: 14px;
    font-size: 12px;
    font-weight: 700;
}

.form-message.success {
    color: var(--green);
}

.form-message.error {
    color: var(--red);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

@media (max-width: 700px) {
    .page-intro,
    .client-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .client-counter {
        min-width: 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field-wide {
        grid-column: auto;
    }

    .client-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .client-status {
        align-self: flex-start;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .form-actions .primary-button,
    .form-actions .text-button {
        width: 100%;
    }
}

.form-actions .primary-button {
    background: var(--blue);
    color: #fff;
    min-height: 46px;
    padding: 0 22px;
    border-radius: 999px;
    font-weight: 800;
}

.form-actions .primary-button:hover {
    filter: brightness(0.95);
}

@media (max-width: 700px) {
    .form-actions .primary-button {
        min-height: 50px;
    }
}
