/* Shared layout and touch controls for all customer, reseller and platform pages. */
:root { --mobile-header-height: 64px; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin-bottom: 0; }
.panel-main, .panel-content, .panel-card, .panel-body .row > *, .panel-body fieldset { min-width: 0; }
.panel-main { overflow: visible; }
.panel-content { width: 100%; }
.panel-sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; min-height: 0; }
.sidebar-nav { min-height: 0; overscroll-behavior: contain; }
.sidebar-brand, .sidebar-footer, .sidebar-firma-info { min-width: 0; }
.login-title, .sidebar-brand-text { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.sidebar-footer-text { overflow-wrap: anywhere; }
.sidebar-item, .sidebar-subitem, .sidebar-firma-degistir { min-height: 44px; align-content: center; }
.sidebar-item { align-items: center; }
.sidebar-footer-link { min-height: 44px; min-width: 44px; }
.panel-mobile-header, .panel-menu-close, .panel-menu-backdrop { display: none; }
.panel-skip-link { position: fixed; top: -100px; left: 12px; z-index: 1100; padding: 12px 18px; background: white; border: 2px solid #2563eb; border-radius: 8px; }
.panel-skip-link:focus { top: 10px; }
:where(button, a, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid #60a5fa; outline-offset: 3px; }
.panel-body img, .layout-login-body img { max-width: 100%; }
.panel-body .table-responsive, .cs-table-scroll { max-width: 100%; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.panel-body .table-responsive:focus-visible, .cs-table-scroll:focus-visible { outline-offset: -3px; }
.panel-body .alert { overflow-wrap: anywhere; }
.panel-body .modal-dialog { max-width: calc(100vw - 24px); }
.panel-body .modal-body { min-width: 0; overflow-x: auto; }
[data-preference-columns] fieldset { min-width: 0; }
.report-preference-line { display: grid; grid-template-columns: minmax(0,1fr) 96px 20px 44px 44px; align-items: center; gap: 8px; margin-bottom: 8px; }
.report-preference-line > label { min-width: 0; min-height: 44px; }
.report-preference-line > input { width: 100% !important; }
.report-preference-line > button { min-height: 44px; }

@media (max-width: 991.98px) {
    .panel-body { display: block; min-height: 100vh; min-height: 100dvh; }
    .panel-main { width: 100%; }
    .panel-content { padding: 22px 20px max(28px, env(safe-area-inset-bottom)); max-width: none; }
    .panel-mobile-header { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 1020; min-height: var(--mobile-header-height); padding: max(8px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); background: rgba(255,255,255,.97); border-bottom: 1px solid #e2e8f0; }
    .panel-mobile-heading { display: grid; min-width: 0; flex: 1; gap: 2px; }
    .panel-mobile-heading > span { font-size: .7rem; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .panel-mobile-heading > strong { font-size: .94rem; color: #17253b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .panel-mobile-mark { color: #3b82f6; font-size: 1.1rem; }
    .panel-menu-button, .panel-menu-close { width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #dbe4ee; border-radius: 12px; background: #f8fafc; color: #334155; display: inline-flex; align-items: center; justify-content: center; }
    .panel-menu-close { position: absolute; right: 12px; top: max(12px, env(safe-area-inset-top)); background: #ffffff0d; color: #e2e8f0; border-color: #ffffff26; font-size: 1.6rem; }
    .panel-sidebar { width: 100%; height: auto; position: relative; }
    .panel-nav-ready .panel-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1055; width: min(320px, calc(100vw - 28px)); height: 100vh; height: 100dvh; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); transform: translateX(-105%); visibility: hidden; transition: transform .18s ease, visibility 0s linear .18s; box-shadow: 8px 0 32px #0f172a26; }
    .panel-menu-open .panel-sidebar { transform: translateX(0); visibility: visible; transition-delay: 0s; }
    .panel-menu-open { overflow: hidden; }
    .panel-nav-ready .panel-menu-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 1050; border: 0; width: 100%; height: 100%; background: #0f172a70; }
    .panel-sidebar .sidebar-brand { padding: 22px 66px 18px 22px; justify-content: flex-start; }
    .panel-sidebar .sidebar-brand-text, .panel-sidebar .sidebar-item span, .panel-sidebar .sidebar-subitem, .panel-sidebar .sidebar-footer-text { display: block !important; }
    .panel-sidebar .sidebar-item { justify-content: flex-start; padding: 12px 14px; }
    .panel-sidebar .sidebar-sub { padding-left: 20px; }
    .panel-sidebar .sidebar-chevron { display: block !important; }
    .panel-sidebar .sidebar-firma-adi { white-space: normal; overflow-wrap: anywhere; }
    .panel-sidebar .sidebar-firma-degistir { display: inline-flex; align-items: center; font-size: .8rem; }
    .panel-sidebar .sidebar-footer { padding: 12px 20px; }
    .panel-sidebar .sidebar-item-text { white-space: normal; overflow-wrap: anywhere; }
    .panel-card { padding: 20px; }
    .panel-page-title { font-size: 1.45rem; overflow-wrap: anywhere; }
    .panel-body input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .panel-body select, .panel-body textarea,
    .layout-login-body input, .layout-login-body select { font-size: 16px; }
    .panel-body .form-control, .panel-body .form-select, .layout-login-body .form-control, .layout-login-body .form-select { min-height: 44px; }
    .panel-body .btn, .panel-body .dash-refresh-btn, .panel-body .dash-toggle-btn, .panel-body .cur-filter-btn, .panel-body .nav-link, .panel-body summary { min-height: 44px; align-content: center; }
    .panel-body .btn-sm { padding: 9px 12px; }
    .panel-body .btn { min-width: 44px; }
    .panel-body .form-check { padding-top: 7px; padding-bottom: 7px; min-height: 44px; }
    .panel-body input[type=checkbox], .panel-body input[type=radio] { width: 20px; height: 20px; flex-shrink: 0; }
    .panel-body .nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .panel-body .nav-tabs > li { flex-shrink: 0; }
    .panel-body .dash-header { align-items: stretch; }
    .panel-body .dash-header-right { flex-wrap: wrap; min-width: 0; }
    .panel-body .dash-search { max-width: 100%; min-height: 44px; }
    .panel-body .kpi-strip { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .panel-body .kpi-card { min-width: 0; padding: 16px; }
    .panel-body .kpi-value { font-size: clamp(1.05rem,3.2vw,1.4rem); overflow-wrap: anywhere; }
    .panel-body .dash-stat { min-width: 0; flex-basis: calc(50% - 1rem); padding: 16px 12px; }
    .panel-body .dash-stat-value { font-size: 1.3rem; overflow-wrap: anywhere; }
    .panel-body .table-responsive { border-radius: 8px; }
    .panel-body table th, .panel-body table td { vertical-align: middle; }
    .panel-body .table-responsive > table { margin-bottom: 0; }
    .panel-body .table-responsive input, .panel-body .table-responsive select { min-width: 110px; }
    .panel-body .table-responsive input[type=checkbox], .panel-body .table-responsive input[type=radio] { min-width: 20px; }
    .panel-body .table-responsive .btn { white-space: nowrap; }
    .panel-body .crud-bar { position: static; justify-content: flex-start; gap: 8px; padding: 14px; border-radius: 0 0 12px 12px; }
    .panel-body .crud-btn { min-height: 44px; justify-content: center; padding: 10px 14px; flex: 1 1 auto; }
    .panel-body .crud-selected-info { flex-basis: 100%; margin: 2px 0; overflow-wrap: anywhere; }
    .panel-body .crud-bar form { display: flex !important; flex: 1 1 auto; }
}

@media (max-width: 575.98px) {
    .panel-content { padding: 18px 12px max(24px, env(safe-area-inset-bottom)); }
    .panel-card { padding: 16px; border-radius: 14px; margin-bottom: 16px; }
    .panel-page-title { font-size: 1.3rem; line-height: 1.35; }
    .panel-page-desc { font-size: .875rem; line-height: 1.6; margin-bottom: 18px; }
    .panel-body .dash-header-right { width: 100%; gap: 10px; }
    .panel-body .dash-header-right > .dash-search { flex: 1 1 100%; width: 100%; }
    .panel-body .dash-filters { padding: 12px; gap: 12px; align-items: stretch; }
    .panel-body .dash-filter-group { flex-wrap: wrap; width: 100%; }
    .panel-body .dash-filter-label { white-space: normal; }
    .panel-body .dash-toggle-btn { flex: 1; padding: 10px 12px; }
    .panel-body .section-title { font-size: .8rem; }
    .panel-body .kpi-strip { gap: 10px; }
    .panel-body .kpi-label { font-size: .68rem; overflow-wrap: anywhere; }
    .panel-body .kpi-sub { font-size: .72rem; overflow-wrap: anywhere; }
    .panel-body .modal-dialog { margin: 12px auto; }
    .panel-body .modal-content { border-radius: 16px; }
    .panel-body .modal-footer { gap: 8px; }
    .panel-body .modal-footer > .btn { flex: 1; margin: 0; }
    .panel-body .crud-btn { flex-basis: calc(50% - 8px); }
    .panel-body .crud-bar form { flex-basis: calc(50% - 8px); }
    .report-preference-line { grid-template-columns: minmax(0,1fr) 20px 44px 44px; padding: 8px 0; border-bottom: 1px solid #e2e8f0; }
    .report-preference-line > label { grid-column: 1 / -1; }
    .report-preference-line > input { max-width: none; }
    [data-report-preferences] > summary { font-size: .88rem; }
    [data-preference-columns] legend { font-size: .875rem !important; }
}

@media (max-width: 374.98px) {
    .panel-body .kpi-strip { grid-template-columns: 1fr; }
    .panel-body .dash-stat { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
    .panel-sidebar, .sidebar-chevron, .dash-toggle-btn { transition: none !important; }
}
@media print {
    .panel-sidebar, .panel-mobile-header, .panel-menu-backdrop, .panel-skip-link { display: none !important; }
    .panel-main { width: 100%; }
    .panel-content { max-width: none; padding: 0; }
}
