/* Component styles complement the locally compiled Tailwind utilities. */
:root {
    --bg: #f5f7fb;
    --surface: #fff;
    --ink: #18253e;
    --muted: #78849b;
    --border: #e7ebf2;
    --blue: #365ff3;
    --green: #159b72;
    --red: #e05268;
    --sidebar: 244px;
    font-family:
        Inter,
        Segoe UI,
        Arial,
        sans-serif;
    color: var(--ink);
    background: var(--bg);
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    font-size: 14px;
}
button,
input,
select,
textarea {
    font: inherit;
}
button,
a,
input,
select {
    outline-offset: 4px;
}
button {
    cursor: pointer;
}
button:disabled {
    opacity: 0.55;
    cursor: wait;
}
a {
    text-decoration: none;
    color: inherit;
}
.dark {
    --bg: #101725;
    --surface: #192235;
    --ink: #e9eefb;
    --muted: #a0aec5;
    --border: #2a354b;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 20;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 25px;
    font-weight: 750;
    letter-spacing: -1px;
    padding: 29px 25px;
}
.brand-light {
    font-weight: 400;
    color: var(--muted);
    margin-left: -3px;
}
.brand-icon {
    display: grid;
    place-items: center;
    background: var(--blue);
    color: white;
    font-weight: 700;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 23px;
}
.workspace-label {
    font-size: 10px;
    letter-spacing: 1.3px;
    color: var(--muted);
    padding: 18px 26px 12px;
}
nav {
    overflow: auto;
    padding: 0 14px 14px;
    flex: 1;
}
nav button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: 0;
    background: none;
    color: var(--muted);
    padding: 10px 13px;
    text-align: left;
    border-radius: 8px;
    font-size: 13px;
    margin: 2px 0;
}
svg {
    width: 18px;
    height: 18px;
    stroke-width: 1.8;
    flex-shrink: 0;
}
nav button.active {
    background: #edf1ff;
    color: var(--blue);
    font-weight: 650;
}
nav button:hover {
    background: var(--bg);
}
.nav-section {
    font-size: 9px;
    color: var(--muted);
    letter-spacing: 1.3px;
    padding: 19px 13px 6px;
}
.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 19px 23px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--green);
}
.sidebar-footer small {
    display: block;
    color: var(--muted);
    font-size: 9px;
    margin-top: 3px;
}
.shell {
    margin-left: var(--sidebar);
}
.topbar {
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 35px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    gap: 15px;
}
.company-control {
    display: flex;
    align-items: center;
    gap: 12px;
}
.company-mark {
    background: #edf1ff;
    color: var(--blue);
    border-radius: 10px;
    display: grid;
    place-items: center;
    width: 39px;
    height: 39px;
    font-weight: 700;
}
.company-control small {
    font-size: 9px;
    color: var(--muted);
    letter-spacing: 1px;
}
.company-control select {
    display: block;
    border: 0;
    background: var(--surface);
    color: var(--ink);
    font-weight: 650;
    max-width: 260px;
    padding: 3px 18px 3px 0;
}
.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}
.icon-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 34px;
    height: 34px;
    background: none;
    border: 0;
    color: var(--muted);
    border-radius: 8px;
}
.icon-button:hover {
    background: var(--bg);
    color: var(--blue);
}
.user-avatar {
    background: #e8edf9;
    color: #466195;
    border: 0;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-weight: 600;
}
#global-search {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    margin-right: 15px;
}
#global-search input {
    border: 0;
    background: none;
    width: 180px;
    color: var(--ink);
    font-size: 12px;
}
kbd {
    font-size: 10px;
    border: 1px solid var(--border);
    padding: 1px 4px;
    border-radius: 4px;
}
main#content {
    padding: 32px 35px;
    min-height: calc(100vh - 136px);
}
.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
    gap: 16px;
}
.page-heading h1 {
    font-size: 27px;
    letter-spacing: -0.8px;
    font-weight: 700;
    margin: 0 0 7px;
}
.muted,
.page-heading p {
    color: var(--muted);
}
.page-heading p {
    margin: 0;
    font-size: 12px;
}
.eyebrow {
    display: block;
    letter-spacing: 1.5px;
    font-size: 10px;
    font-weight: 650;
    color: var(--blue);
    margin-bottom: 12px;
}
.primary,
.secondary,
.danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.primary {
    background: var(--blue);
    color: white;
    box-shadow: 0 3px 7px #365ff320;
}
.secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink);
}
.danger {
    background: #fff0f1;
    color: var(--red);
}
.primary:hover {
    background: #254ee3;
}
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 12px;
    flex-wrap: wrap;
}
.period-tabs {
    display: flex;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    background: var(--surface);
}
.period-tabs button {
    font-size: 11px;
    border: 0;
    background: none;
    color: var(--muted);
    padding: 7px 14px;
    border-radius: 5px;
}
.period-tabs button.active {
    color: var(--blue);
    background: #edf1ff;
    font-weight: 600;
}
.date-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
}
input,
select,
textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 11px;
    color: var(--ink);
}
input[type='date'] {
    font-size: 11px;
    padding: 7px 9px;
}
.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 21px;
}
.metric {
    padding: 19px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.metric-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
    font-size: 11px;
}
.metric-icon {
    width: 31px;
    height: 31px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #edf1ff;
    color: var(--blue);
}
.metric-value {
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -0.7px;
    margin: 13px 0 10px;
}
.metric-note {
    font-size: 10px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.green {
    color: var(--green);
}
.red {
    color: var(--red);
}
.metric.green .metric-icon {
    background: #eaf8f2;
    color: var(--green);
}
.metric.red .metric-icon {
    background: #fff0f2;
    color: var(--red);
}
.charts-grid {
    display: grid;
    grid-template-columns: 1.9fr 1fr;
    gap: 20px;
    margin-bottom: 22px;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px;
}
.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 10px;
}
.panel-header h2 {
    font-size: 14px;
    font-weight: 650;
    margin: 0 0 6px;
}
.panel-header p {
    font-size: 10px;
    color: var(--muted);
    margin: 0;
}
.chart-area {
    height: 238px;
    position: relative;
}
.legend {
    display: flex;
    gap: 15px;
    font-size: 10px;
    color: var(--muted);
    align-items: center;
}
.dot {
    width: 7px;
    height: 7px;
    background: var(--green);
    display: inline-block;
    border-radius: 50%;
    margin-right: 5px;
}
.dot.red {
    background: var(--red);
}
.empty-chart {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
}
.bottom-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 20px;
}
.table-panel {
    padding: 0;
    overflow: auto;
}
.table-panel .panel-header {
    padding: 22px 22px 0;
    margin-bottom: 18px;
}
table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}
th {
    font-size: 10px;
    font-weight: 500;
    color: var(--muted);
    background: var(--bg);
    padding: 12px 18px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
td small {
    display: block;
    font-size: 10px;
    color: var(--muted);
    margin-top: 4px;
}
tr:last-child td {
    border-bottom: 0;
}
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 9px;
    border-radius: 5px;
    background: #fff6de;
    color: #a87916;
}
.badge.paid {
    background: #eaf8f2;
    color: var(--green);
}
.badge.overdue {
    background: #fff0f2;
    color: var(--red);
}
.badge.cancelled {
    background: var(--bg);
    color: var(--muted);
}
.badge.partial {
    background: #edf1ff;
    color: var(--blue);
}
.empty {
    padding: 45px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}
.empty svg {
    margin: 0 auto 12px;
    width: 30px;
    height: 30px;
}
.alert-row {
    display: flex;
    gap: 12px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
}
.alert-icon {
    background: #fff6de;
    color: #ba861d;
    padding: 9px;
    border-radius: 9px;
    height: 36px;
}
.alert-row h3 {
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 5px;
}
.alert-row p {
    font-size: 10px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}
.app-footer {
    display: flex;
    justify-content: space-between;
    padding: 15px 35px;
    font-size: 10px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}
dialog {
    background: var(--surface);
    color: var(--ink);
    width: min(660px, calc(100vw - 32px));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0;
    max-height: 90vh;
    box-shadow: 0 25px 100px #0003;
}
dialog::backdrop {
    background: #12203e70;
    backdrop-filter: blur(3px);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 19px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    font-weight: 650;
    font-size: 17px;
    margin: 0;
}
#modal-body {
    padding: 24px;
    overflow: auto;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-grid label,
.login-card label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 12px;
    color: var(--muted);
}
.full {
    grid-column: 1/-1;
}
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}
.form-message {
    color: var(--red);
    font-size: 12px;
    margin-top: 12px;
}
.text-button {
    border: 0;
    background: none;
    color: var(--blue);
    font-size: 11px;
    padding: 5px;
}
.table-actions {
    display: flex;
    gap: 4px;
}
.table-actions button {
    font-size: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    border-radius: 5px;
    padding: 5px 8px;
}
.table-actions button:hover {
    color: var(--blue);
}
#toast {
    display: none;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;
    background: var(--ink);
    color: var(--surface);
    padding: 13px 20px;
    border-radius: 9px;
    box-shadow: 0 8px 35px #0002;
    max-width: 420px;
}
.company-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 22px;
    margin-top: 35px;
}
.company-card {
    padding: 30px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.company-card h2 {
    font-size: 18px;
    margin: 22px 0 8px;
}
.company-card p {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 25px;
}
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    background: var(--surface);
}
.login-brand {
    padding: 30px 55px;
    background: #eff3ff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100vh;
}
.login-brand .brand {
    padding: 0;
}
.login-brand h1 {
    font-size: 47px;
    line-height: 1.18;
    letter-spacing: -2px;
    margin: 18px 0 24px;
    color: #18253e;
    font-weight: 700;
}
.login-brand p {
    color: #718098;
    font-size: 15px;
    line-height: 1.9;
}
.login-brand small {
    font-size: 10px;
    color: #718098;
}
.login-feature {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: #466195;
    margin-top: 32px;
}
.login-card {
    max-width: 420px;
    width: 100%;
    margin: auto;
    padding: 35px;
}
.login-card h2 {
    font-size: 29px;
    font-weight: 700;
    margin: 8px 0;
}
.login-card p {
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 32px;
}
.login-card label {
    margin-bottom: 20px;
}
.login-card input {
    padding: 13px;
}
.login-card .primary {
    padding: 13px;
    margin-top: 4px;
}
.login-card .text-button {
    display: block;
    margin: 22px auto;
}
.login-card small {
    display: block;
    font-size: 10px;
    text-align: center;
    margin-top: 30px;
}
#message {
    font-size: 12px;
    color: var(--blue);
    line-height: 1.6;
}
#mobile-menu {
    display: none;
}
.filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.filters input {
    min-width: 190px;
}
.filters select {
    font-size: 12px;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.calendar-day {
    background: var(--surface);
    min-height: 110px;
    padding: 10px;
}
.calendar-day.today {
    background: #edf1ff;
}
.calendar-event {
    display: block;
    font-size: 9px;
    margin-top: 7px;
    border: 0;
    border-radius: 4px;
    padding: 5px;
    background: #fff0f2;
    color: var(--red);
    width: 100%;
    text-align: left;
    white-space: normal;
}
.calendar-event.revenue {
    color: var(--green);
    background: #eaf8f2;
}
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px;
    color: var(--muted);
    font-size: 11px;
}
.note {
    font-size: 11px;
    line-height: 1.7;
    color: var(--muted);
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
}
.detail-total {
    font-size: 28px;
    font-weight: 700;
}
.detail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}
.detail-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
}
.detail-item p {
    margin: 5px 0;
    color: var(--muted);
}
.detail-buttons {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin: 18px 0;
}
.loading {
    padding: 80px;
    text-align: center;
    color: var(--muted);
}
@media (min-width: 1500px) {
    main#content {
        max-width: 1650px;
        margin: auto;
    }
}
@media (max-width: 1200px) {
    :root {
        --sidebar: 215px;
    }
    .topbar {
        padding: 0 22px;
    }
    main#content {
        padding: 25px 22px;
    }
    .metric-value {
        font-size: 21px;
    }
    #global-search {
        display: none;
    }
    .top-actions {
        gap: 8px;
    }
    .charts-grid {
        grid-template-columns: 1.5fr 1fr;
    }
    .brand {
        font-size: 23px;
        padding-left: 20px;
    }
}
@media (max-width: 900px) {
    :root {
        --sidebar: 0px;
    }
    .sidebar {
        width: 244px;
        transform: translateX(-100%);
        transition: transform 0.2s;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    #mobile-menu {
        display: flex;
    }
    .topbar {
        height: 75px;
    }
    .metrics {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-grid,
    .bottom-grid {
        grid-template-columns: 1fr;
    }
    .company-cards {
        grid-template-columns: 1fr;
    }
    .login-page {
        grid-template-columns: 1fr;
    }
    .login-brand {
        display: none;
    }
    .login-card {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    .calendar-day {
        padding: 6px;
        min-height: 85px;
    }
    .calendar-event {
        font-size: 8px;
    }
}
@media (max-width: 560px) {
    main#content {
        padding: 22px 14px;
    }
    .topbar {
        padding: 0 12px;
        gap: 5px;
    }
    .company-control {
        gap: 6px;
    }
    .company-control select {
        max-width: 165px;
        font-size: 11px;
    }
    .company-mark {
        display: none;
    }
    .top-actions {
        gap: 2px;
    }
    .page-heading {
        align-items: flex-start;
    }
    .page-heading h1 {
        font-size: 23px;
    }
    .page-heading .primary {
        font-size: 10px;
        padding: 9px;
    }
    .metric {
        padding: 14px;
    }
    .metric-value {
        font-size: 20px;
    }
    .metrics {
        gap: 10px;
    }
    .metric-top {
        font-size: 10px;
    }
    .metric-icon {
        width: 25px;
        height: 25px;
    }
    .period-tabs button {
        padding: 7px 8px;
        font-size: 10px;
    }
    .date-filter {
        flex-wrap: wrap;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .calendar-event {
        overflow: hidden;
        max-height: 36px;
    }
    .calendar-day {
        font-size: 10px;
    }
    #modal-body {
        padding: 18px;
    }
    .panel {
        padding: 17px;
    }
}
