body {
    font-family: system-ui, sans-serif;
    background: #f5f6fa;
    color: #1c1e21;
    margin: 0;
}

.page {
    max-width: 720px;
    margin: 3rem auto;
    padding: 0 1.5rem;
}

.page h1 {
    margin-bottom: 1.5rem;
}

.page-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-top h1 {
    margin-bottom: 0;
}

.settings-link {
    text-decoration: none;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

.settings-link:hover {
    opacity: 1;
}

.settings-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.settings-card h2 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
}

.settings-card label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: #4a5568;
    margin: 1rem 0;
}

.settings-card input {
    padding: 0.6rem 0.7rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.alert--success {
    background: #ecfdf5;
    color: #047857;
}

.alert--error {
    background: #fef2f2;
    color: #b91c1c;
}

.alert a {
    color: inherit;
    font-weight: 600;
}

.view-toggle {
    display: inline-flex;
    gap: 0.4rem;
    background: #fff;
    padding: 0.3rem;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.25rem;
}

.view-toggle__btn {
    border: none;
    background: transparent;
    padding: 0.4rem 0.9rem;
    border-radius: 7px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
}

.view-toggle__btn:hover {
    color: #374151;
}

.view-toggle__btn--active {
    background: #eef2ff;
    color: #4338ca;
}

.product-container--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.product-container--list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.product-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.product-card__photo {
    aspect-ratio: 3 / 4;
    background: #f1f3f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-card__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card__no-photo {
    color: #9aa2b1;
    font-size: 0.85rem;
}

.product-card__body {
    padding: 0.9rem 1rem;
}

.product-card__title {
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0 0 0.35rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card__meta {
    font-size: 0.8rem;
    margin: 0.2rem 0;
}

.product-container--list .product-card {
    display: flex;
    align-items: center;
}

.product-container--list .product-card__photo {
    width: 56px;
    height: 56px;
    aspect-ratio: unset;
    flex-shrink: 0;
}

.product-container--list .product-card__no-photo {
    font-size: 0.6rem;
    text-align: center;
}

.product-container--list .product-card__body {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    flex: 1;
}

.product-container--list .product-card__title {
    -webkit-line-clamp: 1;
    margin: 0;
    flex: 1 1 240px;
    min-width: 0;
}

.product-container--list .product-card__meta {
    margin: 0;
    white-space: nowrap;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1.25rem;
}

.tile {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: #1c1e21;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.tile__icon {
    font-size: 2.5rem;
}

.tile__title {
    font-weight: 600;
    font-size: 1.05rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: #4a5568;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.muted {
    color: #6b7280;
}

.page--wide {
    max-width: 1400px;
}

.btn-primary,
.btn-secondary {
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #eef0f3;
    color: #374151;
}

.btn-secondary:hover {
    background: #e2e5ea;
}

#open-add-purchase {
    margin-bottom: 1.5rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    position: relative;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 480px;
    padding: 1.75rem;
}

.modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.9rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #9aa2b1;
    cursor: pointer;
}

.modal__close:hover {
    color: #374151;
}

.wizard-progress {
    margin-bottom: 1.5rem;
}

.wizard-progress__bar {
    height: 6px;
    background: #edf0f3;
    border-radius: 999px;
    overflow: hidden;
}

.wizard-progress__fill {
    height: 100%;
    background: #2563eb;
    border-radius: 999px;
    transition: width 0.2s ease;
    width: 0%;
}

.wizard-progress__label {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #9aa2b1;
}

.wizard-step h2 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem;
}

.wizard-step__hint {
    font-size: 0.85rem;
    color: #9aa2b1;
    margin: 0 0 1rem;
}

.wizard-step label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 1rem;
}

.wizard-step input {
    padding: 0.7rem 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 1.1rem;
}

.wizard-step input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.wizard-nav .btn-primary,
.wizard-nav #wizard-submit {
    margin-left: auto;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid #edf0f3;
}

.data-table th {
    background: #f8f9fb;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #f8f9fb;
}

.data-table .ta-right {
    text-align: right;
}

.data-table--compact td {
    padding: 0.55rem 0.9rem;
}

.data-table code {
    background: #f1f3f6;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}

.order-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.order-card__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fafbfc;
    border-bottom: 1px solid #edf0f3;
}

.order-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.order-card__number {
    font-weight: 700;
    font-size: 1.05rem;
}

.order-card__number--muted {
    color: #9aa2b1;
    font-weight: 600;
}

.order-card__date {
    color: #6b7280;
    font-size: 0.85rem;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    background: #eef2ff;
    color: #4338ca;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge--active {
    background: #ecfdf5;
    color: #047857;
}

.order-card__totals {
    display: flex;
    gap: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat__value {
    font-weight: 700;
    font-size: 1.05rem;
}

.stat__label {
    font-size: 0.7rem;
    color: #9aa2b1;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat--highlight .stat__value {
    color: #2563eb;
    font-size: 1.2rem;
}

.cost-price {
    font-weight: 700;
}

.cost-breakdown {
    font-size: 0.75rem;
    color: #9aa2b1;
}
