/* =====================================================================
   Alte Marine · Fiyat Teklifi
   Mobil öncelikli arayüz. Bölümler: fontlar, temalar, temel, bileşenler,
   yerleşim, katmanlar, belge (önizleme + baskı), giriş sayfası, baskı.
   ===================================================================== */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/inter-latin-ext.woff2") format("woff2-variations"), url("fonts/inter-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("fonts/inter-latin.woff2") format("woff2-variations"), url("fonts/inter-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tema ---------- */
:root {
    color-scheme: light;
    --navy: #0a2540;
    --navy-2: #12355a;
    --navy-3: #1d4a7a;
    --gold: #c9a227;
    --gold-2: #e0bc47;
    --gold-ink: #6f5510;

    --bg: #f3f1ec;
    --surface: #ffffff;
    --surface-2: #f8f7f3;
    --surface-3: #efece5;
    --border: #e4dfd5;
    --border-strong: #cfc8ba;
    --text: #142132;
    --text-2: #475467;
    --muted: #7a8596;

    --primary: var(--navy);
    --primary-hover: var(--navy-2);
    --on-primary: #ffffff;
    --accent-soft: rgba(201, 162, 39, .14);
    --success: #0e9466;
    --success-soft: rgba(14, 148, 102, .12);
    --warning: #b26b00;
    --warning-soft: rgba(214, 140, 0, .14);
    --danger: #d23f3f;
    --danger-soft: rgba(210, 63, 63, .1);

    --ring: 0 0 0 3px rgba(201, 162, 39, .4);
    --shadow-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-2: 0 12px 32px -12px rgba(10, 37, 64, .28);
    --shadow-3: 0 24px 60px -16px rgba(6, 18, 32, .45);
    --backdrop: rgba(6, 14, 26, .55);

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --appbar-h: 60px;
    --actionbar-h: 68px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #0a121e;
        --surface: #111b2b;
        --surface-2: #0d1624;
        --surface-3: #18243a;
        --border: #1f2d44;
        --border-strong: #2d3f5c;
        --text: #e8edf4;
        --text-2: #b6c1cf;
        --muted: #8592a6;
        --primary: #d4af37;
        --primary-hover: #e3c14f;
        --on-primary: #0a1a2e;
        --accent-soft: rgba(212, 175, 55, .16);
        --success: #34c38f;
        --success-soft: rgba(52, 195, 143, .14);
        --warning: #f0b44c;
        --warning-soft: rgba(240, 180, 76, .14);
        --danger: #f07171;
        --danger-soft: rgba(240, 113, 113, .14);
        --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow-2: 0 12px 32px -12px rgba(0, 0, 0, .6);
        --backdrop: rgba(0, 0, 0, .62);
    }
}

/* ---------- Temel ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
    min-height: 100vh;
    min-height: 100dvh;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: fixed; top: -100px; left: 12px; z-index: 200;
    background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-2);
}
.skip-link:focus { top: calc(8px + var(--safe-top)); }
.stack > * + * { margin-top: 14px; }

/* ---------- Butonlar ---------- */
.btn {
    --btn-h: 44px;
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--btn-h); padding: 0 18px;
    border-radius: 12px; border: 1px solid transparent;
    font-weight: 600; font-size: 15px; letter-spacing: .1px; line-height: 1;
    white-space: nowrap; user-select: none;
    transition: background-color .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px -8px rgba(10, 37, 64, .55); }
.btn--primary:hover { background: var(--primary-hover); }
.btn--gold { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--navy); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn--dashed {
    background: transparent; border: 1.5px dashed var(--border-strong); color: var(--text-2); margin-top: 12px;
}
.btn--dashed:hover { border-color: var(--gold); color: var(--text); background: var(--accent-soft); }
.btn--sm { --btn-h: 38px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn--sm .icon { width: 17px; height: 17px; }
.btn--lg { --btn-h: 52px; font-size: 16px; }
.btn--block { display: flex; width: 100%; }

.spinner {
    display: none; width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite;
}
[aria-busy="true"] > .spinner { display: inline-block; }
[aria-busy="true"] > .icon, .btn[aria-busy="true"] > .btn__label { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex: none; border-radius: 12px; color: var(--text-2);
    transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn--danger:hover, .icon-btn--danger:active { background: var(--danger-soft); color: var(--danger); }
.icon-btn--light { color: #fff; }
.icon-btn--light:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* ---------- Form alanları ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--text-2); letter-spacing: .2px; }
.field__error { margin-top: 6px; font-size: 13px; color: var(--danger); font-weight: 500; }
.input {
    width: 100%; min-height: 48px; padding: 12px 14px;
    font-size: 16px; /* iOS yakınlaştırmasını engeller */
    background: var(--surface-2); color: var(--text);
    border: 1.5px solid var(--border); border-radius: 12px;
    transition: border-color .15s, background-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--gold); background: var(--surface); box-shadow: var(--ring); }
.input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
.input[type="date"] { min-width: 0; }
.input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.input--num { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
textarea.input { resize: none; line-height: 1.45; overflow: hidden; }

.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { padding-right: 38px; }
.input-affix__text {
    position: absolute; right: 14px; color: var(--muted); font-weight: 600; pointer-events: none;
}
.input-affix__text:first-child { left: 14px; right: auto; }
.input-affix__text:first-child + .input { padding-left: 34px; padding-right: 14px; }

.input-wrap { position: relative; display: block; }
.input--with-action { padding-right: 52px; }
.input-action {
    position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
    width: 44px; height: 40px; border-radius: 10px; color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center;
}
.input-action:hover { color: var(--text); background: var(--surface-3); }

.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
    flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 7px;
    border: 1.5px solid var(--border-strong); background: var(--surface-2);
    display: grid; place-items: center; transition: background-color .15s, border-color .15s;
}
.check__box::after {
    content: ""; width: 11px; height: 6px; border: 2.2px solid var(--on-primary); border-top: 0; border-right: 0;
    transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform .15s var(--ease);
}
.check input:checked + .check__box { background: var(--primary); border-color: var(--primary); }
.check input:checked + .check__box::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.check input:focus-visible + .check__box { box-shadow: var(--ring); }
.check__text { font-weight: 600; font-size: 15px; display: flex; flex-direction: column; }
.check__text small { font-weight: 400; color: var(--muted); font-size: 13px; }

.segmented {
    display: flex; padding: 4px; gap: 4px;
    background: var(--surface-3); border-radius: 13px; border: 1px solid var(--border);
}
.segmented__opt {
    flex: 1; min-height: 40px; padding: 0 12px; border-radius: 10px;
    font-weight: 600; font-size: 14.5px; color: var(--text-2); white-space: nowrap;
    transition: background-color .15s, color .15s, box-shadow .15s;
}
.segmented__opt[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.segmented--sm .segmented__opt { min-height: 34px; padding: 0 10px; font-size: 13.5px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    min-height: 38px; padding: 0 14px; border-radius: 999px;
    border: 1.5px solid var(--border); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--text-2);
    transition: background-color .15s, border-color .15s, color .15s;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--gold); color: var(--text); }

.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 500; }
.alert--error { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.hint { color: var(--text-2); font-size: 14px; }

/* ---------- Üst çubuk ---------- */
.appbar {
    position: sticky; top: 0; z-index: 40;
    padding-top: var(--safe-top);
    background: linear-gradient(120deg, #061a2e 0%, var(--navy) 55%, var(--navy-2) 100%);
    color: #fff;
    box-shadow: 0 1px 0 rgba(201, 162, 39, .55), 0 8px 24px -16px rgba(0, 0, 0, .6);
}
.appbar__inner {
    display: flex; align-items: center; gap: 12px;
    height: var(--appbar-h); max-width: 1480px; margin: 0 auto;
    padding: 0 max(12px, var(--safe-right)) 0 max(14px, var(--safe-left));
}
.appbar__logo { height: 26px; width: auto; filter: brightness(0) invert(1); flex: none; }
.appbar__back {
    display: inline-flex; align-items: center; gap: 2px; flex: none;
    height: 40px; padding: 0 12px 0 6px; margin-left: -4px; border-radius: 11px;
    color: #fff; font-weight: 650; font-size: 15px; white-space: nowrap;
    background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
    transition: background-color .15s;
}
.appbar__back:hover, .appbar__back:active { background: rgba(255, 255, 255, .2); }
.appbar__back .icon { width: 22px; height: 22px; }
/* Telefonda geri butonu logonun yerini alır (dar ekranda ikisi birden sığmaz). */
@media (max-width: 599px) {
    .has-back .appbar__logo,
    .has-back .appbar__btn[data-action="open-list"] { display: none; } /* geri butonu aynı işi görür */
    .has-back .appbar__doc { padding-left: 0; border-left: 0; }
}
.appbar__doc {
    display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1;
    padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .16);
}
.appbar__no { font-weight: 700; font-size: 14px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar__actions { display: flex; align-items: center; gap: 4px; flex: none; }
.appbar__btn {
    display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: 11px;
    color: rgba(255, 255, 255, .92); font-weight: 600; font-size: 14px;
    transition: background-color .15s;
}
.appbar__btn:hover, .appbar__btn[aria-expanded="true"] { background: rgba(255, 255, 255, .12); }
.appbar__btn span { display: none; }
.appbar__btn--icon { width: 40px; justify-content: center; padding: 0; }

.status { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, .72); white-space: nowrap; }
.status__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.status__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status[data-state="saved"] { color: #6ee7b7; }
.status[data-state="dirty"] { color: #fcd34d; }
.status[data-state="saving"] { color: #93c5fd; }
.status[data-state="saving"] .status__dot { animation: pulse 1s ease-in-out infinite; }
.status[data-state="error"] { color: #fca5a5; }
@keyframes pulse { 50% { opacity: .3; } }

.menu { position: relative; }
.menu__panel {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; z-index: 50;
    background: var(--surface); color: var(--text); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-2); padding: 6px;
    animation: pop .16s var(--ease);
}
.menu__user {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text-2); font-size: 14px;
    border-bottom: 1px solid var(--border); margin-bottom: 6px; word-break: break-all;
}
.menu__item {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px;
    border-radius: 10px; font-weight: 600; font-size: 15px; text-align: left;
}
.menu__item:hover { background: var(--surface-3); }
.menu__item--danger { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-soft); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- Yerleşim ---------- */
.layout {
    max-width: 1480px; margin: 0 auto;
    padding: 14px max(12px, var(--safe-right)) calc(var(--actionbar-h) + var(--safe-bottom) + 24px) max(12px, var(--safe-left));
}
.layout__preview { display: none; }
.offer { display: flex; flex-direction: column; gap: 14px; }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-1); padding: 16px;
}
.card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 36px; }
.card__icon {
    width: 32px; height: 32px; border-radius: 10px; flex: none;
    display: grid; place-items: center; background: var(--accent-soft); color: var(--gold-ink);
}
@media (prefers-color-scheme: dark) { .card__icon { color: var(--gold-2); } }
.card__icon .icon { width: 17px; height: 17px; }
.card__title { font-size: 16px; font-weight: 700; letter-spacing: -.1px; flex: 1; min-width: 0; }
.card__aside { margin-left: auto; flex: none; }

.grid { display: grid; gap: 12px; }

.banner {
    display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: start;
    padding: 14px; margin-bottom: 14px; border-radius: var(--radius);
    background: var(--warning-soft); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
}
.banner__icon { color: var(--warning); margin-top: 2px; }
.banner__body { display: flex; flex-direction: column; font-size: 14px; color: var(--text-2); }
.banner__body strong { color: var(--text); font-size: 15px; }
.banner__actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Kalemler ---------- */
.items { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item {
    display: grid; grid-template-columns: 26px minmax(0, 1fr) 44px; grid-template-areas: "no desc desc" "no price remove";
    gap: 8px; align-items: start;
    padding: 10px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border);
    animation: item-in .2s var(--ease);
}
@keyframes item-in { from { opacity: 0; transform: translateY(-4px); } }
.item__no {
    grid-area: no; width: 26px; height: 26px; margin-top: 11px; border-radius: 50%;
    display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
    background: var(--navy); color: #fff; font-variant-numeric: tabular-nums;
}
@media (prefers-color-scheme: dark) { .item__no { background: var(--surface-3); color: var(--gold-2); } }
.item__desc { grid-area: desc; }
.item__price { grid-area: price; }
.item__remove { grid-area: remove; height: 48px; width: 44px; }
.item__textarea { min-height: 48px; background: var(--surface); }
.item .input--num { background: var(--surface); }

/* ---------- KDV ve toplam ---------- */
.vat { display: flex; flex-direction: column; gap: 12px; }
.vat__rate { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field--inline .input-affix { width: 112px; }
.totals { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.totals__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0; }
.totals__row dt { color: var(--text-2); font-size: 14.5px; }
.totals__row dd { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.totals__row--grand { margin-top: 6px; padding-top: 12px; border-top: 1.5px solid var(--border-strong); }
.totals__row--grand dt { color: var(--text); font-weight: 700; font-size: 15px; }
.totals__row--grand dd { font-size: 21px; font-weight: 800; letter-spacing: -.3px; }

/* ---------- Notlar (Quill) ---------- */
.card--notes { padding-bottom: 12px; }
.notes__close, .notes__save, .notes__done { display: none; }
.notes__aside { display: flex; gap: 8px; }
.notes__editor-wrap { border: 1.5px solid var(--border); border-radius: 14px; background: var(--surface); }
.notes__editor-wrap:focus-within { border-color: var(--gold); box-shadow: var(--ring); }
.notes__editor-wrap .ql-toolbar.ql-snow {
    position: sticky; top: calc(var(--appbar-h) + var(--safe-top)); z-index: 5;
    border: 0; border-bottom: 1px solid var(--border); border-radius: 13px 13px 0 0;
    background: var(--surface-2); padding: 6px; font-family: inherit;
    display: flex; flex-wrap: wrap; gap: 2px;
}
.notes__editor-wrap .ql-toolbar.ql-snow .ql-formats { margin: 0; display: inline-flex; padding-right: 4px; border-right: 1px solid var(--border); }
.notes__editor-wrap .ql-toolbar.ql-snow .ql-formats:last-child { border-right: 0; }
.ql-snow.ql-toolbar button, .ql-snow .ql-toolbar button { width: 36px; height: 36px; padding: 7px; border-radius: 8px; }
.ql-snow.ql-toolbar button:hover, .ql-snow.ql-toolbar button.ql-active { background: var(--accent-soft); }
.ql-snow .ql-picker { height: 36px; }
.ql-snow .ql-picker.ql-header { width: 104px; }
.ql-snow .ql-picker-label { border-radius: 8px; display: flex; align-items: center; }
.ql-snow .ql-color-picker, .ql-snow .ql-icon-picker { width: 36px; }
.ql-snow .ql-picker-options { border-radius: 10px; box-shadow: var(--shadow-2) !important; background: var(--surface); border-color: var(--border) !important; }
.ql-snow .ql-stroke { stroke: var(--text-2); }
.ql-snow .ql-fill { fill: var(--text-2); }
.ql-snow .ql-picker { color: var(--text-2); }
.ql-snow.ql-toolbar button:hover .ql-stroke, .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke, .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke { stroke: var(--gold); }
.ql-snow.ql-toolbar button:hover .ql-fill, .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--gold); }
.ql-snow.ql-toolbar .ql-picker-label:hover, .ql-snow.ql-toolbar .ql-picker-label.ql-active,
.ql-snow.ql-toolbar .ql-picker-item:hover, .ql-snow.ql-toolbar .ql-picker-item.ql-selected { color: var(--gold); }
.ql-snow .ql-tooltip {
    z-index: 10; border-radius: 12px; border-color: var(--border); background: var(--surface); color: var(--text);
    box-shadow: var(--shadow-2); padding: 8px 12px; max-width: calc(100vw - 32px);
}
.ql-snow .ql-tooltip input[type=text] { font-size: 16px; height: 36px; border-radius: 8px; border-color: var(--border); background: var(--surface-2); color: var(--text); }
/* Quill arayüz metinlerinin Türkçeleri */
.ql-snow .ql-picker.ql-header .ql-picker-label::before, .ql-snow .ql-picker.ql-header .ql-picker-item::before { content: "Normal"; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { content: "Başlık 1"; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: "Başlık 2"; }
.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before, .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: "Başlık 3"; }
.ql-snow .ql-tooltip::before { content: "Bağlantı:"; }
.ql-snow .ql-tooltip[data-mode="link"]::before { content: "Bağlantı adresi:"; }
.ql-snow .ql-tooltip a.ql-action::after { content: "Düzenle"; }
.ql-snow .ql-tooltip a.ql-remove::before { content: "Kaldır"; }
.ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "Kaydet"; }
.notes__editor.ql-container.ql-snow { border: 0; font-family: inherit; font-size: 16px; }
.notes__editor .ql-editor {
    min-height: 220px; height: auto; padding: 14px 16px 18px; line-height: 1.65; color: var(--text);
    overflow-wrap: anywhere;
}
.notes__editor .ql-editor.ql-blank::before { color: var(--muted); font-style: normal; left: 16px; right: 16px; }
.notes__editor .ql-editor h1, .notes__editor .ql-editor h2, .notes__editor .ql-editor h3 { margin: .5em 0 .25em; line-height: 1.3; }
.notes__editor .ql-editor blockquote { border-left: 3px solid var(--gold); padding-left: 12px; color: var(--text-2); }

/* Tam ekran not düzenleme (aynı editör — senkronizasyon gerektirmez) */
.card--notes.is-full {
    position: fixed; z-index: 70; left: 0; right: 0;
    top: var(--vv-top, 0px); height: var(--vv-height, 100dvh);
    margin: 0; border: 0; border-radius: 0; box-shadow: none;
    display: flex; flex-direction: column;
    padding: 0; background: var(--surface);
}
.card--notes.is-full .notes__head {
    margin: 0; padding: calc(8px + var(--safe-top)) max(8px, var(--safe-right)) 8px max(4px, var(--safe-left));
    border-bottom: 1px solid var(--border); background: var(--surface); gap: 6px;
}
.card--notes.is-full .card__icon, .card--notes.is-full .notes__expand { display: none; }
.card--notes.is-full .notes__close, .card--notes.is-full .notes__save, .card--notes.is-full .notes__done { display: inline-flex; }
.card--notes.is-full .notes__editor-wrap {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
    border: 0; border-radius: 0; box-shadow: none;
}
.card--notes.is-full .ql-toolbar.ql-snow { position: static; border-radius: 0; flex: none; }
.card--notes.is-full .notes__editor { flex: 1; min-height: 0; overflow: hidden; }
.card--notes.is-full .notes__editor .ql-editor {
    height: 100%; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 16px max(16px, var(--safe-right)) calc(24px + var(--safe-bottom)) max(16px, var(--safe-left));
    font-size: 17px;
}
body.is-locked { overflow: hidden; }

/* ---------- Alt işlem çubuğu (mobil) ---------- */
.actionbar {
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr); gap: 6px;
    padding: 8px max(10px, var(--safe-right)) calc(8px + var(--safe-bottom)) max(10px, var(--safe-left));
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--border);
    transition: transform .2s var(--ease);
}
body.kb-open .actionbar { transform: translateY(110%); }
.actionbar__btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 52px; border-radius: 12px; color: var(--text-2); font-size: 11.5px; font-weight: 600;
}
.actionbar__btn:active { background: var(--surface-3); }
.actionbar__save {
    display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 14px;
    background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 16px;
    box-shadow: 0 8px 20px -10px rgba(10, 37, 64, .7);
    transition: transform .1s, background-color .15s;
}
.actionbar__save:active { transform: scale(.98); }
.actionbar__save[aria-busy="true"] > span:not(.spinner) { display: none; }

/* ---------- Katmanlar: sayfa, diyalog ---------- */
.overlay {
    position: fixed; inset: 0; z-index: 80;
    display: flex; align-items: flex-end; justify-content: center;
    background: var(--backdrop);
    opacity: 0; transition: opacity .2s var(--ease);
}
.overlay.is-open { opacity: 1; }
.overlay--center { align-items: center; padding: 16px; }
.overlay--full { background: #1c232d; }
.sheet {
    width: 100%; max-height: calc(100vh - var(--safe-top) - 24px); max-height: calc(100dvh - var(--safe-top) - 24px);
    display: flex; flex-direction: column;
    background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-3);
    padding-bottom: var(--safe-bottom);
    transform: translateY(24px); transition: transform .26s var(--ease);
}
.overlay.is-open .sheet { transform: none; }
.sheet--compact { max-width: 520px; }
.sheet--full { height: 100vh; height: 100dvh; max-height: none; border-radius: 0; background: transparent; box-shadow: none; padding-bottom: 0; }
.sheet__head {
    display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 20px; flex: none;
}
.sheet__head::before {
    content: ""; position: absolute; left: 50%; top: 7px; width: 38px; height: 4px; border-radius: 4px;
    background: var(--border-strong); transform: translateX(-50%);
}
.sheet { position: relative; }
.sheet--full .sheet__head::before { display: none; }
.sheet__head--dark {
    background: var(--navy); color: #fff; padding: calc(8px + var(--safe-top)) max(12px, var(--safe-right)) 8px max(6px, var(--safe-left));
    border-bottom: 1px solid rgba(201, 162, 39, .55);
}
.sheet__title { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; }
.sheet__search { padding: 0 16px 10px; flex: none; }
.sheet__body { padding: 4px 16px 18px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

.search { position: relative; display: block; }
.search__icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search__input { padding-left: 44px; }
.search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.dialog {
    width: 100%; max-width: 420px; padding: 22px; border-radius: 22px;
    background: var(--surface); box-shadow: var(--shadow-3);
    transform: scale(.96); transition: transform .2s var(--ease);
}
.overlay.is-open .dialog { transform: none; }
.dialog__title { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.dialog__text { margin-top: 8px; color: var(--text-2); font-size: 15px; }
.dialog__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.dialog__actions .btn { flex: 1; }
.btn--danger { background: var(--danger); color: #fff; }

/* Teklif listesi */
.offer-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.offer-row {
    display: flex; align-items: center; gap: 4px;
    border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
    transition: border-color .15s, background-color .15s;
}
.offer-row:hover { border-color: var(--border-strong); }
.offer-row.is-current { border-color: var(--gold); background: var(--accent-soft); }
.offer-row__main {
    flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px;
    padding: 12px 6px 12px 14px; text-align: left; border-radius: 16px;
}
.offer-row__title { font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.offer-row__amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.offer-row__meta { grid-column: 1 / -1; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.offer-row .icon-btn { margin-right: 6px; }
.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.skeleton {
    height: 66px; border-radius: 16px;
    background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3));
    background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
#listMore { margin-top: 12px; }

/* Bildirimler */
.toasts {
    position: fixed; z-index: 120; left: 0; right: 0; top: calc(var(--appbar-h) + var(--safe-top) + 10px);
    display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px;
}
.toast {
    display: flex; align-items: center; gap: 10px; max-width: 520px;
    padding: 12px 16px; border-radius: 14px; font-size: 14.5px; font-weight: 600;
    background: #14202f; color: #fff; box-shadow: var(--shadow-3);
    animation: toast-in .25s var(--ease);
}
.toast.is-leaving { animation: toast-out .2s ease forwards; }
.toast--success .icon { color: #6ee7b7; }
.toast--error { background: #7a1f1f; }
.toast--error .icon { color: #fecaca; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- Belge önizleme ---------- */
.paper-viewport { padding: 16px; overflow: hidden; }
.paper-viewport--sheet { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 12px calc(24px + var(--safe-bottom)); }
.paper-scaler { margin: 0 auto; position: relative; }
.paper-scaler > .doc { position: absolute; top: 0; left: 0; transform-origin: top left; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }

/* Belge (önizleme ve baskıda aynı). Ölçüler A4 (794px = 210mm). Bilinçli olarak tema dışıdır. */
.doc {
    width: 794px; min-height: 1123px; padding: 50px; background: #fff; color: #333;
    font-family: "Inter", Arial, sans-serif; font-size: 10px; line-height: 1.6;
    -webkit-font-smoothing: antialiased; color-scheme: light;
}
.doc a { color: #0056b3; text-decoration: none; }
.doc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.doc-logo { height: 60px; width: auto; }
.doc-logo-text { font-size: 24px; font-weight: 800; color: #0a2540; letter-spacing: 1px; }
.doc-title { font-size: 16px; color: #0a2540; font-weight: 700; letter-spacing: .3px; }
.doc-info { display: flex; gap: 30px; margin-bottom: 25px; }
.doc-box { flex: 1; min-width: 0; }
.doc-band { background: #e3eaf3; color: #0a2540; text-align: center; font-weight: 700; padding: 6px; margin-bottom: 12px; font-size: 11px; }
.doc-row { display: flex; margin-bottom: 6px; gap: 6px; }
.doc-label { font-weight: 700; color: #0a2540; width: 90px; flex: none; }
.doc-value { color: #333; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.doc-company { font-weight: 700; text-align: center; margin-bottom: 8px; font-size: 11px; color: #0a2540; }
.doc-intro { line-height: 1.6; color: #333; margin-bottom: 25px; }
.doc-notes { color: #333; margin-bottom: 25px; overflow-wrap: anywhere; }
.doc-notes p, .doc-notes li, .doc-notes h1, .doc-notes h2, .doc-notes h3, .doc-notes blockquote { white-space: pre-wrap; }
.doc-notes p { margin: 0 0 4px; }
.doc-notes h1 { font-size: 15px; color: #0a2540; margin: 10px 0 6px; line-height: 1.3; }
.doc-notes h2 { font-size: 13px; color: #0a2540; margin: 8px 0 5px; line-height: 1.3; }
.doc-notes h3 { font-size: 11.5px; color: #0a2540; margin: 6px 0 4px; }
.doc-notes ul, .doc-notes ol { margin: 0 0 8px; padding-left: 20px; }
.doc-notes li { margin-bottom: 2px; }
.doc-notes blockquote { border-left: 3px solid #c9a227; padding: 2px 0 2px 10px; margin: 6px 0; color: #555; }
.doc-notes .ql-align-center { text-align: center; }
.doc-notes .ql-align-right { text-align: right; }
.doc-notes .ql-align-justify { text-align: justify; }
.doc-notes .ql-size-small { font-size: .8em; }
.doc-notes .ql-size-large { font-size: 1.4em; }
.doc-notes .ql-size-huge { font-size: 2em; }
.doc-notes .ql-indent-1 { padding-left: 3em; } .doc-notes li.ql-indent-1 { padding-left: 1.5em; }
.doc-notes .ql-indent-2 { padding-left: 6em; } .doc-notes li.ql-indent-2 { padding-left: 3em; }
.doc-notes .ql-indent-3 { padding-left: 9em; } .doc-notes li.ql-indent-3 { padding-left: 4.5em; }
.doc-notes .ql-indent-4 { padding-left: 12em; } .doc-notes li.ql-indent-4 { padding-left: 6em; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; table-layout: fixed; }
.doc-table th { background: #e3eaf3; color: #0a2540; padding: 8px; text-align: left; font-size: 10px; font-weight: 700; }
.doc-table th:first-child, .doc-table td:first-child { width: 70px; text-align: center; }
.doc-table th:last-child, .doc-table td:last-child { width: 130px; text-align: right; }
.doc-table td { padding: 8px; border-bottom: 1px solid #e5e5e5; vertical-align: top; overflow-wrap: anywhere; }
.doc-table td:first-child { font-weight: 600; }
.doc-table td:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-desc { white-space: pre-wrap; }
.doc-empty { text-align: center !important; color: #999; padding: 20px !important; }
.doc-totals-wrap { display: flex; justify-content: flex-end; margin-bottom: 40px; }
.doc-totals { width: 240px; }
.doc-total { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.doc-total span:first-child { font-weight: 700; color: #0a2540; }
.doc-total span:last-child { font-weight: 600; color: #333; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-total--grand { font-size: 11px; margin-top: 6px; padding-top: 6px; border-top: 2px solid #0a2540; }
.doc-total--grand span:last-child { font-weight: 700; color: #0a2540; }
.doc-footer {
    margin-top: 40px; padding-top: 15px; border-top: 1px solid #e5e5e5;
    display: flex; justify-content: space-between; gap: 20px; font-size: 9px; color: #666;
}
.doc-footer strong { font-size: 10px; color: #0a2540; }
.doc-footer > div:last-child { text-align: right; }

.print-area { display: none; }

/* ---------- Giriş / hata sayfası ---------- */
.auth-page {
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(201, 162, 39, .18), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(29, 74, 122, .55), transparent 60%),
        linear-gradient(160deg, #061a2e 0%, #0a2540 50%, #12355a 100%);
    background-attachment: fixed;
}
.auth {
    min-height: 100vh;
    min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}
.auth__card {
    width: 100%; max-width: 420px; background: var(--surface); border-radius: 24px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55); padding: 30px 24px 26px;
    border-top: 3px solid var(--gold);
}
.auth__card--center { text-align: center; }
.auth__brand { text-align: center; margin-bottom: 24px; }
.auth__logo { height: 54px; width: auto; margin: 0 auto 10px; }
@media (prefers-color-scheme: dark) { .auth__logo { filter: brightness(0) invert(1); } }
.auth__subtitle { color: var(--muted); font-size: 14px; font-weight: 500; letter-spacing: .3px; }
.auth__form > * + * { margin-top: 16px; }
.auth__form .btn { margin-top: 22px; }
.auth__title { font-size: 20px; font-weight: 700; }
.auth__text { color: var(--text-2); margin: 10px 0 20px; }
.auth__footer { margin-top: 20px; color: rgba(255, 255, 255, .55); font-size: 12.5px; }

/* ---------- Duyarlı yerleşim ---------- */
@media (min-width: 600px) {
    .appbar__btn span { display: inline; }
    .appbar__btn { padding: 0 12px; }
    .appbar__logo { height: 30px; }
    .grid--2 { grid-template-columns: 1fr 1fr; }
    .grid--offer { grid-template-columns: 200px 1fr; }
    .card { padding: 20px; }
    .item { grid-template-columns: 26px minmax(0, 1fr) 180px 40px; grid-template-areas: "no desc price remove"; }
    .item__remove { width: 40px; }
    .banner { grid-template-columns: auto 1fr auto; align-items: center; }
    .banner__actions { grid-column: auto; }
    .overlay:not(.overlay--full) { align-items: center; padding: 24px; }
    .sheet:not(.sheet--full) { max-width: 640px; border-radius: 22px; max-height: min(780px, calc(100vh - 48px)); max-height: min(780px, calc(100dvh - 48px)); padding-bottom: 0; }
    .sheet--compact { max-width: 520px; }
    .sheet:not(.sheet--full) .sheet__head::before { display: none; }
    .sheet__head { padding-top: 18px; }
    .dialog__actions .btn { flex: none; min-width: 120px; }
}

@media (min-width: 1100px) {
    :root { --appbar-h: 64px; }
    .layout {
        display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, .9fr); gap: 20px; align-items: start;
        padding: 20px 24px 40px;
    }
    .layout__preview { display: block; position: sticky; top: calc(var(--appbar-h) + 20px); }
    .preview-card {
        background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
        box-shadow: var(--shadow-1); overflow: hidden;
        display: flex; flex-direction: column; max-height: calc(100vh - var(--appbar-h) - 40px); max-height: calc(100dvh - var(--appbar-h) - 40px);
    }
    .preview-card__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--border); }
    .preview-card__title { font-size: 16px; font-weight: 700; flex: 1; }
    .preview-card__actions { display: flex; gap: 8px; }
    .preview-card .paper-viewport { overflow-y: auto; background: var(--surface-3); flex: 1; }
    .actionbar { display: none; }
    .notes__expand { display: none; }
    .offer { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Baskı / PDF ---------- */
@media print {
    @page { size: A4; margin: 12mm 14mm; }
    html, body { background: #fff !important; min-height: 0; }
    body > *:not(.print-area) { display: none !important; }
    .print-area { display: block !important; }
    .print-area .doc { width: auto; min-height: 0; padding: 0; box-shadow: none; }
    .doc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .doc-table thead { display: table-header-group; }
    .doc-table tr, .doc-total, .doc-row { break-inside: avoid; }
    .doc-header, .doc-info, .doc-totals-wrap, .doc-footer { break-inside: avoid; }
}
