:root {
    --bg:        #0b0d10;
    --bg-2:      #14171c;
    --bg-3:      #1a1e25;
    --border:    #262b33;
    --text:      #e8eaed;
    --text-2:    #9aa3b2;
    --muted:     #6b7280;
    --danger:    #ef4444;
    --warn:      #f59e0b;
    --ok:        #10b981;
    --primary:   #006FFD;
    --primary-dim: #006FFDcc;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 6px 20px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--text); }
code { background: var(--bg-3); padding: 2px 6px; border-radius: 4px; font-size: 12px; color: var(--text); }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.text-right { text-align: right; }
.mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .my-2 { margin: 12px 0; }

/* ─────────── LAYOUT ─────────── */
.app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}
.sidebar {
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 16px 12px;
}
.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 4px 4px 16px; border-bottom: 1px solid var(--border);
}
.brand-dot {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dim));
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
    flex-shrink: 0;
}
.brand-logo {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--bg-3);
    display: grid; place-items: center;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    flex-shrink: 0;
    padding: 4px;
}
.brand-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-meta { min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: .8px; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: var(--radius);
    color: var(--text-2);
    transition: all .15s;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.nav-item i { font-size: 16px; width: 20px; text-align: center; }
.sidebar-foot { padding-top: 12px; border-top: 1px solid var(--border); }
.nav-item.logout { color: var(--danger); }
.nav-item.logout:hover { background: rgba(239,68,68,.1); }

/* ─────────── MAIN ─────────── */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 60px; padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
}
.topbar-title { margin: 0; font-size: 18px; font-weight: 600; }
.user-pill {
    background: var(--bg-3); padding: 6px 12px;
    border-radius: 20px; font-size: 13px; color: var(--text-2);
}
.content { padding: 24px; flex: 1; overflow: auto; }

/* ─────────── CARDS ─────────── */
.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.card.p-0 { padding: 0; }
.card-title { margin: 0 0 16px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title i { color: var(--primary); }
.card-subtitle { font-size: 13px; color: var(--text-2); margin: 12px 0 8px; text-transform: uppercase; letter-spacing: .5px; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: grid; place-items: center;
    background: rgba(var(--primary-rgb, 0,111,253), .15);
    color: var(--primary);
    background: var(--primary); color: #fff; opacity: .9;
}
.stat-icon i { font-size: 20px; }
.stat-label { font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 24px; font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ─────────── HAMBURGER (mobile only) ─────────── */
.hamburger {
    background: none; border: 0; color: var(--text);
    font-size: 24px; cursor: pointer;
    padding: 4px 8px; margin-right: 8px;
    display: none;
    border-radius: 6px;
}
.hamburger:hover { background: var(--bg-3); }

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6); z-index: 90;
    backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

/* ─────────── RESPONSIVE ─────────── */
@media (max-width: 1100px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; top: 0; bottom: 0; left: 0;
        width: 260px; max-width: 80vw;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform .25s ease;
        box-shadow: 8px 0 30px rgba(0,0,0,.5);
    }
    .sidebar.open { transform: translateX(0); }
    .hamburger { display: inline-flex; }
    .topbar { padding: 0 12px; height: 56px; }
    .topbar-title { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .user-pill-name { display: none; }
    .user-pill { padding: 6px 8px; }
    .content { padding: 12px; }
    .cards { grid-template-columns: 1fr; gap: 10px; }
    .stat { padding: 14px; }
    .stat-icon { width: 40px; height: 40px; }
    .stat-value { font-size: 20px; }
    .toolbar { gap: 6px; }
    .toolbar .btn { padding: 8px 10px; font-size: 13px; }
    .toolbar .input { min-width: 100px; }
    .card { padding: 14px; border-radius: 10px; }
    .card.p-0 { padding: 0; }
    /* DataTables mobile: horizontal scroll */
    .dataTables_wrapper { padding: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table.dataTable, .table { min-width: 600px; }
    .table thead th, .table tbody td { padding: 8px 10px; font-size: 13px; }
    /* Modal mobile */
    .modal { padding: 0; align-items: flex-end; }
    .modal-card { max-width: none; max-height: 90vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .modal-head { padding: 14px 16px; }
    .modal-card form { padding: 16px; }
    /* Bulk dropzone */
    .dropzone { padding: 24px 16px; }
    /* Login */
    .login-card { padding: 26px 20px; max-width: none; }
    /* Form */
    .input, input[type=text], input[type=password], select, textarea { font-size: 16px; } /* iOS zoom önle */
}
@media (max-width: 480px) {
    .topbar-title { font-size: 14px; }
    .stat { gap: 12px; padding: 12px; }
    .stat-value { font-size: 18px; }
    .card-title { font-size: 14px; }
    .row-actions .btn { padding: 5px 7px; }
}

/* ─────────── TOOLBAR ─────────── */
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .input { flex: 1; min-width: 200px; }

/* ─────────── FORMS ─────────── */
.input, input[type=text], input[type=password], input[type=search], input[type=email],
textarea, select {
    width: 100%;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,111,253,.2);
}
textarea { resize: vertical; min-height: 60px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.form-row small { display: block; margin-top: 4px; }

.input-prefix { display: flex; align-items: stretch; }
.input-prefix .prefix {
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-right: 0;
    border-radius: var(--radius) 0 0 var(--radius);
    color: var(--text-2);
    font-size: 13px;
    white-space: nowrap;
}
.input-prefix input { border-radius: 0 var(--radius) var(--radius) 0; }

.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: auto; }

/* ─────────── BUTTONS ─────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all .15s;
    background: var(--bg-3); color: var(--text);
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dim); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-3); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--danger); border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-icon { padding: 7px 9px; }

/* ─────────── TABLES ─────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
}
.table thead th {
    background: var(--bg-3);
    padding: 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
}
.table tbody td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:hover { background: rgba(255,255,255,.02); }
.table tbody tr:last-child td { border-bottom: 0; }

/* DataTables overrides */
.dataTables_wrapper { padding: 12px; }
.dataTables_filter, .dataTables_length, .dataTables_paginate, .dataTables_info {
    color: var(--text-2);
    margin: 8px 0;
}
.dataTables_filter input, .dataTables_length select {
    background: var(--bg-3); color: var(--text);
    border: 1px solid var(--border); padding: 6px 10px; border-radius: 6px;
}
.dataTables_paginate .paginate_button {
    background: var(--bg-3) !important; color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important; margin: 0 2px !important;
}
.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button:hover {
    background: var(--primary) !important; color: #fff !important;
    border-color: var(--primary) !important;
}

.table-kv th { width: 130px; color: var(--text-2); font-weight: 500; }
.table-kv td { color: var(--text); }
.table-kv tr td, .table-kv tr th { padding: 8px 0; border: 0; }

/* ─────────── ROW ACTIONS ─────────── */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .btn { padding: 6px 8px; }

/* ─────────── BADGES ─────────── */
.badge {
    display: inline-block; padding: 3px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .3px;
}
.badge-ok { background: rgba(16,185,129,.15); color: var(--ok); }
.badge-mute { background: rgba(107,114,128,.2); color: var(--text-2); }

/* ─────────── ALERTS ─────────── */
.alert {
    padding: 12px 14px; border-radius: var(--radius);
    margin-bottom: 16px; font-size: 14px;
    border-left: 3px solid;
}
.alert-error { background: rgba(239,68,68,.1); border-color: var(--danger); color: #fca5a5; }
.alert-ok    { background: rgba(16,185,129,.1); border-color: var(--ok); color: #86efac; }
.alert-info  { background: rgba(0,111,253,.1); border-color: var(--primary); }

.info-banner {
    background: linear-gradient(135deg, rgba(0,111,253,.1), rgba(0,111,253,.05));
    border: 1px solid rgba(0,111,253,.3);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
}
.info-banner i { color: var(--primary); margin-right: 6px; }

.empty {
    padding: 40px; text-align: center; color: var(--text-2);
}

.color-chip {
    display: inline-block; width: 16px; height: 16px;
    border-radius: 4px; vertical-align: middle;
    border: 1px solid var(--border);
}

/* ─────────── MODAL ─────────── */
.modal {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
    display: grid; place-items: center;
    padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 540px;
    box-shadow: var(--shadow);
    max-height: 90vh; overflow: auto;
}
.modal-head {
    padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close {
    background: none; border: 0; color: var(--text-2);
    font-size: 24px; cursor: pointer; padding: 4px 8px;
    border-radius: 6px;
}
.modal-close:hover { background: var(--bg-3); color: var(--text); }
.modal-card form { padding: 20px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 8px; padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ─────────── DROPZONE / BULK ─────────── */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
}
.dropzone:hover, .dropzone.drag {
    border-color: var(--primary);
    background: rgba(0,111,253,.05);
}
.dropzone i { font-size: 36px; color: var(--primary); margin-bottom: 8px; display: block; }
.dropzone .muted { margin-top: 4px; }

.bulk-actions { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.export-list { display: flex; flex-direction: column; gap: 8px; }
.export-btn {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: all .15s;
}
.export-btn:hover { background: var(--bg); color: var(--text); border-color: var(--primary); }
.export-btn > i:first-child { font-size: 22px; color: var(--primary); }
.export-btn > div { flex: 1; }

/* ─────────── ACTIVE DOMAIN BAR ─────────── */
.active-domain {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px; background: var(--bg-3); border-radius: var(--radius);
}
.active-domain a { color: var(--primary); }
.active-domain .btn { margin-left: auto; }

/* ─────────── LOGIN ─────────── */
.login-wrap {
    min-height: 100vh; display: grid; place-items: center;
    background:
        radial-gradient(ellipse 800px 600px at 50% -10%, var(--primary-soft), transparent 70%),
        radial-gradient(ellipse 600px 400px at 50% 110%, var(--primary-soft), transparent 70%),
        var(--bg);
    padding: 20px;
    position: relative;
}
.login-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    width: 100%; max-width: 400px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { margin: 0; font-size: 26px; color: var(--primary); font-weight: 800; letter-spacing: -.5px; }
.login-brand p { margin: 8px 0 0; color: var(--text-2); font-size: 13px; }
.login-logo {
    max-width: 180px;
    max-height: 64px;
    object-fit: contain;
    margin: 0 auto 4px;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}
.login-foot {
    position: absolute;
    bottom: 16px; left: 0; right: 0;
    text-align: center;
}
.btn-lg { padding: 12px 18px; font-size: 15px; font-weight: 600; }

/* ─────────── SCROLLBAR ─────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ─────────── SWAL OVERRIDES ─────────── */
.swal2-popup { background: var(--bg-2) !important; color: var(--text) !important; border: 1px solid var(--border); }
.swal2-title, .swal2-html-container { color: var(--text) !important; }
.swal2-confirm { background: var(--primary) !important; }
.swal2-cancel { background: var(--bg-3) !important; color: var(--text) !important; }

/* ─────────── LINK İSTATİSTİK SAYFASI ─────────── */
.nowrap { white-space: nowrap; }

.badge-today { background: var(--primary-soft, rgba(0,111,253,.18)); color: var(--primary); font-weight: 600; }

.stats-head { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.stats-title {
    font-size: 15px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stats-short { font-size: 12px; color: var(--text-2); word-break: break-all; }
.stats-short:hover { color: var(--primary); }

.range-tabs { display: flex; gap: 4px; background: var(--bg-2); border-radius: var(--radius); padding: 3px; }
.range-tab { padding: 6px 12px; font-size: 13px; }
.range-tab.active { background: var(--primary); color: #fff; }
.range-tab.active:hover { background: var(--primary); color: #fff; }

.stat-value-sm { font-size: 14px; font-weight: 600; }

.card-title-pad { padding: 16px 16px 0; }
.card-title-hint { font-weight: 400; font-size: 12px; }

/* Gün gün tablo */
.day-table-wrap { overflow-x: auto; }
.day-table { width: 100%; }
.day-row { cursor: pointer; }
.day-row:hover { background: var(--bg-3); }
.day-row.open { background: var(--bg-3); }
.day-row-empty { opacity: .5; }
.day-caret { font-size: 11px; color: var(--text-2); transition: transform .15s ease; display: inline-block; }
.day-row.open .day-caret { transform: rotate(90deg); color: var(--primary); }

.day-bar-col { width: 45%; }
.day-bar {
    display: block; height: 8px; border-radius: 4px;
    background: var(--primary); opacity: .75;
    width: var(--bar-pct, 0%); min-width: 2px;
}
.day-row-empty .day-bar { background: var(--border); }

/* Güne ait tıklama detayı */
.day-detail-row > td { padding: 0; background: var(--bg); }
.day-detail { padding: 12px 16px; border-left: 3px solid var(--primary); }
.day-detail-head { font-size: 12px; color: var(--text-2); margin-bottom: 8px; font-weight: 600; }
.day-detail-scroll { max-height: 340px; overflow: auto; }
.table-sm th, .table-sm td { padding: 6px 10px; font-size: 12px; }
.detail-ua, .detail-ref {
    max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 768px) {
    .toolbar .stats-head { order: -1; width: 100%; flex: 1 0 100%; }
    .range-tabs { width: 100%; justify-content: space-between; }
    .range-tab { flex: 1; text-align: center; }
    .day-bar-col { display: none; }
    .detail-ua, .detail-ref { max-width: 120px; }
    .day-detail { padding: 10px; }
}
