/* ============ TEMEL ============ */
*, *::before, *::after { box-sizing: border-box; }

/* Gizlenen kutular her koşulda gizli kalsın
   (aşağıdaki .modal-back / .drawer / .board gibi display tanımlarını ezer) */
[hidden] { display: none !important; }

:root {
    --bg:        #f4f5f7;
    --surface:   #ffffff;
    --line:      #e5e7eb;
    --line-soft: #eef0f3;
    --text:      #1a1d23;
    --muted:     #6b7280;
    --accent:    #ea6a1f;
    --accent-bg: #fff2e8;
    --radius:    10px;
    --shadow:    0 1px 2px rgba(16,24,40,.05);
    --shadow-lg: 0 12px 32px rgba(16,24,40,.14);
}

body[data-brand="dil"] {
    --accent:    #2563eb;
    --accent-bg: #eaf0ff;
}

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Segoe UI Web", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

/* ============ ÜST BAR ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.brand-switch {
    display: inline-flex;
    padding: 3px;
    background: #eef0f3;
    border-radius: 9px;
}

.bs-btn {
    border: 0;
    background: transparent;
    padding: 8px 18px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
}
.bs-btn:hover { color: var(--text); }
.bs-btn.is-active {
    background: var(--surface);
    color: var(--accent);
    box-shadow: var(--shadow);
}

.topbar-right { display: flex; align-items: center; gap: 6px; }

.icon-btn {
    position: relative;
    border: 1px solid transparent;
    background: transparent;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    font-size: 16px;
    cursor: pointer;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover { background: #f1f3f5; color: var(--text); }

.badge {
    position: absolute;
    top: 3px; right: 2px;
    min-width: 17px; height: 17px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 17px;
    border-radius: 9px;
    text-align: center;
}

.menu-wrap { position: relative; }
.menu {
    position: absolute;
    right: 0; top: 44px;
    min-width: 210px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 50;
}
.menu a {
    display: block;
    padding: 9px 12px;
    border-radius: 7px;
    color: var(--text);
    font-size: 14px;
}
.menu a:hover { background: #f4f5f7; }
.menu-user {
    padding: 8px 12px 10px;
    color: var(--muted);
    font-size: 12px;
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: 4px;
}

/* ============ SAYFA ============ */
.wrap { padding: 20px; max-width: 1560px; margin: 0 auto; }

/* ============ HIZLI EKLEME ============ */
.addbar {
    display: flex;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    box-shadow: var(--shadow);
}

.addbar input {
    border: 1px solid var(--line);
    background: #fbfbfc;
    border-radius: 8px;
    padding: 11px 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.addbar input:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.in-phone { flex: 0 0 230px; font-size: 16px; font-weight: 600; letter-spacing: .3px; }
.in-name  { flex: 1 1 auto; }

.addbar select, .cat-filter {
    border: 1px solid var(--line);
    background: #fbfbfc;
    border-radius: 8px;
    padding: 11px 12px;
    outline: none;
    cursor: pointer;
    max-width: 220px;
}
.addbar select { flex: 0 0 200px; }
.addbar select:focus, .cat-filter:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.toolbar-right { display: flex; gap: 8px; align-items: center; }
.cat-filter { padding: 9px 12px; background: var(--surface); }

/* ============ BUTONLAR ============ */
.btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .05s;
    white-space: nowrap;
}
.btn:hover { background: #f7f8f9; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.94); background: var(--accent); }
.btn.block { width: 100%; display: block; margin-top: 14px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: #f1f3f5; color: var(--text); }
.btn.danger { color: #dc2626; border-color: #f3c9c9; background: #fff6f6; }
.btn.danger:hover { background: #fdeaea; }
.btn.sm { padding: 6px 11px; font-size: 13px; }

/* ============ ÖZET ============ */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 14px 0;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 13px 16px;
    box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat.warn b { color: #d97706; }
.stat.good b { color: #059669; }
.stat.warn.is-active {
    border-color: #fcd34d;
    background: #fffbeb;
    cursor: pointer;
}

/* ============ ARAÇ ÇUBUĞU ============ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 18px 0 10px;
}
.tabs {
    display: inline-flex;
    gap: 2px;
    background: #e9ebef;
    padding: 3px;
    border-radius: 9px;
}
.tab {
    border: 0;
    background: transparent;
    padding: 7px 16px;
    border-radius: 7px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
}
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.search {
    width: 260px;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    outline: none;
}
.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.hint { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }

/* ============ PANO ============ */
.board {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 14px;
}
.board::-webkit-scrollbar { height: 10px; }
.board::-webkit-scrollbar-thumb { background: #cbd0d8; border-radius: 8px; }

.col {
    flex: 0 0 288px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 250px);
}
.col.is-over { border-color: var(--accent); background: var(--accent-bg); }

.col-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line-soft);
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.col-head b { font-size: 14px; font-weight: 600; flex: 1; }
.col-count {
    min-width: 26px;
    text-align: center;
    padding: 2px 7px;
    background: #f1f3f5;
    color: var(--muted);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.col-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    overflow-y: auto;
    min-height: 110px;
}
.col-empty {
    color: #b3b8c2;
    font-size: 13px;
    text-align: center;
    padding: 26px 10px;
}

/* ============ KART ============ */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 11px 12px;
    cursor: grab;
    transition: box-shadow .15s, border-color .15s;
    touch-action: none;
}
.card:hover { box-shadow: 0 3px 10px rgba(16,24,40,.09); border-color: #d6dae1; }
.card.is-ghost { opacity: .35; }
.card.is-late { border-left: 3px solid #ef4444; }

.card-drag {
    position: fixed;
    z-index: 999;
    width: 266px;
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    transform: rotate(1.5deg);
    cursor: grabbing;
}

.card-phone {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .2px;
    margin-bottom: 1px;
}
.card-name { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.card-name.empty { color: #c2c7d0; font-style: italic; }

.card-cat {
    display: inline-block;
    margin: 0 0 8px;
    padding: 2px 9px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-bg);
    border: 1px solid transparent;
}
.cat-tag {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-bg);
}

.card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 9px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 20px;
    padding: 2px 9px;
    font-size: 11.5px;
}
.chip.late { background: #fee2e2; color: #b91c1c; font-weight: 600; }
.chip.soon { background: #fef3c7; color: #92400e; font-weight: 600; }

.card-actions { display: flex; gap: 6px; }
.card-actions .btn { flex: 1; }
.card-actions .btn.icon { flex: 0 0 34px; padding: 6px 0; text-align: center; }

/* ============ LİSTE ============ */
.list-view {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    padding: 12px 14px;
    background: #fafbfc;
    border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tr:hover td { background: #fafbfc; }
.t-phone { font-weight: 700; font-size: 15px; white-space: nowrap; }
.t-name { color: var(--muted); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #f3f4f6;
    white-space: nowrap;
}
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state b { display: block; font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* ============ MODAL ============ */
.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(17,24,39,.42);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    animation: fade .12s ease;
}
@keyframes fade { from { opacity: 0; } }

.modal {
    width: 100%;
    max-width: 430px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 22px;
    max-height: 88vh;
    overflow-y: auto;
    animation: pop .14s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }

.modal h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.modal .sub { color: var(--muted); margin: 0 0 18px; font-size: 13.5px; }
.modal label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 5px; }
.modal input[type=text], .modal input[type=tel], .modal input[type=date],
.modal input[type=time], .modal input[type=password], .modal input[type=datetime-local] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
}
.modal input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.modal select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    outline: none;
    cursor: pointer;
}
.modal select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.mini-link { font-weight: 500; font-size: 11.5px; text-transform: none; letter-spacing: 0; float: right; }

.check-list {
    border: 1px solid var(--line);
    border-radius: 9px;
    overflow: hidden;
    max-height: 190px;
    overflow-y: auto;
}
.check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
    font-size: 13.5px;
}
.check:last-child { border-bottom: 0; }
.check:hover { background: #fafbfc; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: 0 0 auto; }
.check span { flex: 1; display: flex; align-items: center; gap: 7px; }
.check b { color: var(--muted); font-size: 12px; font-weight: 600; }

.big-choice {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 14px;
    margin-bottom: 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.big-choice:hover { border-color: var(--accent); background: var(--accent-bg); }
.big-choice .ic { font-size: 20px; width: 26px; text-align: center; }
.big-choice .tx b { display: block; font-size: 14.5px; font-weight: 600; }
.big-choice .tx span { font-size: 12.5px; color: var(--muted); }

.modal-foot { display: flex; gap: 8px; margin-top: 18px; }
.modal-foot .btn { flex: 1; }
.row2 { display: flex; gap: 10px; }
.row2 > div { flex: 1; }

.quick-days { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.quick-days .btn { flex: 1; padding: 8px 6px; font-size: 13px; }

.hist { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.hist h4 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.hist-item { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); }
.hist-item span { color: var(--muted); font-size: 11.5px; display: block; }

/* ============ KATEGORİ YÖNETİMİ ============ */
.cat-add { display: flex; gap: 8px; margin: 14px 0 12px; }
.cat-add input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
}
.cat-add input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }

.cat-list {
    border: 1px solid var(--line);
    border-radius: 9px;
    overflow: hidden;
    max-height: 300px;
    overflow-y: auto;
}
.cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 8px 9px 12px;
    border-bottom: 1px solid var(--line-soft);
}
.cat-row:last-child { border-bottom: 0; }
.cat-row:hover { background: #fafbfc; }
.cat-row.editing { gap: 6px; padding: 7px 8px; background: var(--accent-bg); }
.cat-row.editing input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--accent);
    border-radius: 7px;
    outline: none;
    min-width: 0;
}
.cat-name { flex: 1; font-weight: 600; font-size: 14px; }
.cat-num { color: var(--muted); font-size: 12px; white-space: nowrap; }
.cat-ops { display: flex; align-items: center; gap: 2px; }

.ic-btn {
    width: 28px; height: 28px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--muted);
    font-size: 13px;
    line-height: 1;
}
.ic-btn:hover { background: #eceef1; color: var(--text); }
.ic-btn.del:hover { background: #fee2e2; color: #b91c1c; }
.ic-gap { width: 28px; display: inline-block; }

/* ============ HATIRLATMA PANELİ ============ */
.drawer {
    position: fixed;
    top: 0; right: 0;
    width: 380px;
    max-width: 92vw;
    height: 100%;
    background: var(--surface);
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    z-index: 90;
    display: flex;
    flex-direction: column;
    animation: slide .16s ease;
}
@keyframes slide { from { transform: translateX(20px); opacity: .4; } }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 16px;
    border-bottom: 1px solid var(--line);
}
.drawer-body { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

.rem-item {
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 9px;
    padding: 11px 12px;
}
.rem-item.late { border-left-color: #ef4444; }
.rem-item .why { font-size: 12.5px; color: var(--muted); margin: 3px 0 9px; }
.rem-actions { display: flex; gap: 6px; }
.rem-actions .btn { flex: 1; }

.overlay { position: fixed; inset: 0; background: rgba(17,24,39,.18); z-index: 80; }

/* ============ BİLDİRİM ============ */
.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    background: #111827;
    color: #fff;
    padding: 11px 20px;
    border-radius: 9px;
    font-size: 14px;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    animation: up .15s ease;
}
.toast.err { background: #b91c1c; }
@keyframes up { from { transform: translate(-50%, 8px); opacity: 0; } }

/* ============ GİRİŞ / KURULUM ============ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-box {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 30px 26px;
}
.auth-logo { font-size: 19px; font-weight: 700; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
.auth-box label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 5px; }
.auth-box input {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
}
.auth-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.alert { padding: 11px 13px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px; }
.alert.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert.ok  { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.mini { font-size: 12.5px; color: var(--muted); margin-top: 14px; }

/* ============ MOBİL ============ */
@media (max-width: 780px) {
    .wrap { padding: 14px; }
    .topbar { padding: 9px 12px; gap: 8px; }
    .bs-btn { padding: 8px 12px; font-size: 13px; }
    .addbar { flex-wrap: wrap; }
    .in-phone { flex: 1 1 100%; }
    .addbar select { flex: 1 1 100%; max-width: none; }
    .in-name { flex: 1 1 60%; }
    .addbar .btn { flex: 1 1 34%; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-right { flex-direction: column; }
    .search, .cat-filter { width: 100%; max-width: none; }
    .col { flex: 0 0 84vw; max-height: none; }
    .list-view { overflow-x: auto; }
    table.tbl { min-width: 640px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
