:root {
    --blue: #009ee3;
    --green: #00a650;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --soft: #f6f8fb;
    --warning: #f59e0b;
    --danger: #dc2626;
    --white: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    background: var(--soft);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
    font: inherit;
}

.sidebar {
    min-height: 100vh;
    background: #ffffff;
    border-right: 1px solid var(--line);
    padding: 24px 18px;
    position: sticky;
    top: 0;
}

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

.brand img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.brand strong,
.brand span {
    display: block;
}

.brand strong {
    font-size: 17px;
}

.brand span,
small,
.eyebrow {
    color: var(--muted);
}

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

.nav-item,
.link-button {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: var(--ink);
}

.nav-item {
    text-align: left;
    padding: 13px 14px;
    border-radius: 8px;
}

.nav-item.active,
.nav-item:hover {
    background: #eaf7fd;
    color: #007eb6;
    font-weight: 700;
}

.profile-switch {
    margin-top: 28px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
}

.profile-switch label {
    font-weight: 700;
}

.profile-switch select,
input,
select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    min-height: 42px;
    padding: 0 12px;
    background: #fff;
}

.app {
    padding: 28px;
    min-width: 0;
}

.topbar,
.section-head,
.panel-head,
.modal-head,
.modal-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.topbar {
    margin-bottom: 18px;
}

.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    font-size: 12px;
    font-weight: 700;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 30px;
}

h2 {
    margin-bottom: 0;
}

.topbar-actions,
.filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    min-height: 42px;
    border-radius: 8px;
    border: 1px solid transparent;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 700;
}

.btn.primary {
    background: var(--blue);
    color: #fff;
}

.btn.secondary {
    background: #fff;
    color: var(--blue);
    border-color: var(--blue);
}

.alert {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

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

.kpi,
.panel,
.table-wrap,
.calendar-day,
.team-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.kpi {
    padding: 18px;
}

.kpi span,
.entry span,
.timeline-item span {
    color: var(--muted);
    font-size: 13px;
}

.kpi strong {
    display: block;
    margin: 10px 0 6px;
    font-size: 26px;
}

.dashboard-grid,
.finance-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 16px;
    margin-top: 16px;
}

.panel {
    padding: 18px;
}

.daily-profit strong {
    display: block;
    font-size: 42px;
    color: var(--green);
    margin: 20px 0 8px;
}

.mini-bars {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    align-items: end;
    height: 130px;
    margin-top: 22px;
}

.mini-bar {
    background: #dff4fd;
    border-radius: 6px 6px 0 0;
    min-height: 18px;
    position: relative;
}

.mini-bar.negative {
    background: #fee2e2;
}

.mini-bar span {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--muted);
}

.timeline,
.entries,
.category-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.timeline-item,
.entry,
.category-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.section-head {
    margin: 16px 0;
}

.filters input {
    width: 360px;
}

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

th,
td {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
}

.status.approved {
    background: #dcfce7;
    color: #166534;
}

.status.pending,
.status.analysis {
    background: #fef3c7;
    color: #92400e;
}

.status.rejected {
    background: #fee2e2;
    color: #991b1b;
}

.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.small-button,
.link-button {
    color: var(--blue);
    font-weight: 700;
    padding: 0;
}

.small-button {
    border: 1px solid #bfe8fa;
    background: #f0faff;
    border-radius: 8px;
    min-height: 32px;
    padding: 0 10px;
    cursor: pointer;
}

.status-select,
.payment-select {
    min-width: 190px;
    min-height: 36px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
}

.status-select.approved {
    border-color: #86efac;
    background: #dcfce7;
    color: #166534;
}

.status-select.pending {
    border-color: #fde68a;
    background: #fef3c7;
    color: #92400e;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.calendar-day {
    min-height: 150px;
    padding: 12px;
}

.calendar-day strong {
    display: block;
    margin-bottom: 10px;
}

.bill-chip {
    display: block;
    border-radius: 8px;
    padding: 8px;
    margin-top: 8px;
    background: #f3f4f6;
    border: 1px solid var(--line);
}

.bill-chip.paid {
    background: #ecfdf5;
}

.bill-chip.pending {
    background: #fffbeb;
}

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

.team-card {
    padding: 18px;
}

.team-card strong {
    display: block;
    font-size: 20px;
    margin-bottom: 8px;
}

.integration-panel code,
pre {
    display: block;
    background: #111827;
    color: #f9fafb;
    border-radius: 8px;
    padding: 14px;
    overflow-x: auto;
}

.modal {
    width: min(720px, calc(100vw - 28px));
    border: 0;
    border-radius: 8px;
    padding: 0;
}

.modal::backdrop {
    background: rgba(17, 24, 39, 0.55);
}

.modal-content {
    padding: 22px;
}

.icon-button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: #f3f4f6;
    cursor: pointer;
    font-size: 24px;
}

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

.field {
    display: grid;
    gap: 7px;
}

.field.full {
    grid-column: 1 / -1;
}

.check-field {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fafb;
}

.check-field input {
    width: 18px;
    min-height: 18px;
    margin-top: 2px;
}

.check-field strong,
.check-field span {
    display: block;
}

.check-field span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.conditional-fields {
    grid-column: 1 / -1;
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 14px;
    border: 1px solid #bfe8fa;
    border-radius: 8px;
    background: #f0faff;
}

.conditional-fields.open {
    display: grid;
}

.field label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 1100px) {
    body {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        min-height: auto;
    }

    .nav,
    .kpi-grid,
    .dashboard-grid,
    .finance-grid,
    .team-grid,
    .calendar-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 720px) {
    .app {
        padding: 18px 12px;
    }

    .topbar,
    .section-head,
    .topbar-actions,
    .filters {
        align-items: stretch;
        flex-direction: column;
    }

    .filters input,
    .filters select {
        width: 100%;
    }

    .nav,
    .kpi-grid,
    .dashboard-grid,
    .finance-grid,
    .team-grid,
    .calendar-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        overflow-x: auto;
    }
}
