:root {
    --navy: #0b2a5b;
    --blue: #1456b8;
    --blue-dark: #0f4596;
    --accent: #1456b8;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --border: #d4dae3;
    --text: #1c2733;
    --muted: #65707d;
    --danger: #c0392b;
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
}

header.app-header {
    background: var(--navy);
    color: #fff;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logout-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    min-height: 36px;
    flex: 0 0 auto;
}

.logout-btn:active {
    background: rgba(255, 255, 255, 0.12);
}

header.app-header .brand {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

header.app-header .subtitle {
    margin-top: 2px;
    font-size: 0.95rem;
    font-weight: 400;
    color: #c7d6ee;
}

main {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px 16px 40px;
}

.field {
    margin-bottom: 16px;
}

.field.hidden {
    display: none;
}

.field-row {
    display: flex;
    gap: 12px;
}

.field-row > .field {
    flex: 1 1 0;
    margin-bottom: 16px;
}

label.field-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    min-height: 48px;
    padding: 10px 12px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    appearance: none;
    -webkit-appearance: none;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(20, 86, 184, 0.15);
}

select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2365707d' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

input#plate {
    text-transform: uppercase;
}

/* Segment buton (Müşteri tipi) */
.segment {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

.segment button {
    flex: 1 1 0;
    min-height: 48px;
    border: none;
    background: var(--surface);
    color: var(--muted);
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

.segment button + button {
    border-left: 1px solid var(--border);
}

.segment button.active {
    background: var(--blue);
    color: #fff;
}

.hint {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--muted);
}

.error-msg {
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--danger);
    display: none;
}

.error-msg.show {
    display: block;
}

/* Kasko satırı */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
}

.checkbox-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

.checkbox-row .soon {
    font-size: 0.8rem;
    color: var(--muted);
}

.btn-calc {
    width: 100%;
    min-height: 54px;
    margin-top: 8px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1.08rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-calc:active {
    background: var(--blue-dark);
}

.btn-calc:disabled {
    opacity: 0.7;
    cursor: default;
}

/* --- Sonuç kartı --- */
.result {
    margin-top: 20px;
    padding: 18px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.result.hidden {
    display: none;
}

/* Branş kartı (trafik / kasko) */
.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 14px;
}

.result-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy, #0b2a5b);
    margin-bottom: 8px;
}

.price-label {
    font-size: 0.85rem;
    color: var(--muted);
}

.price-big {
    margin-top: 2px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.2;
}

/* --- Akordeon --- */
.accordion {
    margin-top: 16px;
    border-top: 1px solid var(--border);
}

.accordion-header {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    background: none;
    border: none;
    color: var(--blue);
    font-size: 1rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.accordion-icon {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}

.accordion-body {
    display: none;
}

.accordion-body.open {
    display: block;
    padding-bottom: 4px;
}

.detail-section-title {
    margin: 14px 0 4px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.detail-label {
    color: var(--muted);
}

.detail-value {
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.detail-row.neg .detail-value {
    color: var(--danger);
}

/* Primler tablosu */
.prim-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.prim-name {
    flex: 1 1 auto;
    color: var(--muted);
}

.prim-pct {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 0.85rem;
}

.prim-amount {
    flex: 0 0 auto;
    font-weight: 600;
    text-align: right;
    min-width: 90px;
}

.prim-row.neg .prim-amount {
    color: var(--danger);
}

.query-code {
    margin-top: 14px;
    font-size: 0.78rem;
    color: var(--muted);
    word-break: break-all;
}

/* "Yeni hesapla" — ikincil/outline buton */
.btn-reset {
    width: 100%;
    min-height: 48px;
    margin-top: 16px;
    background: transparent;
    color: var(--blue);
    border: 1px solid var(--blue);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-reset:active {
    background: rgba(20, 86, 184, 0.08);
}

/* Hata kutusu */
.result-error {
    padding: 12px 14px;
    background: #fdecea;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    font-weight: 600;
}

/* PWA "Uygulamayı Yükle" banner'ı */
.install-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--navy, #0b2a5b);
    color: #fff;
    padding: 10px 14px;
    font-size: 0.92rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.install-banner[hidden] {
    display: none;
}

.install-text {
    flex: 1 1 auto;
}

.install-btn {
    background: #ff8c00;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    min-height: 40px;
}

.install-btn:active {
    background: #e67e00;
}

.install-close {
    background: transparent;
    color: #c7d6ee;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 6px;
    min-height: 40px;
}

/* --- Login sayfası --- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg, #f4f6f9);
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 22px;
}

.login-logo {
    display: block;
    width: 64px;
    height: 64px;
    margin: 0 auto 14px;
    border-radius: 12px;
}

.login-title {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--navy);
}

.login-sub {
    text-align: center;
    color: var(--muted, #65707d);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.login-error {
    background: #fdecea;
    border: 1px solid #f5c6c2;
    color: var(--danger, #c0392b);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.login-error[hidden] {
    display: none;
}

.login-btn {
    width: 100%;
    min-height: 48px;
    margin-top: 8px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1.05rem;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
}

.login-btn:active {
    background: var(--blue-dark);
}

.login-btn:disabled {
    opacity: 0.7;
    cursor: default;
}
