/* TT Commercial Sales — Brand Styling */

:root {
    --tt-red: #E31937;
    --tt-red-hover: #C41530;
    --tt-yellow: #ffd201;
    --tt-dark: #242424;
    --tt-light-grey: #F5F5F5;
    --tt-white: #FFFFFF;
    --tt-border: #E0E0E0;
    --tt-text: #333333;
    --tt-text-light: #666666;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--tt-text);
    background: var(--tt-light-grey);
    line-height: 1.5;
}

/* --- Login overlay --- */

.login-overlay {
    position: fixed;
    inset: 0;
    background: var(--tt-light-grey);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.login-card {
    background: var(--tt-white);
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    border-top: 4px solid var(--tt-yellow);
}

.login-logo {
    height: 48px;
    width: auto;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--tt-dark);
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--tt-text);
    margin-bottom: 0.35rem;
}

.input-field {
    width: 100%;
    padding: 0.65rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid var(--tt-border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--tt-red);
}

.form-error {
    color: var(--tt-red);
    font-size: 0.8rem;
    min-height: 1.25rem;
    margin: 0.5rem 0;
    text-align: left;
}

.login-hint {
    font-size: 0.8rem;
    color: var(--tt-text-light);
    margin-top: 1rem;
}

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--tt-red);
    color: var(--tt-white);
}

.btn-primary:hover:not(:disabled) {
    background: var(--tt-red-hover);
}

.btn-dark {
    background: var(--tt-dark);
    color: var(--tt-white);
}

.btn-dark:hover:not(:disabled) {
    background: #111111;
}

.btn-full {
    width: 100%;
}

.btn-link {
    background: none;
    border: none;
    color: var(--tt-text-light);
    font-size: 0.85rem;
    cursor: pointer;
    margin-top: 1rem;
    padding: 0.25rem 0;
}

.btn-link:hover {
    color: var(--tt-text);
}

/* --- OTP inputs --- */

.otp-instructions {
    font-size: 0.9rem;
    color: var(--tt-text-light);
    margin-bottom: 1.25rem;
}

.otp-inputs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.otp-digit {
    width: 3rem;
    height: 3.25rem;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--tt-border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.otp-digit:focus {
    border-color: var(--tt-red);
}

/* --- Header --- */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--tt-dark);
    color: var(--tt-white);
    padding: 0 1rem;
    height: 56px;
    border-bottom: 4px solid var(--tt-yellow);
}

.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 36px;
    width: auto;
}

.header-tabs {
    display: flex;
    gap: 0.25rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--tt-white);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: 4px;
    position: relative;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tab-btn:hover {
    opacity: 1;
}

.tab-btn.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.cart-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--tt-red);
    color: var(--tt-white);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-email {
    font-size: 0.8rem;
    opacity: 0.8;
}

.logout-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--tt-white);
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
}

.logout-btn:hover {
    border-color: var(--tt-white);
}

/* --- Main content --- */

.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- Home tab --- */

.home-hero {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 1rem 0;
}

.home-hero h1 {
    font-size: 1.75rem;
    color: var(--tt-dark);
    margin-bottom: 0.5rem;
}

.home-subtitle {
    font-size: 1rem;
    color: var(--tt-text-light);
}

.home-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.step-card {
    background: var(--tt-white);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--tt-yellow);
    color: var(--tt-dark);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.step-card h2 {
    font-size: 1rem;
    color: var(--tt-dark);
    margin-bottom: 0.5rem;
}

.step-card p {
    font-size: 0.875rem;
    color: var(--tt-text-light);
    line-height: 1.5;
}

.home-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.info-card {
    background: var(--tt-white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.info-card h2 {
    font-size: 1rem;
    color: var(--tt-dark);
    margin-bottom: 0.5rem;
}

.info-card p {
    font-size: 0.875rem;
    color: var(--tt-text-light);
    line-height: 1.5;
}

/* --- Products tab --- */

.products-search {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--tt-light-grey);
    padding-top: 0.5rem;
    padding-bottom: 0.75rem;
}

.search-wrapper {
    flex: 1;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tt-text-light);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    font-size: 0.9rem;
    border: 1px solid var(--tt-border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
    background: var(--tt-white);
}

.search-input:focus {
    border-color: var(--tt-red);
}

.products-count {
    font-size: 0.8rem;
    color: var(--tt-text-light);
    white-space: nowrap;
}

.products-layout {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}

/* Category sidebar */

.category-sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--tt-white);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 1rem;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    position: sticky;
    top: 3.5rem;
}

.sidebar-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--tt-dark);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--tt-border);
}

.cat-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.5rem;
    min-height: 36px;
    font-size: 0.85rem;
    color: var(--tt-text);
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.cat-item:hover {
    background: var(--tt-light-grey);
}

.cat-item.active {
    background: #e8e8e8;
    color: var(--tt-dark);
    font-weight: 600;
}

.cat-item .cat-count {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.6;
}

.cat-item.active .cat-count {
    opacity: 1;
}

.cat-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.1rem;
    font-size: 0.65rem;
    margin-right: 0.25rem;
    cursor: pointer;
    color: var(--tt-text-light);
    flex-shrink: 0;
    user-select: none;
}

.cat-children {
    padding-left: 0.75rem;
}

.cat-children.collapsed {
    display: none;
}

/* Product list */

.product-list-wrapper {
    flex: 1;
    min-width: 0;
}

.products-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 0;
    color: var(--tt-text-light);
}

.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--tt-border);
    border-top-color: var(--tt-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.products-empty {
    text-align: center;
    padding: 3rem 0;
    color: var(--tt-text-light);
    font-size: 0.95rem;
}

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

.product-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--tt-white);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 0.75rem 1rem;
}

.product-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--tt-white);
    flex-shrink: 0;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tt-dark);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-sku {
    font-size: 0.75rem;
    color: var(--tt-text-light);
}

.product-brand {
    font-size: 0.8rem;
    color: var(--tt-text-light);
    font-style: italic;
}

.product-link {
    color: var(--tt-text-light);
    opacity: 0.5;
    transition: opacity 0.15s, color 0.15s;
    vertical-align: middle;
    display: inline-flex;
    margin-left: 0.25rem;
}

.product-link:hover {
    opacity: 1;
    color: var(--tt-red);
}

.btn-show-more {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--tt-dark);
    background: var(--tt-white);
    border: 1px solid var(--tt-border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-show-more:hover {
    background: var(--tt-light-grey);
    border-color: var(--tt-text-light);
}

.stock-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.stock-badge.in-stock {
    background: #e6f4ea;
    color: #1e7e34;
}

.stock-badge.out-of-stock {
    background: #fde8e8;
    color: #9b1c1c;
}

.stock-badge.preorder {
    background: #fef3c7;
    color: #92400e;
}

.product-pricing {
    text-align: right;
    flex-shrink: 0;
    min-width: 80px;
}

.price-rrp {
    font-size: 0.75rem;
    color: var(--tt-text-light);
    text-decoration: line-through;
}

.price-tier {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--tt-red);
}

.price-gst-label {
    font-size: 0.7rem;
    font-weight: 400;
    color: #666;
}

.product-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.qty-input {
    width: 52px;
    padding: 0.5rem 0.25rem;
    min-height: 38px;
    text-align: center;
    border: 1px solid var(--tt-border);
    border-radius: 4px;
    font-size: 0.85rem;
    outline: none;
}

.qty-input:focus {
    border-color: var(--tt-red);
}

.btn-add {
    background: var(--tt-yellow);
    color: var(--tt-dark);
    border: none;
    padding: 0.5rem 0.75rem;
    min-height: 38px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, opacity 0.15s;
}

.btn-add:hover:not(:disabled) {
    background: #e6be00;
}

.btn-add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toast notifications */

.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--tt-dark);
    color: var(--tt-white);
    padding: 0.65rem 1.25rem;
    border-radius: 6px;
    font-size: 0.85rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toast-in 0.25s ease-out;
    max-width: 320px;
}

.toast.toast-error {
    background: var(--tt-red);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Cart tab --- */

.cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 0;
    color: var(--tt-text-light);
}

.cart-empty {
    text-align: center;
    padding: 4rem 1rem;
}

.cart-empty p {
    font-size: 1rem;
    color: var(--tt-text-light);
    margin-bottom: 1.5rem;
}

.cart-confirmation {
    text-align: center;
    padding: 4rem 1rem;
}

.confirmation-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #e6f4ea;
    color: #1e7e34;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.cart-confirmation h2 {
    font-size: 1.5rem;
    color: var(--tt-dark);
    margin-bottom: 0.5rem;
}

.cart-confirmation p {
    color: var(--tt-text-light);
    margin-bottom: 1.5rem;
}

.cart-heading {
    font-size: 1.25rem;
    color: var(--tt-dark);
    margin-bottom: 1rem;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.cart-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--tt-white);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 0.75rem 1rem;
}

.cart-item-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--tt-light-grey);
    flex-shrink: 0;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--tt-dark);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item-sku {
    font-size: 0.75rem;
    color: var(--tt-text-light);
    margin-bottom: 0.5rem;
}

.cart-item-notes {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid var(--tt-border);
    border-radius: 4px;
    outline: none;
    resize: vertical;
    min-height: 2rem;
    max-height: 4rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.cart-item-notes:focus {
    border-color: var(--tt-red);
}

.cart-item-qty-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}

.cart-item-unit-price {
    font-size: 0.75rem;
    color: var(--tt-text-light);
}

.cart-item-line-total {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--tt-red);
}

.cart-item-qty {
    width: 52px;
    padding: 0.5rem 0.25rem;
    min-height: 38px;
    text-align: center;
    border: 1px solid var(--tt-border);
    border-radius: 4px;
    font-size: 0.85rem;
    outline: none;
}

.cart-item-qty:focus {
    border-color: var(--tt-red);
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--tt-text-light);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    align-self: flex-start;
}

.cart-item-remove:hover {
    color: var(--tt-red);
    background: #fde8e8;
}

.cart-qty-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.btn-update-qty {
    background: var(--tt-dark);
    color: var(--tt-white);
    border: none;
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.btn-update-qty:hover {
    opacity: 0.85;
}

.cart-preorder-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    background: #fef3c7;
    color: #92400e;
    margin-bottom: 0.35rem;
}

.cart-stock-warning {
    font-size: 0.75rem;
    margin-top: 0.35rem;
    font-weight: 500;
}

.cart-stock-ok {
    color: #1e7e34;
}

.cart-stock-low {
    color: #92400e;
}

.cart-stock-error {
    color: #9b1c1c;
}

.cart-order-notes {
    margin-bottom: 1.5rem;
}

.order-notes-input {
    width: 100%;
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid var(--tt-border);
    border-radius: 6px;
    outline: none;
    resize: vertical;
    min-height: 3.5rem;
    max-height: 8rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--tt-white);
}

.order-notes-input:focus {
    border-color: var(--tt-red);
}

.cart-totals {
    background: var(--tt-white);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.9rem;
    color: var(--tt-text);
}

.totals-total {
    border-top: 2px solid var(--tt-border);
    margin-top: 0.35rem;
    padding-top: 0.6rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--tt-dark);
}

.btn-place-order {
    padding: 0.85rem 1.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: var(--tt-dark);
}

.btn-place-order:hover:not(:disabled) {
    background: #333;
}

.cart-error {
    text-align: center;
}

.sort-select {
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid var(--tt-border);
    border-radius: 6px;
    outline: none;
    background: var(--tt-white);
    cursor: pointer;
    min-width: 160px;
}

.sort-select:focus {
    border-color: var(--tt-red);
}

.sidebar-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tt-dark);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--tt-border);
}

.clear-filter {
    font-size: 0.75rem;
    color: var(--tt-red);
    cursor: pointer;
    float: right;
    background: none;
    border: none;
    padding: 0;
}

.clear-filter:hover {
    text-decoration: underline;
}

/* Mobile filter drawer */
.filter-toggle-btn {
    display: none;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--tt-border);
    border-radius: 6px;
    background: var(--tt-white);
    cursor: pointer;
    margin-bottom: 0.75rem;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--tt-text-light);
    float: right;
    padding: 0;
    line-height: 1;
}

.filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

/* --- Home CTA --- */

.home-cta {
    text-align: center;
    margin-bottom: 2.5rem;
}

.btn-large {
    padding: 0.85rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

/* --- Stock filter --- */

.stock-filter-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--tt-text);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.stock-filter-checkbox {
    accent-color: var(--tt-red);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* --- Scroll to top --- */

.scroll-top-btn {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--tt-dark);
    color: var(--tt-white);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 50;
    transition: opacity 0.2s;
}

.scroll-top-btn:hover {
    opacity: 0.8;
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Focus styles --- */

.tab-btn:focus-visible,
.cat-item:focus-visible,
.btn:focus-visible,
.btn-add:focus-visible,
.btn-link:focus-visible,
.logout-btn:focus-visible,
.cart-item-remove:focus-visible,
.scroll-top-btn:focus-visible,
.btn-show-more:focus-visible,
.filter-toggle-btn:focus-visible {
    outline: 2px solid var(--tt-dark);
    outline-offset: 2px;
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .home-steps {
        grid-template-columns: 1fr;
    }

    .home-info {
        grid-template-columns: 1fr;
    }

    .products-search {
        flex-wrap: wrap;
    }
    .search-wrapper {
        flex: 1 1 100%;
    }
    .sort-select {
        min-width: 0;
        flex: 1;
    }
    .products-count {
        flex: 1;
        text-align: right;
    }

    .products-layout {
        flex-direction: column;
    }

    .filter-toggle-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
    }

    .category-sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: min(280px, calc(100vw - 40px));
        min-width: min(280px, calc(100vw - 40px));
        height: 100vh;
        max-height: 100vh;
        z-index: 100;
        border-radius: 0;
        transition: left 0.25s ease;
        padding-top: 0.5rem;
    }

    .category-sidebar.open {
        left: 0;
    }

    .sidebar-close {
        display: block;
    }

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

    .product-row {
        flex-wrap: wrap;
    }

    .product-info {
        flex: 1 1 calc(100% - 80px);
    }

    .product-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 0.25rem;
    }

    .cart-item {
        flex-wrap: wrap;
    }

    .cart-item-details {
        flex: 1 1 calc(100% - 80px);
    }

    .cart-item-qty-price {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

@media (max-width: 640px) {
    .app-header {
        flex-wrap: wrap;
        height: auto;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .header-tabs {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .header-right {
        gap: 0.5rem;
    }

    .user-email {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-main {
        padding: 1rem 0.5rem;
    }

    .login-card {
        padding: 2rem 1.25rem;
    }

    .otp-digit {
        width: 2.5rem;
        height: 2.75rem;
        font-size: 1.25rem;
    }

    .otp-inputs {
        gap: 0.35rem;
    }

    .home-hero h1 {
        font-size: 1.35rem;
    }
}
