:root {
    --portal-primary: #0f2744;
    --portal-primary-soft: #1a3a5c;
    --portal-accent: #c8922a;
    --portal-accent-hover: #b07d1f;
    --portal-bg: #f0f4f9;
    --portal-surface: #ffffff;
    --portal-text: #0f172a;
    --portal-muted: #64748b;
    --portal-border: #e2e8f0;
    --portal-danger: #dc2626;
    --portal-success: #059669;
    --portal-radius: 16px;
    --portal-shadow: 0 8px 24px rgba(15, 39, 68, 0.08);
}

* { box-sizing: border-box; }

body.portal-auth-body,
body.portal-app {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--portal-text);
    background: var(--portal-bg);
    -webkit-font-smoothing: antialiased;
}

/* —— Giriş —— */
.portal-auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background:
        radial-gradient(circle at 20% 20%, rgba(200, 146, 42, 0.18), transparent 45%),
        linear-gradient(145deg, #0f2744 0%, #1a3a5c 55%, #254a73 100%);
}

.portal-auth-shell {
    width: 100%;
    max-width: 420px;
}

.portal-auth-card {
    background: var(--portal-surface);
    border-radius: 22px;
    padding: 2rem 1.75rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
}

.portal-logo {
    display: block;
    margin: 0 auto 1.25rem;
    max-width: 140px;
}

.portal-auth-card h1 {
    text-align: center;
    margin: 0 0 0.35rem;
    color: var(--portal-primary);
    font-size: 1.5rem;
    font-weight: 700;
}

.portal-auth-sub {
    text-align: center;
    color: var(--portal-muted);
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
}

.portal-auth-card label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--portal-muted);
    margin: 0.85rem 0 0.4rem;
}

.portal-auth-card input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--portal-border);
    border-radius: 12px;
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.portal-auth-card input:focus {
    outline: none;
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 3px rgba(200, 146, 42, 0.2);
}

/* —— Butonlar —— */
.portal-btn {
    border: none;
    border-radius: 12px;
    padding: 0.9rem 1.1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, background 0.15s;
}

.portal-btn:active { transform: scale(0.98); }

.portal-btn.primary {
    background: linear-gradient(135deg, var(--portal-accent), #d4a03a);
    color: #fff;
    width: 100%;
    margin-top: 1.25rem;
    box-shadow: 0 4px 14px rgba(200, 146, 42, 0.35);
}

.portal-btn.primary:hover {
    background: linear-gradient(135deg, var(--portal-accent-hover), var(--portal-accent));
}

.portal-btn.ghost {
    background: transparent;
    color: var(--portal-primary);
    width: 100%;
    margin-top: 0.5rem;
}

.portal-error {
    background: #fef2f2;
    color: var(--portal-danger);
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    border: 1px solid #fecaca;
}

.portal-hint {
    font-size: 0.8rem !important;
    margin-top: 1.25rem !important;
    text-align: center;
    color: var(--portal-muted) !important;
}

.hidden { display: none !important; }

/* —— Uygulama kabuğu —— */
.portal-app {
    min-height: 100vh;
    padding-bottom: 78px;
}

.portal-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    background: linear-gradient(135deg, var(--portal-primary), var(--portal-primary-soft));
    color: #fff;
    box-shadow: 0 4px 20px rgba(15, 39, 68, 0.25);
}

.portal-header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.portal-header-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

.portal-header strong {
    display: block;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-header span {
    font-size: 0.78rem;
    opacity: 0.85;
}

.portal-icon-btn {
    border: none;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 1rem;
}

.portal-main {
    padding: 1rem 1rem 0;
    max-width: 720px;
    margin: 0 auto;
}

.portal-view { display: none; animation: portalFade 0.2s ease; }
.portal-view.active { display: block; }

@keyframes portalFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.portal-section-title {
    margin: 0 0 0.85rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--portal-primary);
}

.portal-repeat-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-radius: var(--portal-radius);
    background: linear-gradient(135deg, #fff7ed, #fff);
    border: 1px solid #fed7aa;
    box-shadow: var(--portal-shadow);
}

.portal-repeat-banner strong {
    display: block;
    color: var(--portal-primary);
    font-size: 0.92rem;
}

.portal-repeat-banner span {
    display: block;
    font-size: 0.78rem;
    color: var(--portal-muted);
    margin-top: 0.15rem;
}

.portal-btn-compact {
    width: auto !important;
    margin-top: 0 !important;
    padding: 0.55rem 0.9rem !important;
    font-size: 0.88rem !important;
    white-space: nowrap;
}

.portal-category-filters {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    margin-bottom: 1rem;
    scrollbar-width: none;
}

.portal-category-filters::-webkit-scrollbar { display: none; }

.portal-cat-chip {
    flex: 0 0 auto;
    border: 1.5px solid var(--portal-border);
    background: var(--portal-surface);
    color: var(--portal-muted);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.portal-cat-chip.active {
    background: var(--portal-primary);
    border-color: var(--portal-primary);
    color: #fff;
}

.portal-product-cat {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--portal-accent);
    margin-bottom: 0.2rem;
}

.portal-search-wrap {
    position: relative;
    margin-bottom: 1rem;
}

.portal-search-wrap input {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 2.75rem;
    border-radius: 14px;
    border: 1.5px solid var(--portal-border);
    background: var(--portal-surface);
    font-size: 1rem;
    box-shadow: var(--portal-shadow);
}

.portal-search-wrap::before {
    content: "🔍";
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.95rem;
    opacity: 0.5;
}

/* —— Ürün kartları —— */
.portal-product-list {
    display: grid;
    gap: 0.85rem;
}

@media (min-width: 520px) {
    .portal-product-list { grid-template-columns: 1fr 1fr; }
}

.portal-product-card {
    display: flex;
    flex-direction: column;
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    overflow: hidden;
    box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
    transition: transform 0.15s, box-shadow 0.15s;
}

.portal-product-card:not(.out-of-stock):hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(15, 39, 68, 0.12);
}

.portal-product-card.out-of-stock {
    opacity: 0.85;
    border-style: dashed;
}

.portal-announcements {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1rem;
}

.portal-announcement-card {
    background: linear-gradient(135deg, #eff6ff, #fff);
    border: 1px solid #bfdbfe;
    border-radius: var(--portal-radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--portal-shadow);
}

.portal-announcement-card strong {
    display: block;
    color: var(--portal-primary);
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
}

.portal-announcement-card p {
    margin: 0;
    font-size: 0.84rem;
    color: var(--portal-muted);
    line-height: 1.45;
}

.portal-new-products {
    margin-bottom: 1rem;
}

.portal-new-products-scroll {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scrollbar-width: none;
}

.portal-new-products-scroll::-webkit-scrollbar { display: none; }

.portal-new-product-card {
    flex: 0 0 140px;
    background: var(--portal-surface);
    border-radius: 14px;
    border: 1px solid var(--portal-border);
    padding: 0.65rem;
    cursor: pointer;
    box-shadow: var(--portal-shadow);
}

.portal-new-product-card img {
    width: 100%;
    height: 110px;
    object-fit: contain;
    border-radius: 10px;
    background: #f8fafc;
}

.portal-new-product-card strong {
    display: block;
    font-size: 0.78rem;
    margin-top: 0.4rem;
    line-height: 1.3;
}

.portal-new-product-card span {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--portal-primary);
}

.portal-product-media {
    position: relative;
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 180px;
    cursor: zoom-in;
}

.portal-product-card img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    cursor: zoom-in;
}

.portal-mf-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
    font-size: 0.8rem;
}

.portal-mf-row label {
    font-weight: 600;
    color: var(--portal-muted);
}

.portal-mf-input {
    width: 64px;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.portal-qty-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--portal-muted);
}

.portal-cart-thumb {
    cursor: zoom-in;
}

.portal-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.portal-lightbox.hidden { display: none; }

.portal-lightbox img {
    max-width: min(92vw, 520px);
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    background: #fff;
    padding: 0.5rem;
}

.portal-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

.portal-product-body {
    padding: 0.85rem 1rem 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.portal-product-card h3 {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.35;
    font-weight: 600;
}

.portal-product-card .price {
    color: var(--portal-primary);
    font-weight: 800;
    font-size: 1.05rem;
}

.portal-product-card .stock {
    font-size: 0.75rem;
    color: var(--portal-muted);
}

.portal-product-card .stock.low { color: #b45309; }
.portal-product-card .stock.out { color: var(--portal-danger); }

.portal-qty-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--portal-border);
}

.portal-qty-controls button {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: var(--portal-primary);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
}

.portal-qty-controls button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.portal-qty-controls span {
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 2rem;
    text-align: center;
}

/* —— Sepet —— */
.portal-cart-items { display: grid; gap: 0.75rem; }

.portal-cart-row,
.portal-order-card {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    padding: 1rem;
    box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
}

.portal-cart-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.portal-cart-thumb {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid var(--portal-border);
}

.portal-cart-info strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.92rem;
}

.portal-cart-qty {
    color: var(--portal-muted);
    font-size: 0.85rem;
}

.portal-cart-line-total {
    font-weight: 700;
    color: var(--portal-primary);
    font-size: 0.95rem;
    white-space: nowrap;
}

.portal-cart-summary {
    margin-top: 1rem;
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    padding: 1.15rem;
    box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
}

.portal-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.portal-total-row strong {
    color: var(--portal-primary);
    font-size: 1.25rem;
}

/* —— Ödeme —— */
.portal-payment-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
}

.portal-pay-option {
    position: relative;
    background: var(--portal-surface);
    border: 2px solid var(--portal-border);
    border-radius: 14px;
    padding: 0.9rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
    font-size: 0.88rem;
    font-weight: 600;
}

.portal-pay-option input { position: absolute; opacity: 0; pointer-events: none; }

.portal-pay-option .pay-icon { font-size: 1.4rem; }

.portal-pay-option:has(input:checked) {
    border-color: var(--portal-accent);
    background: #fffbeb;
}

.portal-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--portal-muted);
    margin-bottom: 0.4rem;
}

.portal-field input,
.portal-field textarea {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1.5px solid var(--portal-border);
    border-radius: 12px;
    margin-bottom: 0.85rem;
    font-family: inherit;
}

.portal-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 0.85rem;
}

.portal-empty {
    text-align: center;
    color: var(--portal-muted);
    padding: 3rem 1.5rem;
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    border: 2px dashed var(--portal-border);
}

.portal-empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

/* —— Siparişler —— */
.portal-orders-list { display: grid; gap: 0.85rem; }

.portal-order-card h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.portal-order-meta {
    font-size: 0.8rem;
    color: var(--portal-muted);
    margin-bottom: 0.5rem;
}

.portal-status {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.portal-status.proforma { background: #dbeafe; color: #1d4ed8; }
.portal-status.onaylandi { background: #d1fae5; color: #047857; }
.portal-status.bekliyor { background: #fef3c7; color: #b45309; }

.portal-order-actions {
    margin-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.portal-order-items {
    font-size: 0.88rem;
    color: var(--portal-muted);
    margin: 0.35rem 0;
    line-height: 1.4;
}

.portal-order-total {
    margin-top: 0.35rem;
}

.portal-order-actions button,
.portal-order-actions a {
    border: none;
    border-radius: 10px;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    background: #e8eef7;
    color: var(--portal-primary);
}

.portal-repeat-btn {
    background: #fff7ed !important;
    color: #b45309 !important;
    border: 1px solid #fed7aa !important;
}

.portal-order-actions a {
    background: linear-gradient(135deg, var(--portal-accent), #d4a03a);
    color: #fff;
}

/* —— Alt menü —— */
.portal-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--portal-border);
    padding: 0.4rem 0.5rem calc(0.45rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(15, 39, 68, 0.08);
    max-width: 720px;
    margin: 0 auto;
}

.portal-nav button {
    border: none;
    background: transparent;
    padding: 0.45rem 0.25rem;
    color: var(--portal-muted);
    font-weight: 600;
    font-size: 0.72rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.portal-nav button .nav-icon { font-size: 1.25rem; }

.portal-nav button.active {
    color: var(--portal-primary);
}

.portal-badge {
    position: absolute;
    top: -2px;
    right: calc(50% - 28px);
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--portal-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.portal-nav-item { position: relative; }

.portal-toast {
    position: fixed;
    left: 50%;
    bottom: 92px;
    transform: translateX(-50%);
    background: var(--portal-primary);
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    font-size: 0.9rem;
    z-index: 40;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Portal EXE: tam ekran butonu nav üstünde */
body.portal-app #desktop-fullscreen-btn {
    bottom: 88px;
}