* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Inter", Arial, sans-serif;
    color: #0f172a;
    background: radial-gradient(circle at top, #f8fafc, #e2e8f0);
    min-height: 100vh;
}

.page {
    padding: 32px 24px 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #fff;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.login-card {
    max-width: 420px;
    margin: 80px auto;
    padding: 32px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

.login-subtitle {
    margin: 2px 0 0;
    color: #475569;
    font-weight: 600;
}

.login-intro {
    margin-top: 16px;
    margin-bottom: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px;
}

.login-intro p {
    margin: 0 0 10px;
    color: #334155;
    font-size: 14px;
}

.feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feature-pill {
    background: #dbeafe;
    color: #1e40af;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.login-help {
    margin-top: 12px;
}

.client-logo {
    max-width: 220px;
    max-height: 70px;
    width: auto;
    height: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    object-fit: contain;
}

.client-logo-thumb {
    width: 110px;
    height: 36px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.submit-container {
    max-width: 1180px;
}

.submit-panel {
    padding: 18px;
}

.compact-input-table th,
.compact-input-table td {
    padding-top: 8px;
    padding-bottom: 8px;
}

.compact-input-table input[type="number"] {
    max-width: 140px;
}

.compact-input-table input[type="file"] {
    max-width: 210px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    margin-bottom: 32px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-pill {
    background: #e2e8f0;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 600;
}

.container {
    max-width: 1620px;
    margin: 0 auto;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 20px;
    align-items: start;
}

.dashboard-content {
    min-width: 0;
}

.side-menu {
    position: sticky;
    top: 16px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    padding: 14px;
    display: grid;
    gap: 8px;
}

.side-menu h3 {
    margin: 4px 0 8px;
    font-size: 15px;
}

.side-menu a {
    text-decoration: none;
}

.menu-btn {
    display: block;
    width: 100%;
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 12px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
    cursor: pointer;
    text-align: left;
}

.menu-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
}

.menu-month { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.menu-summary { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.menu-admin-auth { background: linear-gradient(135deg, #1d4ed8, #2563eb); }
.menu-client-new { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }
.menu-client-list { background: linear-gradient(135deg, #0f766e, #22c55e); }
.menu-client-auth { background: linear-gradient(135deg, #4f46e5, #6366f1); }
.menu-contract-new { background: linear-gradient(135deg, #b45309, #f59e0b); }
.menu-email { background: linear-gradient(135deg, #0369a1, #0ea5e9); }
.menu-email-template { background: linear-gradient(135deg, #7e22ce, #c026d3); }
.menu-status { background: linear-gradient(135deg, #15803d, #22c55e); }
.menu-machines { background: linear-gradient(135deg, #334155, #475569); }
.menu-billing { background: linear-gradient(135deg, #be123c, #f43f5e); }
.menu-all { background: linear-gradient(135deg, #111827, #374151); }

.menu-btn.is-active {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: -3px;
}

.dashboard-section.is-hidden {
    display: none !important;
}

@media (max-width: 980px) {
    .menu-btn {
        font-size: 13px;
        padding: 10px 10px;
    }
}

[id] {
    scroll-margin-top: 20px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.chart-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px;
}

.chart-card h3 {
    margin: 0 0 6px;
}

.email-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px;
}

.email-preview h3 {
    margin: 0 0 4px;
}

.email-preview-subject {
    background: #fff;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    padding: 10px 12px;
    margin: 10px 0;
}

.email-preview-body {
    background: #fff;
    border: 1px solid #dbe4f0;
    border-radius: 10px;
    padding: 12px;
    line-height: 1.45;
}

.chart-card canvas {
    width: 100% !important;
    height: 280px !important;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 12px;
}

.stats-client-form {
    display: flex;
    align-items: end;
    gap: 10px;
}

.summary-card {
    background: #fff;
    padding: 20px;
    border-radius: 18px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.summary-card strong {
    font-size: 24px;
    display: block;
    margin-top: 8px;
}

.panel {
    background: #fff;
    padding: 24px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    margin-bottom: 24px;
}

.panel-header h2 {
    margin: 0 0 6px;
}

.form,
.form-row {
    display: grid;
    gap: 16px;
}

.form-row {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    align-items: end;
}

.form-row.compact {
    margin-top: 16px;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

input,
select,
textarea {
    border: 1px solid #cbd5f5;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    color: #fff;
}

.btn-secondary {
    background: #0f172a;
    color: #fff;
}

.contracts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.contracts-list {
    display: grid;
    gap: 12px;
}

.contract-item {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.contract-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-left: 4px solid #2563eb;
}

.contract-summary::-webkit-details-marker {
    display: none;
}

.summary-mini-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: #334155;
    font-weight: 600;
    font-size: 13px;
}

.contract-item-body {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
}

.status-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 10px;
}

.months-line {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.month-pill {
    display: inline-block;
    background: #e2e8f0;
    color: #1e293b;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}

.contract-card {
    background: #fff;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    display: grid;
    gap: 16px;
}

.contract-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 600;
    font-size: 12px;
    margin-top: 6px;
}

.totals {
    display: grid;
    gap: 8px;
    text-align: right;
}

.readings {
    background: #f8fafc;
    border-radius: 14px;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.readings-header,
.reading-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 12px;
    font-size: 13px;
}

.readings-header {
    font-weight: 700;
    color: #64748b;
}

.reading-row.muted {
    color: #94a3b8;
}

.reading-row-form {
    align-items: center;
}

.reading-row-form input {
    width: 100%;
    min-width: 90px;
}

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    margin-top: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 10px 8px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
}

th {
    font-weight: 700;
    color: #334155;
}

tfoot th {
    background: #f8fafc;
}

.billing-table tbody tr:nth-child(even) {
    background: #dde7f5;
}

.billing-table tbody tr:hover {
    background: #c8d7f0;
}

.billing-table .num {
    text-align: right;
    white-space: nowrap;
}

.billing-table .totals-label {
    text-align: left;
    font-weight: 700;
}

.billing-total-row th {
    background: #e2e8f0;
    border-top: 2px solid #cbd5e1;
    font-size: 15px;
}

.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
}

.status-green {
    background: #22c55e;
}

.status-red {
    background: #ef4444;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.muted,
.small-muted {
    color: #64748b;
    font-size: 13px;
}

.est-label {
    display: inline-block;
    margin-left: 6px;
    color: #0c4a6e;
    background: #dbeafe;
    border-radius: 8px;
    padding: 2px 6px;
    font-style: normal;
    font-size: 11px;
    font-weight: 700;
}

@media (max-width: 980px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .side-menu {
        position: static;
    }
}
