:root{
  --ui-primary:#0d6efd;
  --ui-primary-soft:#eaf2ff;
  --ui-bg:#f4f6f9;
  --ui-surface:#ffffff;
  --ui-border:#dee2e6;
  --ui-text:#212529;
  --ui-muted:#6c757d;
  --ui-radius:10px;
  --ui-shadow:0 .125rem .25rem rgba(0,0,0,.075);
}

html{min-height:100%;-webkit-text-size-adjust:100%;background:var(--ui-bg)}
body{min-height:100dvh;background:var(--ui-bg);color:var(--ui-text);overflow-x:hidden;overscroll-behavior-y:contain;-webkit-tap-highlight-color:transparent}
a{text-decoration:none}
button,a,input,select,textarea{touch-action:manipulation}
input,select,textarea{font-size:max(16px,var(--app-font-size,14px))}

/* AdminLTE shell */
.app-wrapper{min-height:100dvh}
.app-main{background:var(--ui-bg)}
.app-content{padding-bottom:1rem}
.ui-page-container{padding-bottom:1rem}
.ui-content-header{padding:.9rem 0 .65rem}
.ui-page-title{font-size:1.35rem;font-weight:700;color:#1f2937;letter-spacing:-.015em}
.ui-page-subtitle{margin-top:.2rem;color:var(--ui-muted);font-size:.85rem}
.breadcrumb{font-size:.8rem}

/* Sidebar */
.ui-sidebar{border-right:0!important}
body.sidebar-theme-dark .ui-sidebar{background:#343a40!important}
body.sidebar-theme-primary .ui-sidebar{background:linear-gradient(180deg,#0d6efd,#084298)!important}
body.sidebar-theme-light .ui-sidebar{background:#fff!important;border-right:1px solid #dee2e6!important}
body.sidebar-theme-light .ui-sidebar .sidebar-brand{border-bottom-color:#dee2e6!important}
body.sidebar-theme-light .ui-sidebar .brand-link,
body.sidebar-theme-light .ui-sidebar .brand-text,
body.sidebar-theme-light .ui-sidebar .nav-link,
body.sidebar-theme-light .ui-sidebar .nav-header{color:#495057!important}
body.sidebar-theme-light .ui-sidebar .nav-link.active{color:#fff!important;background:#0d6efd!important}
body.sidebar-theme-light .sidebar-shift-card{background:#f8f9fa;border-color:#dee2e6;color:#495057}
body.sidebar-theme-light .sidebar-shift-card small{color:#6c757d}

.sidebar-brand{min-height:57px;border-bottom:1px solid rgba(255,255,255,.1)}
.brand-link{display:flex!important;align-items:center;gap:.65rem;min-width:0;padding:.7rem .9rem!important}
.brand-image{width:34px!important;height:34px!important;min-width:34px;max-height:none!important;margin:0!important;padding:3px;border-radius:7px;object-fit:contain}
.brand-fallback{display:grid;place-items:center;background:#fff;color:#0d6efd}
.brand-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.95rem}

.sidebar-wrapper{padding:.45rem .55rem .8rem}
.sidebar-menu .nav-link{border-radius:6px;margin-bottom:2px;padding:.58rem .7rem}
.sidebar-menu .nav-link .nav-icon{font-size:.95rem;width:1.55rem;margin-right:.2rem}
.sidebar-menu .nav-link p{font-size:.88rem;font-weight:500}
.sidebar-menu .nav-link.active{box-shadow:none}
.sidebar-menu .nav-header{padding:.9rem .7rem .35rem;font-size:.68rem;font-weight:700;letter-spacing:.08em;opacity:.66}
.sidebar-menu .nav-badge{font-size:.62rem;letter-spacing:.02em}

.sidebar-shift-card{display:flex;align-items:center;gap:.65rem;margin:.25rem .25rem .55rem;padding:.65rem .7rem;border:1px solid rgba(255,255,255,.11);border-radius:8px;background:rgba(255,255,255,.06);color:#fff}
.sidebar-shift-dot{width:9px;height:9px;border-radius:50%;background:#ffc107;flex:0 0 auto}
.sidebar-shift-card.is-open .sidebar-shift-dot{background:#20c997;box-shadow:0 0 0 4px rgba(32,201,151,.14)}
.sidebar-shift-copy{min-width:0;line-height:1.15}
.sidebar-shift-copy strong{display:block;font-size:.7rem;letter-spacing:.06em}
.sidebar-shift-copy small{display:block;margin-top:2px;color:rgba(255,255,255,.65);font-size:.67rem}

/* Header */
.ui-navbar{min-height:57px;padding:.35rem .65rem;box-shadow:0 1px 2px rgba(0,0,0,.035)}
.sidebar-toggle-link{width:38px;height:38px;display:grid!important;place-items:center;border-radius:6px}
.sidebar-toggle-link:hover{background:#f1f3f5}
.navbar-brand-mini{display:grid;width:34px;height:34px;place-items:center;border:1px solid #dee2e6;border-radius:7px;background:#fff;overflow:hidden}
.navbar-brand-mini img{width:100%;height:100%;padding:3px;object-fit:contain}
.navbar-app-name{display:block;max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.88rem;font-weight:600;color:#495057}
.navbar-cafe-form{height:38px;display:flex;align-items:center;gap:.45rem;padding:0 .4rem 0 .65rem;border:1px solid #dee2e6;border-radius:7px;background:#fff;color:#6c757d}
.navbar-cafe-form .form-select{width:155px;border:0!important;box-shadow:none!important;background-color:transparent;font-size:.8rem;padding-top:.2rem;padding-bottom:.2rem}
.navbar-date{display:inline-flex;align-items:center;height:38px;padding:0 .7rem;border:1px solid #dee2e6;border-radius:7px;background:#fff;color:#6c757d;font-size:.8rem}

.user-nav-link{display:flex!important;align-items:center;padding:.3rem .45rem!important;border-radius:7px}
.user-nav-link:hover{background:#f1f3f5}
.user-avatar{width:32px;height:32px;display:inline-grid;place-items:center;border-radius:50%;background:#0d6efd;color:#fff;font-size:.82rem;font-weight:700;line-height:1}
.user-avatar-lg{width:58px;height:58px;font-size:1.15rem;border:3px solid rgba(255,255,255,.35)}
.user-name-text{max-width:135px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#495057;font-size:.82rem;font-weight:600}
.user-menu .dropdown-menu{border:0}
.user-menu .user-header{padding:1rem!important}
.user-menu .user-footer{padding:.65rem!important;background:#f8f9fa}

.license-pill{height:38px;display:inline-flex;align-items:center;gap:.4rem;padding:0 .7rem;border:1px solid #dee2e6;border-radius:7px;font-size:.76rem;font-weight:600;white-space:nowrap}
.license-ok{color:#146c43;background:#d1e7dd;border-color:#badbcc}
.license-life{color:#055160;background:#cff4fc;border-color:#b6effb}
.license-warn{color:#664d03;background:#fff3cd;border-color:#ffecb5}
.license-danger{color:#842029;background:#f8d7da;border-color:#f5c2c7}
.license-alert-card{padding:.8rem;border:1px solid #ffe69c;border-radius:8px;background:#fff3cd;color:#664d03}
.license-alert-card.danger{border-color:#f5c2c7;background:#f8d7da;color:#842029}
.ui-toast-container{z-index:1085;margin-top:56px}

/* Common components: AdminLTE-like, less custom */
.card,.modern-card,.card-soft,.kpi-card,.page-hero,.toolbar,.dashv2-card,.dashv2-hero{border-radius:var(--ui-radius)!important}
.card{border:1px solid rgba(0,0,0,.125);box-shadow:var(--ui-shadow)}
.card-header{background:#fff;border-bottom:1px solid rgba(0,0,0,.125)}
.card-title{font-weight:600}
.table-responsive{border-radius:8px}
.table>thead>tr>th{font-size:.77rem;font-weight:700;color:#495057;white-space:nowrap}
.table>tbody>tr>td{vertical-align:middle}
.form-control,.form-select,.input-group-text{border-radius:6px}
.input-group>.form-control:not(:first-child),.input-group>.form-select:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}
.input-group>.input-group-text:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}
.btn{border-radius:6px}
.badge{font-weight:600}
.dropdown-menu{border-radius:8px}
.alert{border-radius:8px}
.modal-content{border-radius:10px}

/* Keep legacy page selectors compatible */
.main-content{min-width:0}
.top-navbar{position:relative}
.page-content-wrapper{min-width:0}
.btn-round{border-radius:6px!important}

/* Footer */
.ui-footer{font-size:.8rem;padding:.75rem 1rem;background:#fff;border-top:1px solid #dee2e6}

/* PWA */
.pwa-install-sheet{position:fixed;inset:0;z-index:1090;display:none;align-items:flex-end;justify-content:center;padding:16px max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));background:rgba(15,23,42,.56);backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px)}
.pwa-install-sheet.show{display:flex}
.pwa-install-card{width:min(460px,100%);padding:20px;border:1px solid #dee2e6;border-radius:12px;background:#fff;box-shadow:0 20px 50px rgba(0,0,0,.22)}
.pwa-install-card h3{margin:0 0 8px;font-size:1.05rem;font-weight:700}
.pwa-install-card p{margin:0;color:#6c757d;line-height:1.5}
.pwa-install-actions{display:flex;gap:10px;margin-top:16px}
.pwa-install-actions .btn{min-height:44px;flex:1}
.pwa-update-toast{position:fixed;z-index:1085;left:50%;bottom:max(18px,env(safe-area-inset-bottom));width:min(420px,calc(100% - 28px));transform:translateX(-50%);display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-radius:8px;background:#212529;color:#fff;box-shadow:0 10px 30px rgba(0,0,0,.2)}
.pwa-update-toast button{border:0;border-radius:5px;padding:7px 11px;background:#0d6efd;color:#fff;font-weight:600}

/* Mobile */
@media (max-width:991.98px){
  .ui-navbar{padding-top:max(.35rem,env(safe-area-inset-top));padding-left:max(.5rem,env(safe-area-inset-left));padding-right:max(.5rem,env(safe-area-inset-right))}
  .ui-content-header{padding:.7rem 0 .45rem}
  .ui-page-title{font-size:1.15rem}
  .ui-page-subtitle{font-size:.78rem}
  .app-content{padding-bottom:max(1rem,env(safe-area-inset-bottom))}
  .btn,.form-control,.form-select,.input-group-text{min-height:42px}
  .pos-cart{top:65px!important}
}
@media (max-width:575.98px){
  .ui-page-container{padding-left:.7rem;padding-right:.7rem}
  .ui-content-header .container-fluid{padding-left:.7rem;padding-right:.7rem}
  .ui-page-title{font-size:1.08rem}
  .ui-page-subtitle{display:none}
  .card-body{padding:.85rem}
  .table-responsive{font-size:.83rem}
  .user-menu .dropdown-menu{max-width:calc(100vw - 1rem)}
}
@media (display-mode:standalone){.browser-only{display:none!important}}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}}

@media print{
  .app-sidebar,.app-header,.ui-content-header,.app-footer{display:none!important}
  .app-wrapper{display:block!important}
  .app-main,.app-content{display:block!important;width:100%!important;max-width:100%!important}
}


/* DG-POS 4.3 mobile/PWA polish */
:root{
  --ui-radius:12px;
  --ui-shadow:0 2px 10px rgba(15,23,42,.06);
}
.ui-page-subtitle,.page-subtitle,.pos-subtitle,.help-text,.field-hint,.hero-sub,.kpi .hint{display:none!important}
.card{border:1px solid #e7eaf0;border-radius:12px;box-shadow:var(--ui-shadow);overflow:hidden}
.card-header{background:#fff;border-bottom:1px solid #edf0f4}
.form-control,.form-select,.input-group-text,.btn{border-radius:9px}
.form-control,.form-select{min-height:42px;border-color:#dfe3e8}
.form-control:focus,.form-select:focus{border-color:#86b7fe;box-shadow:0 0 0 .18rem rgba(13,110,253,.12)}
.btn{min-height:40px;font-weight:600}
.table>:not(caption)>*>*{padding:.72rem .75rem;border-bottom-color:#edf0f4}
.table thead th{white-space:nowrap;background:#f8fafc;color:#475569;font-size:.78rem;text-transform:uppercase;letter-spacing:.02em}
.badge{font-weight:600}
.modal-content,.offcanvas{border:0;border-radius:14px;box-shadow:0 22px 50px rgba(15,23,42,.18)}

@media (max-width:767.98px){
  body{padding-bottom:env(safe-area-inset-bottom)}
  .ui-content-header{padding:.65rem 0 .45rem}
  .ui-page-title{font-size:1.18rem}
  .container-fluid{padding-left:12px;padding-right:12px}
  .card{border-radius:11px}
  .card-header,.card-body,.card-footer{padding-left:12px;padding-right:12px}
  .table-responsive{margin-left:-12px;margin-right:-12px;width:calc(100% + 24px)}
  .table-responsive .table{min-width:680px}
  .form-label{margin-bottom:.3rem;font-size:.76rem;font-weight:700;color:#64748b}
  .btn{min-height:44px}
  .btn-sm{min-height:36px}
  .pagination .page-link{min-width:36px;min-height:36px;display:grid;place-items:center}
}

@media (display-mode:standalone){
  .app-header{padding-top:env(safe-area-inset-top)}
  .app-footer{padding-bottom:env(safe-area-inset-bottom)}
}
