/* === WEBVIEW-FIX: START (removable — see webview-fix.css header) === */
@import url('webview-fix.css');
/* === WEBVIEW-FIX: END === */

/* Scrollbar fix: make scrollbars visible */
body ::-webkit-scrollbar { width: 6px !important; height: 6px !important; }
body ::-webkit-scrollbar-thumb { background-color: rgba(var(--input-border), 0.5) !important; border-radius: 3px; }
body ::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--input-border), 0.8) !important; }

/* Hide scrollbar in sidebar to prevent white track on colored background */
.app-sidebar ::-webkit-scrollbar { width: 0 !important; }
.app-sidebar { scrollbar-width: none; }
.app-sidebar .main-sidebar { scrollbar-width: none; }

.choices { position: relative; z-index: 20; }
.choices.is-open { z-index: 9999; }
.choices__list--dropdown { z-index: 9999; background-color: rgb(var(--custom-white)) !important; }

/* Flatpickr: takvim layout üzerinde kalsın; mobilde/native picker kapalı,
   scroll sırasında konumun kopmaması için fixed'e zorlamıyoruz. */
.flatpickr-calendar.open {
    z-index: 99999 !important;
}
.flatpickr-wrapper {
    width: 100%;
    display: block;
}
.flatpickr-wrapper .form-control {
    width: 100%;
}
.flatpickr-calendar.static.open {
    position: absolute !important;
}

/* align-items:stretch olan grid satirlarindaki yan yana box'larin margin'ini sifirla */
.grid[style*="align-items:stretch"] > [class*="col-span"] > .box,
.grid[style*="align-items: stretch"] > [class*="col-span"] > .box,
.grid.stretch-boxes > [class*="col-span"] > .box { margin-bottom: 0 !important; }

/* Kurumsal görünüm için sık tablo satırları */
.ti-custom-table th { padding: 0.4rem 0.65rem; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .3px; }
.ti-custom-table td { padding: 0.32rem 0.65rem; font-size: 0.78rem; vertical-align: middle; }

.table tbody tr { border-bottom: 1px solid rgb(var(--default-border)); }
.table thead th { font-weight: 600; padding: 0.4rem 0.5rem; text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: .3px; white-space: nowrap; }
.table tbody td { padding: 0.32rem 0.5rem; vertical-align: middle; text-align: left; font-size: 0.78rem; }
.table tbody tr:hover { background-color: rgb(var(--default-background)); }

.tl-table th { padding: 0.4rem 0.5rem; font-size: 0.72rem; }
.tl-table td { padding: 0.32rem 0.5rem; font-size: 0.78rem; }

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { background-color: rgba(var(--primary-rgb), 0.1); }
.sort-asc::after { content: " ▲"; font-size: 10px; }
.sort-desc::after { content: " ▼"; font-size: 10px; }

.action-btns { display: flex; gap: 4px; justify-content: center; }
.action-btns .ti-btn { padding: 3px 6px; font-size: 0.7rem; border-radius: 4px; line-height: 1; }

.btn-unified { height: 36px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1; font-size: 0.8rem; }

.zone-box { border: 1px solid rgb(var(--default-border)); border-radius: 0.375rem; height: 220px; overflow-y: auto; }
.zone-box option { padding: 0.5rem; }
.zone-box option:hover { background: rgba(var(--primary-rgb), 0.08); }

.skeleton { background: linear-gradient(90deg, rgb(var(--default-background)) 25%, rgb(var(--default-border)) 50%, rgb(var(--default-background)) 75%); background-size: 200% 100%; animation: sk 1.5s infinite; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.user-avatar { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.7rem; text-transform: uppercase; }

@media (max-width: 768px) {
    .page-header-breadcrumb { flex-direction: column; align-items: flex-start !important; }
    .page-header-breadcrumb .btn-list { width: 100%; flex-wrap: wrap; margin-top: 0.75rem; }
    .hide-mobile { display: none !important; }

    /* Global: all grid children single column on mobile */
    .main-content .grid.grid-cols-12 > [class*="col-span-"] { grid-column: span 12 / span 12 !important; }

    /* Info boxes: compact on mobile */
    .info-box-grid .flex.items-start { padding: 0.5rem 0.75rem !important; }
    .info-box-grid .flex.items-start i { font-size: 1rem !important; margin-top: 2px; }
    .info-box-grid .flex.items-start h6 { font-size: 0.8rem !important; margin-bottom: 0 !important; }
    .info-box-grid .flex.items-start p { font-size: 0.7rem !important; line-height: 1.3; }

    /* Stat cards: compact height on mobile */
    .stat-card-grid .box { margin-bottom: 0.25rem !important; }
    .stat-card-grid .box-body { padding: 0.65rem 0.75rem !important; }
    .stat-card-grid .flex.items-start { align-items: center !important; }
    .stat-card-grid h4 { font-size: 1.1rem !important; margin-bottom: 0 !important; }
    .stat-card-grid h6 { font-size: 0.7rem !important; }
    .stat-card-grid .badge { font-size: 0.6rem !important; padding: 1px 6px !important; }
}
@media (max-width: 1024px) {
    .hide-tablet { display: none !important; }
}

/* ── sc-grid stat cards (shared) ── */
.sc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .85rem; margin-bottom: 1.5rem; }
.sc-card { background: rgb(var(--custom-white)); border-radius: 12px; border: 1px solid rgb(var(--default-border) / 0.6); overflow: hidden; transition: box-shadow .2s, transform .2s, border-color .2s; cursor: pointer; position: relative; }
.dark .sc-card { background: rgb(var(--default-background)); border-color: rgb(var(--default-border) / 0.08); }
.sc-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); transform: translateY(-2px); border-color: var(--ic, rgb(var(--default-border))); }
.sc-card:active { transform: translateY(0) scale(.98); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.sc-card .sc-arrow { position: absolute; bottom: .65rem; right: .75rem; font-size: .85rem; color: rgb(var(--text-muted) / 0.3); transition: color .2s, transform .2s; }
.sc-card:hover .sc-arrow { color: var(--ic, rgb(var(--text-muted))); transform: translateX(3px); }
.sc-top { background: var(--bg); padding: .85rem 1.1rem; display: flex; align-items: center; justify-content: space-between; }
.sc-icon { font-size: 1.05rem; color: var(--ic); }
.sc-badge { font-size: .5rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--ic); background: var(--bbg); border-radius: 3px; padding: 2px 6px; }
.sc-body { padding: .85rem 1.1rem; }
.sc-num { font-size: 2rem; font-weight: 900; color: rgb(var(--default-text-color)); line-height: 1; letter-spacing: -1px; }
.sc-lbl { font-size: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: rgb(var(--text-muted)); margin-top: 4px; }
.sc-sub { font-size: .62rem; color: rgb(var(--text-muted) / 0.6); margin-top: 2px; }

@media (max-width: 640px) {
    .sc-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .65rem;
    }
    .sc-card .sc-top { padding: .62rem .7rem; }
    .sc-card .sc-body { padding: .68rem .75rem; }
    .sc-card .sc-num { font-size: 1.45rem; }
    .sc-card .sc-lbl { font-size: .54rem; line-height: 1.2; }
    .sc-card .sc-sub { font-size: .58rem; line-height: 1.25; }
}

@media (max-width: 360px) {
    .sc-grid { grid-template-columns: 1fr; }
}

/* ── Mobile module nav (shared component) ── */
.mobile-module-shell,
.mobile-module-filter-backdrop {
    display: none;
}

.mobile-module-appbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: .25rem 0 .8rem;
}

.mobile-module-title {
    min-width: 0;
}

.mobile-module-title span {
    display: block;
    font-size: .66rem;
    font-weight: 900;
    color: rgb(var(--text-muted));
    text-transform: uppercase;
    letter-spacing: .06em;
}

.mobile-module-title strong {
    display: block;
    margin-top: .05rem;
    color: rgb(var(--default-text-color));
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mobile-module-cta {
    min-height: 40px;
    border-radius: 8px;
    padding: 0 .72rem;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: rgb(var(--primary-rgb));
    color: #fff !important;
    font-size: .78rem;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(235, 45, 58, .24);
}

.mobile-module-tabs {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(72px, 1fr);
    gap: .45rem;
    overflow-x: auto;
    padding: .15rem .05rem .65rem;
    margin: 0 0 .55rem;
    -webkit-overflow-scrolling: touch;
}

.mobile-module-tabs::-webkit-scrollbar {
    display: none;
}

.mobile-module-tabs a {
    min-height: 58px;
    border: 1px solid rgb(var(--default-border) / .62);
    border-radius: 8px;
    background: rgb(var(--custom-white));
    color: rgb(var(--text-muted));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .22rem;
    font-size: .68rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.mobile-module-tabs a i {
    font-size: 1.05rem;
}

.mobile-module-tabs a.active {
    border-color: rgba(var(--primary-rgb), .28);
    background: rgba(var(--primary-rgb), .09);
    color: rgb(var(--primary-rgb));
}

@media (max-width: 640px) {
    .mobile-module-shell {
        display: block;
    }

    .page-header-breadcrumb.mobile-module-header-host .mobile-module-header-copy {
        display: none !important;
    }

    .page-header-breadcrumb.mobile-module-header-host.mobile-module-header-empty {
        display: none !important;
    }

    .page-header-breadcrumb.mobile-module-header-host {
        margin-bottom: .25rem !important;
    }

    .mobile-module-filter-backdrop {
        position: fixed;
        inset: 0;
        z-index: 10080;
        background: rgba(15, 23, 42, .42);
        backdrop-filter: blur(2px);
    }

    body.mobile-filter-open .mobile-module-filter-backdrop {
        display: block;
    }
}

/* ── Mobile module filter (shared bottom sheet) ── */
.mobile-module-filter-trigger,
.mobile-module-filter-sheet-head,
.mobile-module-filter-sheet-footer {
    display: none;
}

@media (max-width: 640px) {
    .mobile-module-filter-trigger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        border-radius: 8px;
    }

    .mobile-module-filter-box {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10090;
        display: block;
        margin: 0 !important;
        max-height: min(82vh, 680px);
        border-radius: 16px 16px 0 0 !important;
        overflow: visible;
        transform: translateY(105%);
        transition: transform .22s ease;
        box-shadow: 0 -18px 36px rgba(15, 23, 42, .22);
    }

    body.mobile-filter-open {
        overflow: hidden;
    }

    body.mobile-filter-open .mobile-module-filter-box {
        transform: translateY(0);
    }

    .mobile-module-filter-box > .box-header {
        display: none !important;
    }

    .mobile-module-filter-sheet-head,
    .mobile-module-filter-sheet-footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        padding: .85rem 1rem;
        background: rgb(var(--custom-white));
        border-bottom: 1px solid rgb(var(--default-border) / .65);
    }

    .mobile-module-filter-sheet-head strong {
        font-size: 1rem;
        font-weight: 900;
        color: rgb(var(--default-text-color));
    }

    .mobile-module-filter-sheet-close {
        width: 38px;
        height: 38px;
        border: 0;
        border-radius: 8px;
        background: rgba(var(--light-rgb), .7);
        color: rgb(var(--default-text-color));
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
    }

    .mobile-module-filter-box > .box-body {
        max-height: calc(min(82vh, 680px) - 126px);
        overflow-y: auto;
        padding: 1rem !important;
    }

    .mobile-module-filter-box .form-label {
        margin-bottom: .35rem;
        font-size: .75rem;
        font-weight: 800;
        color: rgb(var(--default-text-color));
    }

    .mobile-module-filter-box .form-control {
        min-height: 42px;
        border-radius: 8px;
        font-size: .84rem;
    }

    .mobile-module-filter-box .choices {
        width: 100% !important;
        min-width: 0 !important;
        margin-bottom: 0 !important;
        z-index: auto;
    }

    .mobile-module-filter-box .choices.is-open {
        z-index: 10120 !important;
    }

    .mobile-module-filter-box .choices__inner {
        min-height: 42px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        padding: .45rem 2.1rem .45rem .7rem !important;
        background: rgb(var(--custom-white));
        border-color: rgb(var(--default-border));
        font-size: .84rem;
        line-height: 1.25;
    }

    .mobile-module-filter-box .choices__list--single {
        padding: 0 !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-module-filter-box .choices__list--single .choices__item {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .mobile-module-filter-box .choices[data-type*="select-one"]::after {
        right: .85rem;
        top: 50%;
        margin-top: -2px;
    }

    .mobile-module-filter-box .choices__list--dropdown {
        z-index: 10130 !important;
        border-radius: 10px;
        border-color: rgb(var(--default-border));
        box-shadow: 0 14px 30px rgba(15, 23, 42, .18);
        overflow: hidden;
    }

    .mobile-module-filter-box .choices__list--dropdown .choices__list {
        max-height: min(220px, 42vh);
        overflow-y: auto;
    }

    .mobile-module-filter-sheet-footer {
        border-top: 1px solid rgb(var(--default-border) / .65);
        border-bottom: 0;
    }

    .mobile-module-filter-sheet-footer .ti-btn {
        flex: 1 1 0;
        justify-content: center;
        min-height: 42px;
    }
}

/* ── Table responsive guarantee ── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Auth pages: reduce box padding on small screens ── */
@media (max-width: 480px) {
    .authentication .box-body { padding: 1.5rem !important; }
}

/* ── Modals: constrain to viewport on mobile ── */
@media (max-width: 640px) {
    .ti-modal-box { max-width: calc(100vw - 2rem) !important; width: calc(100vw - 2rem) !important; }
}

/* === Edit buttons unified color (rgb 207,165,87) === */
.ti-btn:has(> .ri-edit-line),
.ti-btn:has(> .ri-pencil-line),
.ti-btn:has(> .ri-edit-2-line),
.ti-btn:has(> .ri-edit-box-line),
button:has(> .ri-edit-line),
button:has(> .ri-pencil-line),
a.ti-btn:has(> .ri-edit-line),
a.ti-btn:has(> .ri-pencil-line) {
    background-color: rgb(207, 165, 87) !important;
    border-color: rgb(207, 165, 87) !important;
    color: #fff !important;
}
.ti-btn:has(> .ri-edit-line):hover,
.ti-btn:has(> .ri-pencil-line):hover,
.ti-btn:has(> .ri-edit-2-line):hover,
.ti-btn:has(> .ri-edit-box-line):hover,
button:has(> .ri-edit-line):hover,
button:has(> .ri-pencil-line):hover,
a.ti-btn:has(> .ri-edit-line):hover,
a.ti-btn:has(> .ri-pencil-line):hover {
    background-color: rgb(187, 145, 67) !important;
    border-color: rgb(187, 145, 67) !important;
    color: #fff !important;
}
.ti-btn:has(> .ri-edit-line) > i,
.ti-btn:has(> .ri-pencil-line) > i,
button:has(> .ri-edit-line) > i,
button:has(> .ri-pencil-line) > i { color: #fff !important; }
