:root {
    --ada-navy: #0f2e4c;
    --ada-blue: #1f6fb2;
    --ada-bg: #f4f6f9;
    --ada-border: #dde3ea;
    --sidebar-w: 240px;
}

html { font-size: 15px; }
body { background: var(--ada-bg); color: #1d2733; }

/* ---------- Yerleşim ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--ada-navy);
    color: #c9d6e3;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
}
.sidebar a { color: #c9d6e3; text-decoration: none; }
.sidebar .brand { padding: 0.25rem 0.5rem 1rem; }

.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; }
.brand-mark {
    background: #fff; color: var(--ada-navy);
    font-weight: 800; letter-spacing: 0.05em;
    border-radius: 6px; padding: 0.15rem 0.45rem;
}
.brand-text { font-weight: 600; color: inherit; }

.nav-title {
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em;
    color: #7f93a8; margin: 1.25rem 0.5rem 0.35rem;
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-item { padding: 0.45rem 0.6rem; border-radius: 6px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav-item.active { background: var(--ada-blue); color: #fff; }

.sidebar-user {
    margin-top: auto; padding: 0.75rem 0.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12); color: #fff;
}
.sidebar-user .text-muted { color: #9fb1c4 !important; }
.sidebar-user a, .sidebar-user .btn-link { color: #9fc5ea; text-decoration: none; }

.main { flex: 1; min-width: 0; padding: 1.25rem 1.5rem 3rem; }
.topbar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-title { font-size: 1.35rem; margin: 0; flex: 1; font-weight: 600; }

.card { background: #fff; border: 1px solid var(--ada-border); border-radius: 8px; padding: 1.25rem; margin-bottom: 1rem; }
.card > h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 1rem; }

.table { background: #fff; margin-bottom: 0; }
.table th { font-weight: 600; font-size: 0.85rem; color: #51606f; white-space: nowrap; }
.table-wrap { background: #fff; border: 1px solid var(--ada-border); border-radius: 8px; overflow-x: auto; }

.badge-role { font-weight: 500; }
.pre-line { white-space: pre-line; }

/* Telefon: menü üstten açılır */
@media (max-width: 991.98px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; display: none; }
    .sidebar.open { display: flex; }
    .main { padding: 1rem; }
}

/* ---------- Giriş ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.auth-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--ada-border); border-radius: 10px; padding: 2rem; }
.auth-card .brand { color: var(--ada-navy); }
.auth-card .brand-mark { background: var(--ada-navy); color: #fff; }

/* ---------- Ana kayıtlar (Aşama 1) ---------- */
.thumb { width: 40px; height: 40px; object-fit: contain; border: 1px solid var(--ada-border); border-radius: 4px; background: #fff; display: block; }
.thumb-empty { background: #f1f3f6; }

.photo-box {
    width: 160px; height: 160px; flex-shrink: 0;
    border: 1px dashed var(--ada-border); border-radius: 6px; background: #fafbfc;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.photo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }

.detail-table input, .detail-table select { min-width: 60px; }

/* Teklif satırının ürün bilgisi sütununu taklit eder */
.quote-preview { border: 1px solid #9aa5b1; font-family: Calibri, Arial, sans-serif; font-size: 0.85rem; padding: 0.4rem 0.6rem; background: #fff; }
.qp-title { font-weight: 700; margin-bottom: 0.25rem; }
.qp-line { display: grid; grid-template-columns: 1fr auto; gap: 0.75rem; }

.picker-grid, .media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
.media-grid-wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.picker-item {
    border: 1px solid var(--ada-border); border-radius: 6px; background: #fff; padding: 0.4rem;
    display: flex; flex-direction: column; gap: 0.3rem; text-align: left; font-size: 0.8rem;
}
.picker-item:hover { border-color: var(--ada-blue); box-shadow: 0 0 0 2px rgba(31, 111, 178, 0.2); }
.picker-item img { width: 100%; height: 110px; object-fit: contain; background: #fafbfc; }

.media-card { background: #fff; border: 1px solid var(--ada-border); border-radius: 8px; padding: 0.5rem; }
.media-thumb { display: flex; align-items: center; justify-content: center; height: 140px; background: #fafbfc; border-radius: 4px; }
.media-grid-wide .media-thumb { height: 110px; }
.media-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }

.option-row { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.4rem 0; border-bottom: 1px solid #eef1f4; }

/* ---------- Teklif (Aşama 2) ---------- */
.ac-wrap { position: relative; }
.ac-list {
    position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin-top: 2px;
    background: #fff; border: 1px solid var(--ada-border); border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.08);
    max-height: 320px; overflow-y: auto;
}
.ac-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 0.4rem 0.6rem; font-size: 0.9rem; }
.ac-item:hover, .ac-item.active { background: #eef4fb; }
.ac-empty { padding: 0.5rem 0.6rem; color: #7a8794; font-size: 0.85rem; }

.quote-lines th { background: #f7f9fb; }
.quote-lines td { border-color: #eef1f4; }
.line-no { font-weight: 600; }
.line-image {
    width: 100px; height: 80px; border: 1px dashed var(--ada-border); border-radius: 6px; background: #fafbfc;
    display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 0.75rem; color: #8592a0;
}
.line-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.detail-mini td { padding: 1px 2px; }
.detail-mini input, .detail-mini select { font-size: 0.8rem; padding: 0.1rem 0.35rem; }
details > summary { cursor: pointer; color: var(--ada-blue); }

.totals td { padding: 0.15rem 0.5rem; text-align: right; white-space: nowrap; }
.totals td:first-child { color: #51606f; }

.text-item { display: flex; gap: 0.25rem; align-items: flex-start; margin-bottom: 0.25rem; }
.text-item textarea { resize: vertical; overflow: hidden; }

.banner-box { border: 1px dashed var(--ada-border); border-radius: 6px; background: #fafbfc; min-height: 60px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.banner-box img { max-width: 100%; max-height: 120px; object-fit: contain; }

.sticky-actions { position: sticky; bottom: 0; background: var(--ada-bg); padding: 0.75rem 0; border-top: 1px solid var(--ada-border); z-index: 5; }
.history > div { padding: 2px 0; border-bottom: 1px dashed #eef1f4; }

/* ---------- Sevk emri (Aşama 3) ---------- */
.shipment-lines input { min-width: 56px; }
.shipment-lines tr.removed td { opacity: 0.4; text-decoration: line-through; }
.shipment-lines tr.removed td:last-child { opacity: 1; text-decoration: none; }

/* ---- Aşama 5: liste toplamları ve ana sayfa ---- */
.list-totals td { border-bottom: 0; background: #f8fafc; }
.list-totals tr:first-child td { border-top: 2px solid var(--ada-border); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.dash-grid > .card { margin-bottom: 0; display: flex; flex-direction: column; }
.dash-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: .5rem; }
.dash-head h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.dash-count { font-size: 1.75rem; font-weight: 700; color: var(--ada-navy); line-height: 1; margin-left: auto; }
.dash-count.alert-count { color: #c0392b; }
.dash-list { list-style: none; padding: 0; margin: 0 0 .5rem; font-size: .875rem; }
.dash-list li { display: flex; gap: .5rem; padding: .3rem 0; border-top: 1px solid #eef1f5; }
.dash-list li .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-more { margin-top: auto; font-size: .85rem; }
.dash-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.dash-stat { background: #f8fafc; border: 1px solid #eef1f5; border-radius: 6px; padding: .6rem .75rem; }
.dash-stat .v { font-size: 1.35rem; font-weight: 700; color: var(--ada-navy); }
.dash-stat .l { font-size: .8rem; color: #5b6b7c; }
.bar { background: #eef1f5; border-radius: 3px; height: 8px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--ada-blue); }
