:root {
    color-scheme: light;
    --ink: #1f1f1d;
    --muted: #706b63;
    --line: #ded8cf;
    --surface: #ffffff;
    --page: #f7f5f1;
    --accent: #a84832;
    --accent-dark: #873522;
    --sage: #506a5f;
    --focus: rgba(168, 72, 50, 0.2);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--page);
    color: var(--ink);
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    padding: 0 14px;
    cursor: pointer;
}

button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent-dark);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

button.primary {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

button.primary:hover:not(:disabled) {
    background: var(--accent-dark);
    color: #ffffff;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--ink);
}

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
}

textarea {
    min-height: 86px;
    resize: vertical;
}

.portal {
    width: min(1420px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(420px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 28px;
    box-shadow: 0 18px 44px rgba(31, 31, 29, 0.08);
}

.login-card h1 {
    margin-bottom: 22px;
    font-size: 34px;
}

.login-card button {
    width: 100%;
    margin-top: 4px;
}

.login-message {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f5f1eb;
    color: var(--accent-dark);
    padding: 10px 12px;
    font-size: 13px;
}

.toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin: 0 -16px;
    padding: 16px 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(247, 245, 241, 0.96);
    backdrop-filter: blur(8px);
}

.session-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
}

.session-box span {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand {
    margin: 0 0 4px;
    color: var(--sage);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
}

h1:focus {
    outline: none;
}

h2 {
    margin: 30px 0 14px;
    font-size: 28px;
}

.summary {
    min-width: 220px;
    text-align: right;
}

.summary span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.summary strong {
    display: block;
    margin-top: 4px;
    font-size: 28px;
}

.summary small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.actions input[type="search"] {
    width: min(320px, 100%);
    height: 38px;
    margin-left: auto;
    padding: 0 12px;
}

.workspace-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.workspace-tabs button.active {
    border-color: var(--sage);
    background: var(--sage);
    color: #ffffff;
}

.control-panel,
.management-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.panel-block,
.form-card,
.table-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 16px;
}

.table-card.full {
    margin-top: 16px;
}

.panel-block h2,
.form-card h2,
.table-card h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.panel-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.panel-header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.extra-cost-panel {
    margin-top: 16px;
}

.extra-cost-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.extra-cost-row {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) 120px 110px auto;
    gap: 8px;
    align-items: center;
}

.extra-cost-row input {
    min-width: 0;
    min-height: 38px;
    padding: 0 10px;
}

.extra-cost-row span {
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
}

.field {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 13px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
}

.inline-form input {
    min-height: 38px;
    padding: 0 10px;
}

.selected-dealer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    color: var(--muted);
}

.selected-dealer strong {
    color: var(--ink);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

tr.clickable {
    cursor: pointer;
}

tr.clickable:hover td {
    background: #f5f1eb;
}

.order-lines {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.order-lines span {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    padding: 5px 9px;
    color: var(--muted);
    font-size: 12px;
}

.row-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.small-button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
}

.empty.compact {
    margin-top: 0;
}

.status-line {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 13px;
}

.status-line span {
    min-height: 24px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    padding: 4px 10px;
}

.message,
.loading,
.empty {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 16px;
    color: var(--muted);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.product-card {
    position: relative;
    display: grid;
    grid-template-rows: 178px 104px auto auto;
    min-height: 350px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
}

.product-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus);
}

.hide-button {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 28px;
    min-height: 28px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
}

.image-frame {
    display: grid;
    place-items: center;
    min-height: 0;
    overflow: hidden;
    background: #eee9e2;
    padding: 10px;
}

.image-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.product-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    background: var(--surface);
    padding: 12px 12px 6px;
}

.product-body h3 {
    display: -webkit-box;
    min-height: 58px;
    margin-bottom: 0;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 12px;
}

.product-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-meta strong {
    flex: 0 0 auto;
    color: var(--ink);
}

.quantity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}

.quantity input {
    width: 74px;
    height: 34px;
    padding: 0 8px;
    text-align: right;
}

.variant-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px auto;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
}

.variant-picker select,
.variant-picker input {
    min-width: 0;
    height: 32px;
    padding: 0 7px;
    font-size: 12px;
}

.variant-picker input {
    text-align: right;
}

.variant-picker .small-button {
    min-height: 32px;
    padding: 0 8px;
}

.variant-summary {
    display: grid;
    gap: 6px;
    padding: 0 10px 8px;
}

.variant-summary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 22px;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    padding: 6px;
}

.variant-summary-row span {
    display: grid;
    min-width: 0;
}

.variant-summary-row strong {
    min-width: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.variant-summary-row small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}

.variant-summary-row em {
    color: var(--accent-dark);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    white-space: nowrap;
}

.variant-summary-row button {
    display: grid;
    place-items: center;
    width: 22px;
    min-height: 22px;
    border-radius: 50%;
    padding: 0;
    font-size: 11px;
}

.variant-empty,
.variant-message {
    padding: 0 10px 8px;
    color: var(--muted);
    font-size: 12px;
}

.variant-message {
    color: var(--accent-dark);
}

.line-total {
    min-height: 36px;
    padding: 9px 12px;
    background: #f5f1eb;
    color: var(--accent-dark);
    font-weight: 700;
    text-align: right;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 1000;
    max-width: 420px;
    border-radius: 8px;
    background: #3b2320;
    color: #ffffff;
    padding: 12px 16px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

#blazor-error-ui a {
    color: #ffffff;
}

#blazor-error-ui .dismiss {
    margin-left: 12px;
    cursor: pointer;
}

.loading-progress {
    display: block;
    width: 64px;
    height: 64px;
    margin: 24vh auto 12px;
}

.loading-progress circle {
    fill: none;
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:first-child {
    stroke: #ded8cf;
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
}

.loading-progress-text {
    text-align: center;
    color: var(--muted);
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Yukleniyor");
}

@media (max-width: 720px) {
    .portal {
        width: min(100% - 20px, 1420px);
        padding-top: 14px;
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .summary {
        text-align: left;
    }

    .session-box {
        margin-left: 0;
    }

    .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .control-panel,
    .management-grid,
    .inline-form {
        grid-template-columns: 1fr;
    }

    .panel-header {
        flex-direction: column;
    }

    .extra-cost-row {
        grid-template-columns: 1fr;
    }

    .extra-cost-row span {
        text-align: left;
    }

    .actions button,
    .actions input[type="search"] {
        width: 100%;
        margin-left: 0;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
        gap: 10px;
    }

    .product-card {
        grid-template-rows: 142px 104px auto auto;
        min-height: 322px;
    }
}
