/* ── RESET ve TEMEL ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: system-ui, "Segoe UI", sans-serif;
    font-size: 14px;
    background: #f0f2f5;
    color: #222;
    padding-bottom: 80px;
}
img, video, canvas {
    max-width: 100%;
    height: auto;
}

/* ── HEADER ── */
header {
    background: #1e2d3d;
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    gap: 6px;
}
.app-title {
    font-size: 16px;
    font-weight: 700;
}
.userbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.userbar .logout {
    background: #e74c3c;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
}
.btn-yenile {
    background: #27ae60;
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
}
.btn-yenile:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── TABS ── */
.tabs {
    background: #fff;
    border-bottom: 1px solid #d5dce3;
    display: flex;
    padding: 0 12px;
    overflow-x: auto;
    gap: 4px;
}
.tab {
    background: #f9f9f9;
    border: 1px solid #d5dce3;
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    padding: 8px 14px;
    font-weight: 700;
    color: #1e2d3d;
    white-space: nowrap;
}

/* ── MAIN GRID ── */
main {
    padding: 12px;
}
.top-grid,
.bottom-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}
@media (min-width: 768px) {
    .top-grid {
        grid-template-columns: 1fr 1fr;
    }
    .bottom-grid {
        grid-template-columns: 55% 1fr;
    }
}

/* ── CARDS ── */
section {
    background: #fff;
    border: 1px solid #d8dee5;
    border-radius: 6px;
    overflow: hidden;
}
section h2 {
    font-size: 14px;
    margin: 0;
    padding: 10px 14px;
    background: #f1f3f5;
    border-bottom: 1px solid #d8dee5;
    color: #1e2d3d;
}

/* ── FORM GRID ── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px 12px;
    padding: 12px;
}
.form-grid label {
    font-weight: 600;
    color: #34495e;
    font-size: 13px;
}
@media (min-width: 600px) {
    .form-grid {
        grid-template-columns: 130px 1fr;
        align-items: center;
    }
}

/* ── INPUTS ── */
input, select, textarea {
    font: inherit;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px 10px;
    background: #fff;
    width: 100%;
    font-size: 14px;
}
input[readonly], input:disabled {
    background: #ececec;
    cursor: not-allowed;
}
textarea {
    min-height: 80px;
    resize: vertical;
}
.inline {
    display: flex;
    gap: 6px;
    align-items: center;
}
.inline input {
    flex: 1;
    min-width: 0;
}
.icon-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    background: #2980b9;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.delete-btn {
    background: #e74c3c;
}
.camera-btn {
    background: #27ae60;
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

/* ── TABLO ── */
.table-wrap {
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 700px;
}
th {
    position: sticky;
    top: 0;
    background: #34495e;
    color: #fff;
    z-index: 1;
    padding: 6px 8px;
    white-space: nowrap;
}
td {
    padding: 4px 6px;
    border-bottom: 1px solid #d8dee5;
    vertical-align: middle;
}
td input, td select {
    padding: 4px 6px;
    font-size: 12px;
}
tbody tr:nth-child(odd) { background: #fff; }
tbody tr:nth-child(even) { background: #f5f5f5; }

/* ── BUTONLAR ── */
.add-row {
    margin: 10px 12px;
    background: #2980b9;
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
}
.satir-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}
.seri-ara-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.seri-ara-inline input {
    width: 200px;
    min-width: 120px;
}
#seriAraStatus {
    font-size: 11px;
    color: #5b6875;
    min-width: 120px;
}
#seriAraStatus.ok { color: #1f6b3a; }
#seriAraStatus.err { color: #9b1c1c; }

/* ── ALT TOPLAMLAR ── */
.totals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid #d8dee5;
}
.totals div {
    padding: 8px 12px;
    border-bottom: 1px solid #d8dee5;
}
.totals .value {
    text-align: right;
    font-weight: 600;
}
.totals .grand {
    font-weight: 800;
    background: #fffbe6;
}

/* ── MODAL ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
    padding: 12px 16px;
    background: #1e2d3d;
    color: #fff;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 15px;
    margin: 0;
}
.modal-close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}
.modal-search {
    padding: 10px 12px;
    border-bottom: 1px solid #d8dee5;
}
.modal-search input {
    width: 100%;
    padding: 8px 10px;
}
.modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 4px 0;
}
.modal-body table {
    min-width: 400px;
    font-size: 13px;
}
.modal-body th {
    background: #34495e;
    color: #fff;
    padding: 6px 10px;
    position: sticky;
    top: 0;
}
.modal-body td {
    padding: 6px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}
.modal-body tr:hover td {
    background: #e8f4fd;
}
.modal-body tr.row-disabled {
    cursor: not-allowed;
    opacity: 0.5;
    background: #f5f5f5;
}
.modal-body tr.row-disabled:hover td {
    background: #f5f5f5;
}
.modal-status {
    padding: 8px 12px;
    color: #5b6875;
    font-size: 12px;
    border-bottom: 1px solid #d8dee5;
    display: flex;
    align-items: center;
    gap: 8px;
}
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #ccc;
    border-top-color: #2980b9;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
.spinner.on {
    display: inline-block;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Cari Ekleme Modalı Autocomplete */
.cari-autocomplete-list {
    position: absolute;
    z-index: 20;
    background: #fff;
    border: 1px solid #ccc;
    border-top: 0;
    max-height: 150px;
    overflow-y: auto;
    width: 100%;
    display: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.cari-autocomplete-list div {
    padding: 6px 10px;
    cursor: pointer;
}
.cari-autocomplete-list div:hover {
    background: #e8f4fd;
}

/* ── BOTTOM BAR ── */
.bottom-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #cfd6de;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    z-index: 50;
    flex-wrap: wrap;
}
.action {
    border: 0;
    border-radius: 4px;
    padding: 10px 20px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
}
.save { background: #2980b9; }
.cancel { background: #e74c3c; }
/* ── LOGIN SAYFASI ÖZEL STİLLERİ ── */
body.login-page {
    margin: 0;
    font-family: system-ui, "Segoe UI", sans-serif;
    font-size: 13px;
    background: #f4f6f8;
    color: #222;
    min-width: unset !important;
}
.login-page .page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 16px;
}
.login-page .login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid #d8dee5;
    border-radius: 6px;
    box-shadow: 0 18px 42px rgba(30,45,61,.14);
}
.login-page .brand {
    background: #1e2d3d;
    color: #fff;
    padding: 22px 24px;
    border-radius: 6px 6px 0 0;
}
.login-page .brand h1 { font-size: 21px; line-height: 1.2; margin: 0 0 4px; }
.login-page .brand p { margin: 0; color: #dce5ee; }
.login-page .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr 1.15fr;
    border-bottom: 1px solid #d8dee5;
}
.login-page .tab-btn {
    border: 0;
    background: #f9f9f9;
    padding: 12px 8px;
    cursor: pointer;
    color: #394b5f;
    font-weight: 600;
}
.login-page .tab-btn.active {
    background: #fff;
    color: #1e2d3d;
    font-weight: 700;
    border-bottom: 3px solid #2980b9;
}
.login-page .panel {
    display: none;
    padding: 22px 24px;
}
.login-page .panel.active { display: block; }
.login-page label {
    display: block;
    margin: 0 0 5px;
    font-weight: 600;
    color: #34495e;
}
.login-page input {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 8px 9px;
    margin: 0 0 12px;
    font: inherit;
}
.login-page input:focus {
    outline: 2px solid rgba(41,128,185,.18);
    border-color: #2980b9;
}
.login-page button.primary {
    width: 100%;
    border: 0;
    background: #2980b9;
    color: #fff;
    border-radius: 3px;
    padding: 9px 12px;
    font-weight: 700;
    cursor: pointer;
}
.login-page button.primary:disabled { opacity: .6; cursor: not-allowed; }
.login-page .links {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}
.login-page .link {
    border: 0;
    background: transparent;
    color: #2980b9;
    padding: 0;
    cursor: pointer;
    font: inherit;
}
.login-page .help { margin: 0 0 12px; color: #5b6875; line-height: 1.4; }
.login-page .msg {
    display: none;
    margin: 0 0 12px;
    padding: 9px;
    border-radius: 3px;
}
.login-page .msg.ok { display: block; background: #eaf7ee; color: #1f6b3a; }
.login-page .msg.err { display: block; background: #fdecea; color: #9b1c1c; }
.login-page .inline-error {
    min-height: 18px;
    margin: -8px 0 8px;
    color: #e74c3c;
    font-size: 12px;
}

/* ── MOBİL ── */
@media (max-width: 480px) {
    .login-page .login-card { margin: 0 8px; }
    .login-page .brand { padding: 16px; }
    .login-page .brand h1 { font-size: 18px; }
    .login-page .panel { padding: 16px; }
    .login-page .tabs { grid-template-columns: 1fr 1fr 1fr; }
    .login-page .tab-btn { font-size: 12px; padding: 10px 4px; }
    .login-page .links { justify-content: center; flex-wrap: wrap; gap: 8px; }
    .login-page .links .link { font-size: 14px; }
}


/* ── RESPONSIVE İYİLEŞTİRMELER ── */
@media (max-width: 600px) {
    .app-title { font-size: 14px; }
    .userbar span { font-size: 11px; }
    .btn-yenile, .logout { padding: 4px 8px; font-size: 11px; }
    .tab { padding: 6px 10px; font-size: 12px; }
    .form-grid { padding: 8px; }
    .form-grid label { font-size: 12px; }
    input, select, textarea { font-size: 13px; padding: 6px 8px; }
    .icon-btn { width: 32px; height: 32px; font-size: 14px; }
    .satir-toolbar { flex-direction: column; align-items: stretch; }
    .seri-ara-inline input { width: 100%; }
    .bottom-actions { flex-direction: column; align-items: stretch; gap: 6px; }
    .bottom-actions .action { text-align: center; }
    .totals { grid-template-columns: 1fr 1fr; font-size: 12px; }
    .totals div { padding: 6px 10px; }
    .modal { max-width: 100%; margin: 8px; }
    .modal-body table { font-size: 11px; min-width: 300px; }
    .modal-body th, .modal-body td { padding: 4px 6px; }
    .modal-body > div > div {
        grid-template-columns: 1fr !important;
    }
}