* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #050506;
    --surface: #1a1b1e;
    --surface-2: #202126;
    --surface-3: #111214;
    --line: rgba(255,255,255,0.08);
    --line-strong: rgba(255,255,255,0.13);
    --text: #f8fafc;
    --muted: #9aa1ad;
    --muted-2: #737b88;
    --blue: #4f9cff;
    --blue-strong: #2481ff;
    --green: #4ade80;
    --yellow: #facc15;
    --red: #fb7185;
    --radius: 20px;
}

html,
body {
    width: 100%;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Arial, sans-serif;
}

body {
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

.app {
    width: 100%;
    min-height: 100vh;
    background: var(--bg);
}

.app-content {
    min-height: 100vh;
    padding: 22px 16px 118px;
}

/* HEADER */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 22px;
}

.page-header h1 {
    font-size: 34px;
    line-height: 1.1;
    font-weight: 900;
    letter-spacing: 0;
    color: var(--text);
}

.page-header p {
    margin-top: 8px;
    font-size: 16px;
    color: var(--muted);
}

/* BUTTONS */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, #3b8cff, #1769f2);
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.btn.secondary {
    background: var(--surface-2);
    color: #e5e7eb;
    box-shadow: none;
}

.btn.danger {
    background: rgba(251, 113, 133, 0.12);
    border-color: rgba(251, 113, 133, 0.22);
    color: var(--red);
    box-shadow: none;
}

button.btn {
    width: 100%;
}

.btn:disabled,
button:disabled,
input:disabled,
select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.notice {
    margin: 0 0 14px;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
}

.notice.success {
    background: rgba(74, 222, 128, 0.12);
    color: var(--green);
    border: 1px solid rgba(74, 222, 128, 0.24);
}

.notice.warning {
    background: rgba(250, 204, 21, 0.12);
    color: var(--yellow);
    border: 1px solid rgba(250, 204, 21, 0.24);
}

.floating-add-btn {
    position: fixed;
    right: 22px;
    bottom: 110px;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(180deg, #3b8cff, #1769f2);
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    box-shadow:
        0 16px 34px rgba(36, 129, 255, 0.35),
        inset 0 1px 0 rgba(255,255,255,0.20);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.floating-add-btn:active {
    transform: scale(0.94);
    box-shadow:
        0 10px 22px rgba(36, 129, 255, 0.28),
        inset 0 1px 0 rgba(255,255,255,0.18);
}

.top-add-btn {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 16px;
    background: linear-gradient(180deg, #3b8cff, #1769f2);
    color: #ffffff;
    font-size: 30px;
    line-height: 1;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 12px 26px rgba(36, 129, 255, 0.28),
        inset 0 1px 0 rgba(255,255,255,0.20);
}

/* CARDS */

.card {
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-top: 16px;
    box-shadow: none;
}

.customer-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.customer-card {
    display: block;
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    color: var(--text);
}

.customer-card-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.customer-card h3 {
    font-size: 20px;
    line-height: 1.2;
    font-weight: 800;
    color: var(--text);
}

.customer-card p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 15px;
}

.customer-card-info {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 14px;
    color: #e5e7eb;
    font-size: 15px;
}

/* INVOICES */

.invoice-number {
    margin-top: 6px;
    color: #9ca3af;
    font-size: 15px;
}

.invoice-meta {
    margin-top: 12px;
    color: #d1d5db;
    font-size: 16px;
}

.invoice-meta strong {
    color: #ffffff;
    font-size: 18px;
    font-weight: 800;
}

/* BADGES */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 800;
}

.badge.success {
    color: #4ade80;
}

.badge.muted {
    color: #9ca3af;
}

.badge.danger {
    color: #f87171;
}

/* TOOLBAR */

.customer-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 22px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.search-input,
input {
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    outline: none;
}

.search-input::placeholder,
input::placeholder {
    color: var(--muted-2);
}

.search-input:focus,
input:focus {
    border-color: var(--blue);
}

select,
textarea,
input[type="email"],
input[type="number"],
input[type="date"],
input[type="file"] {
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    outline: none;
}

select:focus,
textarea:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="file"]:focus {
    border-color: var(--blue);
}

select {
    appearance: none;
    -webkit-appearance: none;
}

textarea {
    min-height: 92px;
    padding-top: 14px;
    padding-bottom: 14px;
    resize: vertical;
    line-height: 1.35;
}

.form-card {
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-top: 16px;
}

.form-section-title,
.form-card h3 {
    margin: 20px 0 12px;
    color: var(--text);
    font-size: 22px;
    line-height: 1.15;
    font-weight: 900;
}

.form-section-title:first-child,
.form-card h3:first-child {
    margin-top: 0;
}

.secondary-btn {
    width: 100%;
    min-height: 46px;
    margin: 8px 0 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 900;
}

.toggle-row,
.switch-row {
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    margin: 10px 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.toggle-row strong,
.switch-text strong {
    display: block;
    color: var(--text);
    font-size: 17px;
    font-weight: 900;
    margin-bottom: 5px;
}

.toggle-row span,
.switch-text small {
    display: block;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.toggle-row input[type="checkbox"] {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.detail-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}

.detail-actions form {
    margin: 0;
}

.detail-action {
    width: 100%;
    min-height: 52px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface-2);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
}

.detail-action.primary {
    background: linear-gradient(180deg, #3b8cff, #1769f2);
    color: #ffffff;
}

.detail-action.danger {
    background: rgba(251, 113, 133, 0.12);
    border-color: rgba(251, 113, 133, 0.22);
    color: var(--red);
}

.detail-card {
    padding: 6px 18px;
}

.detail-row {
    display: grid;
    grid-template-columns: 42% 58%;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row span {
    color: var(--muted);
    font-size: 15px;
    font-weight: 800;
}

.detail-row strong {
    color: var(--text);
    font-size: 16px;
    font-weight: 700;
    word-break: break-word;
}

.status-green {
    color: var(--green) !important;
}

.status-muted {
    color: var(--muted) !important;
}

.empty-state {
    padding: 22px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

/* TABS */

.tabs {
    display: flex;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 4px;
    border-radius: 16px;
}

.tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 13px;
    color: var(--muted);
    font-weight: 800;
    font-size: 15px;
}

.tab.active {
    background: #ffffff;
    color: #111827;
}

.period-switch {
    display: grid;
    grid-template-columns: 1fr 0.78fr 0.82fr;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 5px;
    margin-bottom: 18px;
}

.period-switch a {
    min-height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
    text-align: center;
}

.period-switch a.active {
    background: #ffffff;
    color: #111827;
}

.custom-period {
    margin: -4px 0 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    overflow: hidden;
}

.custom-period-toggle {
    width: 100%;
    min-height: 46px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}

.custom-period-toggle span:first-child {
    flex: 1;
    text-align: left;
}

.custom-period-chevron {
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    transition: transform 0.18s ease;
}

.custom-period.is-open .custom-period-chevron {
    transform: rotate(180deg);
}

.custom-period form {
    display: none;
    padding: 0 16px 16px;
    gap: 14px;
}

.custom-period.is-open form {
    display: flex;
}

.custom-period-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.custom-period label {
    display: block;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.custom-period input[type="date"] {
    margin-top: 6px;
    width: 100%;
    min-height: 44px;
    height: 44px;
    padding: 0 10px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 44px;
    text-align: center;
    -webkit-appearance: none;
    appearance: none;
}

.custom-period input[type="date"]::-webkit-date-and-time-value {
    text-align: center;
}

.custom-period input[type="date"]::-webkit-calendar-picker-indicator {
    margin-left: 0;
}

/* FORMS */

form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

label {
    font-size: 15px;
    font-weight: 800;
    color: #e5e7eb;
}

input {
    margin-bottom: 2px;
}

/* TABLE FALLBACK */

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

th {
    text-align: left;
    color: #9ca3af;
    font-size: 13px;
    padding: 10px;
}

td {
    padding: 12px 10px;
    border-bottom: 1px solid #2f2f33;
    color: #ffffff;
}

.table-link {
    color: #2481ff;
    font-weight: 800;
}

/* BOTTOM NAV */

.bottom-nav {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: 12px;
    height: 82px;
    padding: 8px;
    background:
        linear-gradient(180deg, rgba(30, 31, 34, 0.92), rgba(13, 14, 16, 0.94));
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 26px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    box-shadow:
        0 18px 46px rgba(0,0,0,0.48),
        inset 0 1px 0 rgba(255,255,255,0.07);
    z-index: 50;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    height: 64px;
    border-radius: 20px;
    color: #8f96a3;
    font-weight: 900;
    position: relative;
    transition: transform 0.16s ease, color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.bottom-nav-item span {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bottom-nav-item svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    display: block;
}

.bottom-nav-item small {
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
}

.bottom-nav-item.active {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.08),
        0 8px 20px rgba(0,0,0,0.20);
}

.bottom-nav-item.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 7px;
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: #4f9cff;
    transform: translateX(-50%);
    box-shadow: 0 0 14px rgba(79,156,255,0.55);
}

.bottom-nav-item.active svg {
    color: #4f9cff;
}

.bottom-nav-item:active {
    transform: scale(0.96);
}

/* DESKTOP SAFETY */

@media (min-width: 768px) {
    .app {
        max-width: 430px;
        margin: 0 auto;
    }
}
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 80;
    display: none;
}

.sheet-overlay.active {
    display: block;
}

.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -90%;
    z-index: 90;
    background: #111113;
    border-radius: 28px 28px 0 0;
    padding: 12px 18px 110px;
    transition: bottom .25s ease;
    max-height: 86vh;
    overflow-y: auto;
}

.bottom-sheet.active {
    bottom: 0;
}

.sheet-handle {
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: #3f3f46;
    margin: 0 auto 18px;
}

.bottom-sheet h2 {
    font-size: 28px;
    margin-bottom: 18px;
}

.sheet-info {
    background: #1c1c1e;
    border-radius: 20px;
    padding: 6px 16px;
}

.sheet-info div {
    display: grid;
    grid-template-columns: 35% 65%;
    gap: 10px;
    padding: 13px 0;
    border-bottom: 1px solid #2f2f33;
}

.sheet-info div:last-child {
    border-bottom: none;
}

.sheet-info span {
    color: #9ca3af;
    font-weight: 700;
}

.sheet-info strong {
    color: white;
    font-weight: 600;
    word-break: break-word;
}

.sheet-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 18px 0;
}

.sheet-action {
    min-height: 54px;
    border-radius: 18px;
    background: #1c1c1e;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 17px;
}

.sheet-action.primary {
    background: #2481ff;
}

.sheet-section {
    margin-top: 20px;
}

.sheet-section h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

.mini-invoice {
    background: #1c1c1e;
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.mini-invoice strong {
    display: block;
    margin-bottom: 5px;
}

.mini-invoice span {
    color: #9ca3af;
    font-size: 14px;
}

.mini-invoice em {
    font-style: normal;
    font-weight: 800;
    white-space: nowrap;
}

.mini-invoice .paid {
    color: #4ade80;
}

.mini-invoice .waiting {
    color: #9ca3af;
}

.mini-invoice .late {
    color: #f87171;
}
