
/* ============================
   MBUROYA – Theme B (Tech SaaS)
   Clean, modern, "Framer-like"
   ============================ */

:root{
  --bg:#f6f8fc;
  --surface:#ffffff;
  --surface2:#fbfcff;
  --text:#0b1220;
  --muted:#667085;

  --line:#e6e8ef;

  --primary:#2a388e;
  --accent:#1963ae;
  --accent2:#009cc5;

  --danger:#ef4444;
  --ok:#16a34a;

  --radius:14px;
  --radius2:18px;


  --pad:18px;
  --gap:14px;

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background:var(--bg);
  color:var(--text);
}

a{color:inherit;text-decoration:none}
.small{font-size:12px}
.muted{color:var(--muted)}
.hr{height:1px;background:var(--line);margin:14px 0}

.container{max-width:1280px;margin:0 auto;padding:18px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.grid{display:grid;gap:14px;grid-template-columns:repeat(12,1fr)}

.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius2);
  padding:var(--pad);
  transition:border-color 0.2s;
}
.card:hover{
  border-color:rgba(25,99,174,.15);
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border:1px solid var(--line);
  border-radius:999px;
  padding:6px 10px;
  font-size:12px;
  color:var(--muted);
  background:var(--surface2);
  white-space:nowrap;
}
.badge svg,
.badge-icon{
  width:12px;
  height:12px;
  flex-shrink:0;
  stroke-width:2.5;
}
.badge-icon{
  display:flex;
  align-items:center;
  justify-content:center;
}
.badge-icon svg{
  width:12px;
  height:12px;
  stroke-width:2.5;
}

.badge.ok{border-color:rgba(22,163,74,.25); color:var(--ok)}
.badge.warn{border-color:rgba(245,158,11,.35); color:#b45309}
.badge.danger{border-color:rgba(239,68,68,.25); color:var(--danger)}

.input, select, textarea{
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 12px;
  background:#fff;
  min-height:42px;
  outline:none;
  font-size:14px;
  font-family:inherit;
  color:var(--text);
  transition:all 0.2s;
  width:100%;
}
.input::placeholder, select::placeholder, textarea::placeholder{
  color:var(--muted);
  opacity:0.6;
}

/* Date Input Styling - User Friendly */
input[type="date"]{
  position:relative;
  cursor:pointer;
  padding-right:40px;
  appearance:none;
  -webkit-appearance:none;
  -moz-appearance:textfield;
}
input[type="date"]::-webkit-calendar-picker-indicator{
  position:absolute;
  right:10px;
  top:50%;
  transform:translateY(-50%);
  width:20px;
  height:20px;
  cursor:pointer;
  opacity:0.6;
  transition:opacity 0.2s, transform 0.2s;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
  background-size:contain;
  background-repeat:no-repeat;
  background-position:center;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover{
  opacity:1;
  transform:translateY(-50%) scale(1.1);
}
input[type="date"]:focus::-webkit-calendar-picker-indicator{
  opacity:1;
}
input[type="date"]::-webkit-inner-spin-button,
input[type="date"]::-webkit-clear-button{
  display:none;
  -webkit-appearance:none;
}
/* Firefox date input */
input[type="date"]::-moz-calendar-picker-indicator{
  width:20px;
  height:20px;
  cursor:pointer;
  opacity:0.6;
  transition:opacity 0.2s, transform 0.2s;
}
input[type="date"]::-moz-calendar-picker-indicator:hover{
  opacity:1;
  transform:scale(1.1);
}

/* Date Input Wrapper for better UX */
.date-input-wrapper{
  position:relative;
  display:flex;
  align-items:center;
  width:100%;
}
.date-input-wrapper .input[type="date"]{
  padding-right:40px;
}
.date-input-icon{
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  pointer-events:none;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  z-index:1;
  transition:color 0.2s;
}
.date-input-wrapper:focus-within .date-input-icon{
  color:var(--primary);
}
.date-input-icon svg{
  width:16px;
  height:16px;
  flex-shrink:0;
}
.input:focus, select:focus, textarea:focus{
  border-color:rgba(25,99,174,.45);
  outline:2px solid rgba(0,156,197,.10);
  outline-offset:2px;
}

.btn{
  border:1px solid var(--line);
  background:#fff;
  border-radius:12px;
  padding:10px 12px;
  min-height:42px;
  display:inline-flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  font-size:14px;
  font-weight:500;
  white-space:nowrap;
}
.btn-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.btn-icon svg{
  width:14px;
  height:14px;
  stroke-width:2.5;
  flex-shrink:0;
  transition:transform 0.2s;
}
.btn:hover .btn-icon svg{
  transform:scale(1.1);
}
.btn svg:not(.btn-icon svg){
  width:14px;
  height:14px;
  flex-shrink:0;
  stroke-width:2.5;
}
.btn:hover{border-color:rgba(25,99,174,.45)}
.btn.primary{
  border:0;
  color:#fff;
  background:linear-gradient(135deg,var(--primary),var(--accent),var(--accent2));
}
.btn.primary:hover{
  opacity:0.9;
  transform:translateY(-1px);
}
.btn:hover{
  transition:all 0.2s;
}
.btn.ghost{background:transparent}
.btn.icon{
  width:42px;
  min-width:42px;
  justify-content:center;
  padding:0;
}
.btn.icon svg{
  width:16px;
  height:16px;
  flex-shrink:0;
}

table{width:100%;border-collapse:separate;border-spacing:0}
th{
  text-align:left;
  font-size:12px;
  color:var(--muted);
  font-weight:700;
  padding:12px;
  border-bottom:1px solid var(--line);
  background:linear-gradient(180deg,#fff, #fbfcff);
  position:sticky; 
  top:0;
  z-index:10;
  white-space:nowrap;
}
td{
  padding:14px 12px;
  border-bottom:1px solid #f0f1f6;
  vertical-align:top;
  word-break:break-word;
  font-size:14px;
}
tr:hover td{
  background:#fbfbfe;
}
tr:last-child td{
  border-bottom:none;
}
/* Table responsive wrapper */
.table-responsive{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  border-radius:12px;
  border:1px solid var(--line);
  width:100%;
  position:relative;
}
.table-responsive table{
  margin:0;
  width:100%;
}
/* Allow horizontal scroll on mobile only when necessary */
@media (max-width: 980px) {
  .table-responsive{
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(42, 56, 142, 0.2) transparent;
  }
  .table-responsive::-webkit-scrollbar{
    height: 6px;
  }
  .table-responsive::-webkit-scrollbar-track{
    background: transparent;
  }
  .table-responsive::-webkit-scrollbar-thumb{
    background: rgba(42, 56, 142, 0.2);
    border-radius: 3px;
  }
  .table-responsive::-webkit-scrollbar-thumb:hover{
    background: rgba(42, 56, 142, 0.3);
  }
  .table-responsive table{
    min-width: max-content;
    width: max-content;
    display: table;
  }
}

.login-header-logo{
  display:flex;
  align-items:center;
  justify-content:center;
  margin:auto;
}
.login-header-logo img{
  width:50%;
  height:100%;
  object-fit:contain;
  display:flex;
  align-items:center;
  justify-content:center;
}

.kpi{
  display:flex;align-items:flex-start;justify-content:space-between;gap:12px
}
.kpi .num{font-size:28px;font-weight:900;letter-spacing:-0.4px}
.kpi .label{font-size:12px;color:var(--muted);margin-top:4px}
.spark{height:10px;border-radius:999px;background:rgba(0,156,197,.14);overflow:hidden}
.spark > i{display:block;height:100%;width:55%;background:linear-gradient(90deg,var(--accent2),var(--accent))}

/* ===== App Shell ===== */
.shell{display:grid;grid-template-columns:260px 1fr;gap:14px}
.sidebar{
  position:sticky; top:18px; align-self:start;
  background:rgba(255,255,255,.78);
  backdrop-filter:saturate(180%) blur(10px);
  border:1px solid var(--line);
  border-radius:var(--radius2);
  padding:12px;
  transform: none;
  transition: none;
}

/* Mobile Topbar - Hidden on desktop */
.mobile-topbar {
  display: none;
}

main {
  margin-top: 0;
}
.brand{
  display:flex;align-items:center;gap:10px;
  padding:10px 10px 14px 10px;
}
.brand img{height:28px;max-width:150px;object-fit:contain}
.brand .t{font-weight:900;letter-spacing:0.2px}
.brand .s{font-size:12px;color:var(--muted)}

.navcol{display:flex;flex-direction:column;gap:6px}
.navcol a{
  display:flex;align-items:center;gap:10px;
  padding:10px 10px;
  border-radius:12px;
  color:var(--muted);
  border:1px solid transparent;
}
.navcol a svg{
  width:16px;
  height:16px;
  flex-shrink:0;
}
.navcol a:hover{background:rgba(0,156,197,.07); color:var(--text); border-color:rgba(25,99,174,.12)}
.navcol a.active{background:rgba(42,56,142,.10); color:var(--primary); border-color:rgba(42,56,142,.18)}

.topbar{
  position:sticky; top:18px; z-index:40;
  background:rgba(255,255,255,.78);
  backdrop-filter:saturate(180%) blur(10px);
  border:1px solid var(--line);
  border-radius:var(--radius2);
  padding:12px 14px;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
}
.search{
  flex:1; display:flex; gap:10px; align-items:center;
}
.search .input{flex:1; min-width:220px; background:#fff}
.search-icon-wrapper{
  position:absolute;
  left:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
  color:var(--muted);
}
.search-icon-wrapper svg{
  width:14px;
  height:14px;
  flex-shrink:0;
}
.actions{display:flex;gap:10px;align-items:center}
.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--line);
  border-radius:999px;
  padding:8px 12px;
  background:linear-gradient(180deg,#fff,#fbfcff);
  color:var(--muted);
  font-size:13px;
}
.pill strong{
  color:var(--text);
  font-weight:600;
}
.pill svg{
  width:12px;
  height:12px;
  flex-shrink:0;
}

/* ===== Mobile Topbar ===== */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 100;
  padding: 0 12px;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  border-color: rgba(42, 56, 142, 0.3);
  background: rgba(42, 56, 142, 0.05);
}

.mobile-menu-btn svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
  stroke-width: 2.5;
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  padding-right: 8px;
}

.mobile-logo img {
  height: 32px;
  max-width: 120px;
  object-fit: contain;
}

.mobile-logo-placeholder {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(42, 56, 142, 0.12), rgba(0, 156, 197, 0.12));
}

.mobile-logo-text {
  display: flex;
  flex-direction: column;
}

.mobile-logo-title {
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0.2px;
  color: var(--text);
  line-height: 1.2;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 98;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ===== Mobile ===== */
.mobilebar{
  display:none;
  position:fixed;
  left:10px;
  right:10px;
  bottom:10px;
  background:rgba(255,255,255,.98);
  backdrop-filter:saturate(180%) blur(12px);
  border:1px solid var(--line);
  border-radius:16px;
  padding:8px 4px;
  z-index:60;
  box-sizing:border-box;
}
.mobilebar a{
  flex:1;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:4px;
  padding:8px 6px;
  border-radius:12px;
  color:var(--muted);
  transition:all 0.2s;
}
.mobilebar a svg{
  width:16px;
  height:16px;
  flex-shrink:0;
}
.mobilebar a span{font-size:10px;font-weight:500}
.mobilebar a.active{background:rgba(42,56,142,.12); color:var(--primary)}
.mobilebar a:hover{background:rgba(0,156,197,.08); color:var(--text)}
.burger{display:none}

/* File input styling */
.file-input-wrapper{
  position:relative;
  display:inline-flex;
  align-items:center;
}
.file-input-wrapper input[type="file"]{
  position:absolute;
  opacity:0;
  width:0;
  height:0;
  overflow:hidden;
}
.file-input-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:42px;
  min-height:42px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  cursor:pointer;
  transition:all 0.2s;
  padding:10px 12px;
}
.file-input-btn span{
  font-size:14px;
  color:var(--muted);
}
.file-input-btn:hover{
  border-color:rgba(25,99,174,.45);
  background:rgba(0,156,197,.05);
}
.file-input-btn svg{
  width:14px;
  height:14px;
  color:var(--muted);
  flex-shrink:0;
}
.file-input-btn:hover svg{
  color:var(--primary);
}

/* Icon button improvements */
.icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
  cursor:pointer;
  transition:all 0.2s;
  padding:0;
}
.icon-btn svg{
  width:14px;
  height:14px;
  color:var(--muted);
  flex-shrink:0;
}
.icon-btn:hover{
  border-color:rgba(25,99,174,.45);
  background:rgba(0,156,197,.05);
}
.icon-btn:hover svg{
  color:var(--primary);
}
.icon-btn.danger:hover{
  border-color:rgba(239,68,68,.45);
  background:rgba(239,68,68,.05);
}
.icon-btn.danger:hover svg{
  color:var(--danger);
}
.sr{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border-width:0;
}

/* Dashboard improvements */
.kpi{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.kpi .num{
  font-size:32px;
  font-weight:900;
  letter-spacing:-0.5px;
  line-height:1;
  color:var(--text);
}
.kpi .label{
  font-size:13px;
  color:var(--muted);
  font-weight:500;
}

/* Dashboard KPI Cards */
.kpi-card{
  position:relative;
  overflow:hidden;
  transition:all 0.3s ease;
}
.kpi-card:hover{
  transform:translateY(-2px);
}
.kpi-card-header{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:16px;
}
.kpi-card-icon{
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:12px;
  flex-shrink:0;
}
.kpi-card-icon svg{
  width:24px;
  height:24px;
  flex-shrink:0;
  stroke-width:2.5;
  transition:transform 0.3s ease;
}
.kpi-card:hover .kpi-card-icon svg{
  transform:scale(1.1);
}
.kpi-icon-primary{
  background:linear-gradient(135deg, rgba(42,56,142,.12), rgba(42,56,142,.06));
  border:1px solid rgba(42,56,142,.2);
}
.kpi-icon-primary svg{
  color:var(--primary);
}
.kpi-icon-success{
  background:linear-gradient(135deg, rgba(22,163,74,.12), rgba(22,163,74,.06));
  border:1px solid rgba(22,163,74,.2);
}
.kpi-icon-success svg{
  color:var(--ok);
}
.kpi-icon-info{
  background:linear-gradient(135deg, rgba(0,156,197,.12), rgba(0,156,197,.06));
  border:1px solid rgba(0,156,197,.2);
}
.kpi-icon-info svg{
  color:var(--accent);
}
.kpi-icon-warning{
  background:linear-gradient(135deg, rgba(245,158,11,.12), rgba(245,158,11,.06));
  border:1px solid rgba(245,158,11,.2);
}
.kpi-icon-warning svg{
  color:#b45309;
}
.kpi-card-title{
  font-size:13px;
  font-weight:600;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:0.3px;
}
.kpi-card-content{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.kpi-num{
  font-size:32px;
  font-weight:900;
  letter-spacing:-0.5px;
  line-height:1;
  color:var(--text);
}
.kpi-details{
  display:flex;
  flex-direction:column;
  gap:6px;
}
.kpi-detail-item{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:12px;
}
.kpi-detail-label{
  color:var(--muted);
}
.kpi-detail-value{
  color:var(--text);
  font-weight:600;
}

/* Chart Cards */
.chart-card{
  position:relative;
}
.chart-card-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:8px;
}
.chart-card-title-section{
  display:flex;
  align-items:center;
  gap:12px;
  flex:1;
}
.chart-card-icon{
  width:40px;
  height:40px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg, rgba(42,56,142,.08), rgba(0,156,197,.08));
  border:1px solid rgba(42,56,142,.15);
  border-radius:10px;
  flex-shrink:0;
}
.chart-card-icon svg{
  width:20px;
  height:20px;
  color:var(--primary);
  flex-shrink:0;
  stroke-width:2.5;
  transition:transform 0.3s ease;
}
.chart-card:hover .chart-card-icon svg{
  transform:scale(1.1);
}
.chart-wrap{
  position:relative;
  height:280px;
  margin-top:16px;
}

/* Dashboard Filter Form */
.dashboard-filter-form{
  display:flex;
  align-items:end;
  gap:12px;
  flex-wrap:wrap;
}

/* Table Wrapper */
.table-wrapper{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  border-radius:12px;
}
.table-wrapper table{
  margin:0;
}

/* Page Headers - Uniform styling */
.page-header{
  margin-bottom:0;
  padding-bottom:0;
}
.page-header-content{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
  width:100%;
}
.page-title-section{
  display:flex;
  align-items:center;
  gap:16px;
  flex:1;
  min-width:0;
}
.page-icon-large{
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg, rgba(42,56,142,.08), rgba(0,156,197,.08));
  border:1px solid rgba(42,56,142,.15);
  border-radius:12px;
  flex-shrink:0;
  transition:all 0.3s ease;
}
.page-icon-large svg{
  width:24px;
  height:24px;
  color:var(--primary);
  flex-shrink:0;
  stroke-width:2.5;
  transition:transform 0.3s ease;
}
.page-header:hover .page-icon-large{
  border-color:rgba(42,56,142,.25);
  background:linear-gradient(135deg, rgba(42,56,142,.12), rgba(0,156,197,.12));
}
.page-header:hover .page-icon-large svg{
  transform:scale(1.05);
}
.page-header-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  flex-shrink:0;
}
.page-header h3{
  margin:0 0 6px 0 !important;
  font-size:20px;
  font-weight:700;
  color:var(--text);
  line-height:1.3;
  letter-spacing:-0.2px;
}
.page-header .small.muted{
  font-size:13px;
  color:var(--muted);
  margin-top:0;
  line-height:1.4;
  display:block;
}
.page-title-section > div:last-child{
  min-width:0;
  flex:1;
}
.page-title-section > div:last-child h3{
  margin:0 0 6px 0 !important;
}

/* Search Forms */
.search-form{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.search-form-inline{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.search-input-wrapper{
  position:relative;
  display:flex;
  align-items:center;
}
.search-icon{
  position:absolute;
  left:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
  color:var(--muted);
  z-index:1;
}
.search-icon svg{
  width:14px;
  height:14px;
  flex-shrink:0;
}

/* Notifications Header - Now using standard .page-header */

/* Notifications Feed */
.feed{
  display:flex;
  flex-direction:column;
  gap:12px;
}
.feed-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  padding:0;
  background:var(--surface2);
  border:1px solid var(--line);
  border-radius:12px;
  transition:all 0.2s;
  overflow:hidden;
  position:relative;
}
.feed-item:hover{
  border-color:rgba(25,99,174,.25);
  background:#fff;
  transform:translateY(-1px);
}
.notification-card{
  padding-left:4px;
}
.notification-indicator{
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:4px;
  flex-shrink:0;
}
.feed-item-content{
  flex:1;
  min-width:0;
  padding:16px;
  padding-left:20px;
}
.feed-item-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:12px;
  flex-wrap:wrap;
}
.feed-item-title{
  display:flex;
  align-items:center;
  gap:12px;
  font-size:16px;
  font-weight:600;
  color:var(--text);
  flex-wrap:wrap;
}
.notification-client-name{
  display:flex;
  align-items:center;
  gap:8px;
}
.notification-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  background:rgba(42,56,142,.06);
  border:1px solid rgba(42,56,142,.12);
  border-radius:8px;
  flex-shrink:0;
}
.notification-icon svg{
  width:16px;
  height:16px;
  color:var(--primary);
  flex-shrink:0;
}
.notification-badge{
  font-size:12px;
  font-weight:600;
  padding:6px 12px;
}
.feed-item-date{
  display:flex;
  align-items:center;
  gap:6px;
  font-size:13px;
  color:var(--muted);
  white-space:nowrap;
}
.date-icon{
  display:flex;
  align-items:center;
  justify-content:center;
}
.date-icon svg{
  width:14px;
  height:14px;
  flex-shrink:0;
}
.feed-item-services{
  display:flex;
  align-items:flex-start;
  gap:8px;
  font-size:14px;
  color:var(--muted);
  flex-wrap:wrap;
  padding:12px;
  background:#fff;
  border-radius:8px;
  border:1px solid #f0f1f6;
}
.services-label{
  display:flex;
  align-items:center;
  gap:6px;
  font-weight:500;
  white-space:nowrap;
}
.services-label svg{
  width:14px;
  height:14px;
  flex-shrink:0;
}
.feed-services-list{
  color:var(--text);
  font-weight:500;
  line-height:1.6;
}
.feed-item-actions{
  display:flex;
  gap:8px;
  flex-shrink:0;
  padding:16px;
  padding-left:0;
}

/* Empty State */
.empty-state{
  text-align:center;
  padding:60px 20px;
}
.empty-icon{
  width:48px;
  height:48px;
  margin:0 auto 20px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--surface2);
  border:1px solid var(--line);
  border-radius:50%;
  color:var(--muted);
}
.empty-icon svg{
  width:20px;
  height:20px;
  flex-shrink:0;
}
.empty-state h4{
  margin:0 0 8px 0;
  font-size:18px;
  font-weight:600;
  color:var(--text);
}
.empty-state p{
  margin:0;
  font-size:14px;
}

/* Client Info Grid */
.client-info-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
  gap:12px;
}
.info-item{
  background:var(--surface2);
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px;
  transition:all 0.2s;
}
.info-item:hover{
  border-color:rgba(25,99,174,.25);
  background:#fff;
}
.info-label{
  font-size:12px;
  color:var(--muted);
  font-weight:500;
  margin-bottom:6px;
  display:flex;
  align-items:center;
  gap:6px;
}
.info-label svg{
  width:12px;
  height:12px;
  flex-shrink:0;
  color:var(--muted);
}
.info-value{
  font-size:15px;
  font-weight:500;
  color:var(--text);
  word-break:break-word;
}

/* ============================================
   MOBILE RESPONSIVE - Complete Mobile Optimization
   ============================================ */

@media (max-width: 980px){
  .container{
    padding: 10px;
    padding-top: 66px; /* Space for mobile topbar (56px) + margin (10px) */
    max-width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
  }
  .shell{
    grid-template-columns: 1fr;
    gap: 0;
    overflow-x: hidden;
  }
  
  /* Mobile Topbar - Show on mobile */
  .mobile-topbar {
    display: flex !important;
  }
  
  /* Sidebar mobile behavior - Full screen drawer */
  .sidebar{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    z-index: 99;
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    padding: 0;
  }
  .sidebar.active{
    transform: translateX(0);
  }
  
  .sidebar .brand {
    padding: 16px 16px 12px 16px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(42, 56, 142, 0.03), rgba(0, 156, 197, 0.03));
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
  }
  
  .sidebar .brand img {
    height: 32px;
    max-width: 140px;
  }
  
  .sidebar .brand .t {
    font-size: 16px;
  }
  
  .sidebar .brand .s {
    font-size: 11px;
  }
  
  .navcol{
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    padding-bottom: 24px; /* Extra padding at bottom to ensure all buttons are visible */
    min-height: calc(100vh - 80px); /* Ensure full height for scrolling */
  }
  .navcol a{
    padding: 14px 16px;
    font-size: 15px;
    border-radius: 12px;
    min-height: 48px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .navcol a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }
  .navcol a:hover {
    background: rgba(42, 56, 142, 0.08);
    color: var(--primary);
    transform: translateX(2px);
  }
  .navcol a.active {
    background: rgba(42, 56, 142, 0.12);
    color: var(--primary);
    border-color: rgba(42, 56, 142, 0.2);
    font-weight: 600;
  }
  
  /* Ensure sidebar scrolls smoothly and shows all buttons */
  .sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(42, 56, 142, 0.2) transparent;
  }
  .sidebar::-webkit-scrollbar {
    width: 6px;
  }
  .sidebar::-webkit-scrollbar-track {
    background: transparent;
  }
  .sidebar::-webkit-scrollbar-thumb {
    background: rgba(42, 56, 142, 0.2);
    border-radius: 3px;
  }
  .sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(42, 56, 142, 0.3);
  }
  
  /* Hide desktop burger button */
  .burger{
    display: none !important;
  }
  
  /* Adjust main content for mobile topbar */
  main {
    margin-top: 0; /* No margin needed, container has padding-top */
  }
  
  /* Topbar mobile optimization - Hide old topbar on mobile, use mobile-topbar instead */
  .topbar{
    display: none !important; /* Hide old topbar on mobile */
  }
  .topbar .search{
    width: 100%;
    order: 2;
    flex-direction: column;
    gap: 8px;
  }
  .topbar .search .pill{
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
    font-size: 12px;
    display: none; /* Hide pill on mobile to save space */
  }
  .topbar .search > div{
    width: 100%;
    position: relative;
  }
  .topbar .search .input{
    width: 100%;
    min-width: 0;
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px 14px 12px 40px;
    border-radius: 10px;
  }
  .search-icon-wrapper{
    left: 12px;
  }
  .topbar .actions{
    width: 100%;
    order: 1;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
  }
  .topbar .actions::-webkit-scrollbar{
    display: none;
  }
  .topbar .actions .btn{
    flex: 1;
    min-width: 100px;
    max-width: 120px;
    justify-content: center;
    font-size: 12px;
    padding: 10px 8px;
    white-space: nowrap;
    border-radius: 10px;
  }
  .topbar .actions .btn span:not(.btn-icon){
    display: inline;
    font-size: 11px;
  }
  .topbar .actions .btn .btn-icon{
    margin-right: 4px;
  }
  .topbar .actions .btn svg{
    width: 14px;
    height: 14px;
  }
  
  /* Mobile bar */
  .mobilebar{
    display: flex;
    gap: 2px;
    padding: 8px 4px;
  }
  body{
    padding-bottom: 90px;
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
    overflow-x: hidden;
  }
  main{
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding-left: 0;
  }
  
  /* Cards and grid */
  .card{
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 12px;
  }
  .grid{
    gap: 12px;
    grid-template-columns: 1fr;
  }
  .grid > [style*="grid-column"]{
    grid-column: 1 / -1 !important;
  }
  
  /* KPI Cards */
  .kpi .num{
    font-size: 28px;
  }
  .kpi-num{
    font-size: 26px;
  }
  .kpi-card{
    grid-column: 1 / -1 !important;
  }
  
  /* Tables - Unified horizontal scroll approach (removed duplicate CSS above) */
  
  /* Allow text wrapping for specific columns that need it */
  td.text-wrap, th.text-wrap{
    white-space: normal;
    word-break: break-word;
    max-width: 220px;
  }
  
  /* Page header responsive */
  .page-header{
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 12px;
  }
  .page-header-content{
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-header h3{
    font-size: 18px;
    margin: 0 0 6px 0 !important;
    line-height: 1.3;
  }
  .page-header .small.muted{
    font-size: 12px;
    margin-top: 0;
    line-height: 1.4;
  }
  .page-header-actions{
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
  }
  .page-header-actions .btn{
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 10px 12px;
    font-size: 13px;
    min-height: 44px;
  }
  .page-header-actions .btn span:not(.btn-icon){
    font-size: 12px;
  }
  .page-title-section{
    width: 100%;
  }
  .page-icon-large{
    width: 36px;
    height: 36px;
  }
  .page-icon-large svg{
    width: 18px;
    height: 18px;
  }
  
  /* Login responsive */
  .login-container{
    padding: 16px;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .login-card{
    padding: 24px 20px;
    width: 100%;
    max-width: 400px;
  }
  .login-header h2{
    font-size: 22px;
  }
  
  /* Search forms */
  .search-form{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }
  .search-form .search-input-wrapper{
    width: 100%;
  }
  .search-form .input{
    width: 100%;
    font-size: 16px;
    padding: 12px 14px 12px 38px;
  }
  .search-form .btn{
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }
  .search-form-inline{
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }
  .search-form-inline .input,
  .search-form-inline select,
  .search-form-inline .search-input-wrapper{
    width: 100%;
    min-width: 0 !important;
  }
  .search-form-inline .btn{
    width: 100%;
    justify-content: center;
  }
  
  /* Form improvements */
  .form-grid{
    grid-template-columns: 1fr !important;
    gap: 16px;
  }
  .form-group{
    width: 100%;
  }
  .radio-card{
    min-width: 0;
    flex: 1 1 calc(50% - 6px);
    padding: 12px;
    border-radius: 10px;
    min-height: auto;
    cursor: pointer;
    touch-action: manipulation;
  }
  .radio-card:active{
    transform: scale(0.98);
    opacity: 0.9;
  }
  .radio-card-content{
    min-width: 0;
    width: 100%;
  }
  .radio-card-icon{
    width: 36px;
    height: 36px;
    margin-bottom: 6px;
  }
  .radio-card-icon svg{
    width: 18px;
    height: 18px;
  }
  .radio-card-title{
    font-size: 13px;
    line-height: 1.3;
    margin-bottom: 2px;
  }
  .radio-card-subtitle{
    font-size: 11px;
    line-height: 1.4;
  }
}

/* Responsive for searchable select */
@media (max-width: 640px){
  .form-grid{
    grid-template-columns: 1fr !important;
    gap: 14px;
  }
  .form-group{
    width: 100%;
  }
  .form-label{
    font-size: 13px;
    margin-bottom: 8px;
  }
  .form-label svg{
    width: 13px !important;
    height: 13px !important;
  }
  .input, select, textarea{
    width: 100%;
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 12px 14px;
    min-height: 44px;
    border-radius: 10px;
  }
  textarea{
    min-height: 100px;
    resize: vertical;
  }
  .radio-card{
    flex: 1 1 100%;
    margin-bottom: 0;
    min-width: 0;
  }
  /* Radio cards in groups should be side by side on slightly larger screens */
  @media (min-width: 480px) {
    .radio-card{
      flex: 1 1 calc(50% - 6px);
    }
  }
  .searchable-select-dropdown{
    max-height: 250px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  .searchable-option{
    padding: 12px 14px;
    font-size: 14px;
    min-height: 44px;
    border-radius: 8px;
    margin: 2px 4px;
  }
  .searchable-option:hover,
  .searchable-option.selected{
    background: rgba(42, 56, 142, 0.1);
  }
  .services-table-wrapper{
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .services-table-wrapper table{
    min-width: max-content;
  }
  .services-table-wrapper th,
  .services-table-wrapper td{
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }
  .services-table-wrapper input[type="checkbox"]{
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    accent-color: var(--primary);
  }
  .services-table-wrapper .input{
    font-size: 14px;
    padding: 8px 10px;
    min-height: 40px;
  }
}

@media (max-width: 640px){
  .container{
    padding: 8px;
  }
  .card{
    padding: 12px;
    border-radius: 10px;
    overflow-x: hidden; /* Prevent horizontal overflow */
  }
  
  .grid{
    gap: 10px;
    grid-template-columns: 1fr; /* Single column on mobile */
  }
  
  /* Ensure all cards span full width on mobile */
  .card[style*="grid-column"] {
    grid-column: 1 / -1 !important;
  }
  .topbar{
    padding: 8px 10px;
    gap: 8px;
  }
  .topbar .search{
    width: 100%;
    order: 2;
  }
  .topbar .search .pill{
    font-size: 11px;
    padding: 6px 10px;
  }
  .topbar .search .input{
    min-width: auto;
    width: 100%;
    font-size: 16px;
    padding: 10px 12px 10px 38px;
  }
  .topbar .actions{
    width: 100%;
    order: 1;
    justify-content: space-between;
    gap: 4px;
    padding-bottom: 4px;
  }
  .topbar .actions .btn{
    flex: 1;
    min-width: 85px;
    max-width: 110px;
    justify-content: center;
    font-size: 11px;
    padding: 8px 6px;
  }
  .topbar .actions .btn span:not(.btn-icon){
    display: inline;
    font-size: 10px;
  }
  .topbar .actions .btn .btn-icon{
    margin-right: 3px;
  }
  .topbar .actions .btn svg{
    width: 13px;
    height: 13px;
  }
  .burger{
    top: 8px;
    left: 8px;
    width: 40px;
    height: 40px;
    padding: 8px;
  }
  .kpi .num{
    font-size:24px;
  }
  .kpi-num{
    font-size:26px;
  }
  .kpi-card-icon{
    width:40px;
    height:40px;
  }
  .kpi-card-icon svg{
    width:20px;
    height:20px;
  }
  .chart-card-icon{
    width:36px;
    height:36px;
  }
  .chart-card-icon svg{
    width:18px;
    height:18px;
  }
  .chart-wrap{
    height:220px;
  }
  .dashboard-filter-form{
    flex-direction:column;
    align-items:stretch;
  }
  .dashboard-filter-form .form-group{
    width:100%;
  }
  .date-input-wrapper{
    min-width:100% !important;
  }
  .date-input-icon svg{
    width:14px;
    height:14px;
  }
  .row{
    flex-wrap:wrap;
    gap:8px;
  }
  .btn{
    padding:8px 10px;
    min-height:38px;
    font-size:13px;
  }
h3{
  font-size:18px;
  font-weight:700;
  color:var(--text);
  display:flex;
  align-items:center;
  gap:8px;
  margin:0 0 12px 0;
}
h3 svg{
  width:16px !important;
  height:16px !important;
  flex-shrink:0;
  color:var(--primary);
  vertical-align:middle;
  margin-right:6px;
  display:inline-block;
}
  .grid{
    grid-template-columns:1fr;
    gap:12px;
  }
  .card[style*="grid-column"]{
    grid-column:1 / -1 !important;
  }
  
  /* Dashboard KPI Cards - Stack on mobile */
  .kpi-card{
    grid-column:1 / -1 !important;
  }
  
  /* Dashboard Charts - Full width on mobile */
  .chart-card{
    grid-column:1 / -1 !important;
  }
  
  /* Quick Actions - Stack buttons */
  .card[style*="Aksione"] > div{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .card[style*="Aksione"] .btn{
    width:100%;
    justify-content:center;
  }
  
  /* Search form inline - stack on mobile */
  .search-form-inline{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
    width:100%;
  }
  .search-form-inline .search-input-wrapper,
  .search-form-inline select,
  .search-form-inline .input{
    width:100%;
    min-width:auto !important;
  }
  .search-form-inline .btn{
    width:100%;
    justify-content:center;
  }
  
table{
  display:block;
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  width:100%;
}
table select,
table .input{
  min-width:120px;
  font-size:13px;
  padding:8px 10px;
  min-height:36px;
}
/* Ensure tables are scrollable on mobile */
.table-wrapper,
.services-table-wrapper{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  width:100%;
}
  .file-input-wrapper{
    display:inline-flex;
  }
  .file-input-btn span{
    display:none;
  }
  .file-input-btn{
    width:42px;
    min-width:42px;
    justify-content:center;
  }
  
  /* Feed responsive */
  .feed-item{
    flex-direction:column;
    align-items:stretch;
    gap:0;
  }
  .feed-item-content{
    padding:14px;
    padding-left:18px;
  }
  .feed-item-header{
    flex-direction:column;
    align-items:flex-start;
    gap:10px;
  }
  .feed-item-title{
    flex-wrap:wrap;
    width:100%;
  }
  .feed-item-actions{
    width:100%;
    justify-content:flex-end;
    padding:0 14px 14px 14px;
  }
  .feed-item-actions .btn{
    flex:1;
    justify-content:center;
  }
  .notifications-title-section{
    gap:12px;
  }
  .notifications-icon-large{
    width:40px;
    height:40px;
  }
  .notifications-icon-large svg{
    width:20px;
    height:20px;
  }
  .page-icon-large{
    width:40px;
    height:40px;
  }
  .page-icon-large svg{
    width:20px;
    height:20px;
  }
  .page-header-content{
    flex-direction:column;
    align-items:stretch;
    gap:12px;
  }
  .page-header h3{
    font-size:16px;
    margin:0 0 6px 0 !important;
  }
  .page-header .small.muted{
    font-size:12px;
    margin-top:4px;
  }
  .page-header-actions{
    width:100%;
    justify-content:flex-start;
    flex-wrap:wrap;
    margin-top:0;
  }
  .page-header-actions .btn{
    flex:1;
    min-width:0;
    justify-content:center;
  }
  .page-header-actions .btn span:not(.btn-icon){
    font-size:12px;
  }
  .page-title-section{
    width:100%;
  }
  .search-form-inline{
    flex:1;
    min-width:0;
    width:100%;
  }
  .search-form-inline .input{
    flex:1;
    min-width:0;
  }
  .search-form{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .search-form .input,
  .search-form .search-input-wrapper{
    width:100%;
  }
  .search-form .btn{
    width:100%;
    justify-content:center;
  }
  
  /* Flash messages responsive */
  .flash-message{
    padding:12px 14px;
    gap:10px;
  }
  .flash-icon{
    width:18px;
    height:18px;
  }
  .flash-icon svg{
    width:16px;
    height:16px;
  }
  .flash-content{
    font-size:13px;
  }
  .flash-close{
    width:22px;
    height:22px;
  }
  .flash-close svg{
    width:12px;
    height:12px;
  }
  .current-logo-preview{
    padding:12px;
  }
  .logo-preview-img{
    height:40px;
    max-width:180px;
  }
  .form-info-text{
    font-size:12px;
  }
  .info-icon svg{
    width:12px;
    height:12px;
  }
  
  /* Empty state responsive */
  .empty-state{
    padding:40px 16px;
  }
  .empty-icon{
    width:48px;
    height:48px;
  }
  .empty-icon svg{
    width:20px;
    height:20px;
  }
  
  /* Badge responsive */
  .badge{
    font-size:11px;
    padding:5px 8px;
  }
  
  /* Client info grid responsive */
  .client-info-grid{
    grid-template-columns:1fr;
  }
  
  /* Info item responsive */
  .info-item{
    padding:12px;
  }
  .info-label{
    font-size:11px;
  }
  .info-value{
    font-size:14px;
  }
  
  /* ===== TABLES - Horizontal rows with scroll (NOT cards) ===== */
  .table-responsive{
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(42, 56, 142, 0.2) transparent;
    border: 1px solid var(--line);
    background: var(--surface);
    width: 100%;
    position: relative;
    margin: 0;
  }
  .table-responsive::-webkit-scrollbar{
    height: 8px;
  }
  .table-responsive::-webkit-scrollbar-track{
    background: transparent;
    border-radius: 4px;
  }
  .table-responsive::-webkit-scrollbar-thumb{
    background: rgba(42, 56, 142, 0.25);
    border-radius: 4px;
  }
  .table-responsive::-webkit-scrollbar-thumb:hover{
    background: rgba(42, 56, 142, 0.35);
  }
  
  /* Force tables to display as proper tables, NEVER as cards/grid */
  .table-responsive table{
    display: table !important;
    width: 100%;
    min-width: max-content;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    table-layout: auto;
  }
  .table-responsive thead{
    display: table-header-group !important;
  }
  .table-responsive tbody{
    display: table-row-group !important;
  }
  .table-responsive tr{
    display: table-row !important;
    border-bottom: 1px solid #f0f1f6;
  }
  .table-responsive tr:last-child td{
    border-bottom: none;
  }
  .table-responsive th,
  .table-responsive td{
    display: table-cell !important;
    padding: 12px 10px;
    font-size: 13px;
    vertical-align: middle;
    white-space: nowrap;
    border-bottom: 1px solid #f0f1f6;
    text-align: left;
  }
  .table-responsive th{
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    background: linear-gradient(180deg, #fff, #fbfcff);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--line);
    padding: 12px 10px;
  }
  .table-responsive td{
    color: var(--text);
    font-size: 13px;
  }
  .table-responsive tr:hover td{
    background: #fbfbfe;
  }
  
  /* Allow text wrapping for specific columns that need it */
  .table-responsive td.text-wrap,
  .table-responsive th.text-wrap{
    white-space: normal;
    word-break: break-word;
    max-width: 200px;
  }
  
  /* Progressive disclosure - Hide less critical columns on very small screens */
  @media (max-width: 480px) {
    /* Clients table (9 cols): ID, Klienti, Lloji, NUI, Telefon, Email, Adresë, Qyteti, Actions */
    .table-responsive th:nth-child(4), /* NUI */
    .table-responsive td:nth-child(4),
    .table-responsive th:nth-child(6), /* Email */
    .table-responsive td:nth-child(6),
    .table-responsive th:nth-child(7), /* Address */
    .table-responsive td:nth-child(7),
    .table-responsive th:nth-child(8), /* City */
    .table-responsive td:nth-child(8) {
      display: none !important;
    }
  }
  
  /* On slightly larger mobile (≥480px), show email */
  @media (min-width: 480px) and (max-width: 640px) {
    .table-responsive th:nth-child(6), /* Email */
    .table-responsive td:nth-child(6) {
      display: table-cell !important;
    }
  }
  
  /* Action column - Always visible and sticky on right */
  .table-responsive td:last-child,
  .table-responsive th:last-child{
    position: sticky;
    right: 0;
    background: var(--surface);
    z-index: 5;
    box-shadow: -2px 0 4px rgba(0,0,0,0.05);
    min-width: 140px;
    white-space: nowrap;
    padding-right: 12px;
    padding-left: 12px;
  }
  .table-responsive th:last-child{
    background: linear-gradient(180deg, #fff, #fbfcff);
    z-index: 11;
  }
  .table-responsive tr:hover td:last-child{
    background: #fbfbfe;
  }
  .table-responsive tr:hover th:last-child{
    background: linear-gradient(180deg, #fff, #fbfcff);
  }
  
  /* Action buttons in table cells */
  .table-responsive td:last-child .row{
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }
  .table-responsive td:last-child .icon-btn{
    min-width: 36px;
    min-height: 36px;
    padding: 6px;
    flex-shrink: 0;
  }
  .table-responsive td:last-child form{
    display: inline-flex;
    margin: 0;
  }
  
  /* Removed table card view - tables should always be horizontal rows with scroll */
  
  /* Section headers */
  h3{
    font-size:16px;
  }
  h3 svg{
    width:14px !important;
    height:14px !important;
  }
  .page-header h3{
    font-size:18px;
  }
  
  /* Form grid responsive */
  .form-grid{
    grid-template-columns:1fr !important;
    gap:12px;
  }
  
  /* Form label responsive */
  .form-label{
    font-size:12px;
  }
  .form-label svg{
    width:12px !important;
    height:12px !important;
  }
  .form-section-title{
    font-size:14px;
  }
  .form-section-title svg{
    width:14px;
    height:14px;
  }
  
  /* Login mobile */
  .login-container{
    padding:16px;
  }
  .login-card{
    padding:20px;
  }
  .login-header h2{
    font-size:20px;
  }
  
  /* Dashboard filter form responsive */
  .dashboard-filter-form{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .dashboard-filter-form .form-group{
    width:100%;
  }
  .dashboard-filter-form .date-input-wrapper{
    width:100%;
  }
  .dashboard-filter-form .btn{
    width:100%;
    justify-content:center;
  }
  
  /* Chart responsive */
  .chart-wrap{
    height:200px;
    min-height:200px;
  }
  .chart-card{
    padding:12px;
  }
  .chart-card-header{
    margin-bottom:8px;
  }
  .chart-card-title-section h3{
    font-size:14px;
  }
  .chart-card-title-section .small.muted{
    font-size:11px;
  }
  .chart-card-icon{
    width:32px;
    height:32px;
  }
  .chart-card-icon svg{
    width:16px;
    height:16px;
  }
  
  /* Recent activity table responsive */
  .recent-activity-table{
    font-size:12px;
  }
  .recent-activity-table th,
  .recent-activity-table td{
    padding:8px 6px;
    font-size:12px;
  }
  
  /* Pagination responsive */
  .row[style*="justify-content:space-between"]{
    flex-direction:column;
    align-items:stretch;
    gap:12px;
  }
  .row[style*="justify-content:space-between"] .row{
    width:100%;
    justify-content:center;
  }
  .row[style*="justify-content:space-between"] .btn{
    flex:1;
    justify-content:center;
  }
}

/* Services Table Wrapper */
.services-table-wrapper{
  overflow-x:auto;
  border:1px solid var(--line);
  border-radius:12px;
  margin-bottom:16px;
  -webkit-overflow-scrolling:touch;
}
.services-table-wrapper table{
  margin:0;
  border:none;
}
.services-table-wrapper th{
  background:var(--surface2);
  font-weight:600;
  white-space:nowrap;
  font-size:12px;
  padding:12px 14px;
}
.services-table-wrapper td{
  vertical-align:middle;
  padding:12px 14px;
}
.services-table-wrapper input[type="checkbox"]{
  width:18px;
  height:18px;
  cursor:pointer;
  accent-color:var(--primary);
}
.services-table-wrapper .input{
  font-size:13px;
  padding:8px 10px;
  min-height:36px;
}

/* Form Improvements */
.form-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(250px,1fr));
  gap:16px;
  margin-bottom:16px;
}
.form-group{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.form-label{
  font-size:13px;
  font-weight:500;
  color:var(--text);
  display:flex;
  align-items:center;
  gap:6px;
  line-height:1.4;
}
.form-label svg{
  width:14px !important;
  height:14px !important;
  color:var(--muted);
  flex-shrink:0;
  stroke-width:2.5;
  transition:color 0.2s;
  vertical-align:middle;
  margin-right:6px;
  display:inline-block;
}
.form-group:focus-within .form-label svg{
  color:var(--primary);
}
/* Form section headers */
.form-section{
  margin-bottom:24px;
}
.form-section-title{
  font-size:16px;
  font-weight:600;
  color:var(--text);
  margin:0 0 16px 0;
  padding-bottom:8px;
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  gap:8px;
}
.form-section-title svg{
  width:16px;
  height:16px;
  color:var(--primary);
  flex-shrink:0;
}

/* Searchable Select */
.searchable-select-wrapper{
  position:relative;
  width:100%;
}
.searchable-select-input{
  width:100%;
  cursor:text;
  background:#fff;
}
.searchable-select-input:focus{
  border-color:rgba(25,99,174,.45);
}
.searchable-select-dropdown{
  position:absolute;
  top:100%;
  left:0;
  right:0;
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  margin-top:4px;
  max-height:300px;
  overflow-y:auto;
  overflow-x:hidden;
  z-index:100;
  display:none;
  box-shadow:0 4px 16px rgba(11,18,32,0.12);
}
.searchable-select-dropdown::-webkit-scrollbar{
  width:6px;
}
.searchable-select-dropdown::-webkit-scrollbar-track{
  background:#f6f8fc;
  border-radius:3px;
}
.searchable-select-dropdown::-webkit-scrollbar-thumb{
  background:var(--line);
  border-radius:3px;
}
.searchable-select-dropdown::-webkit-scrollbar-thumb:hover{
  background:var(--muted);
}
.searchable-select-dropdown.open{
  display:block;
}
.searchable-option{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 14px;
  cursor:pointer;
  border-bottom:1px solid #f0f1f6;
  transition:all 0.15s;
  font-size:14px;
  color:var(--text);
}
.searchable-option[style*="display: none"]{
  display:none !important;
}
.searchable-option:last-child{
  border-bottom:none;
}
.searchable-option:hover,
.searchable-option:focus{
  background:rgba(42,56,142,.06);
  color:var(--primary);
  outline:none;
}
.searchable-option svg{
  width:14px;
  height:14px;
  color:var(--muted);
  flex-shrink:0;
}
.searchable-option:hover svg{
  color:var(--primary);
}

/* Select styling */
select.input{
  cursor:pointer;
  appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 12px center;
  padding-right:36px;
}

/* Settings Page */
.current-logo-section{
  margin-bottom:24px;
}
.current-logo-header{
  margin-bottom:12px;
}
.current-logo-preview{
  display:inline-block;
  padding:16px;
  background:var(--surface2);
  border:1px solid var(--line);
  border-radius:12px;
}
.logo-preview-img{
  height:48px;
  max-width:200px;
  object-fit:contain;
  display:block;
}
.form-info-text{
  margin-top:12px;
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-size:13px;
}
.info-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.info-icon svg{
  width:14px;
  height:14px;
}
.file-input-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}
.file-input-icon svg{
  width:14px;
  height:14px;
}

/* Login Page */
.login-container{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
  padding:20px;
  background:var(--bg);
}
.login-card{
  width:100%;
  max-width:400px;
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius2);
  padding:32px;
}
.login-header{
  text-align:center;
  margin-bottom:32px;
}
.login-header h2{
  margin:0 0 8px 0;
  font-size:24px;
  font-weight:900;
  color:var(--primary);
}
.login-form{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.form-group{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.form-label{
  font-size:13px;
  font-weight:500;
  color:var(--text);
}
.alert{
  padding:12px 16px;
  border-radius:10px;
  margin-bottom:20px;
  display:flex;
  align-items:center;
  gap:10px;
  font-size:14px;
}
.alert-error{
  background:rgba(239,68,68,.08);
  border:1px solid rgba(239,68,68,.25);
  color:var(--danger);
}
.alert-error svg{
  width:14px;
  height:14px;
  flex-shrink:0;
}
.alert svg{
  flex-shrink:0;
}

/* Print Styles for Documents */
@media print {
  body {
    background:#fff;
    padding:0;
    margin:0;
  }
  .no-print {
    display:none !important;
  }
  .paper {
    max-width:210mm;
    margin:0 auto;
    padding:20mm;
    background:#fff;
    box-shadow:none;
  }
  h1, h2, h3, h4, h5, h6 {
    page-break-after:avoid;
    color:#2a388e !important;
  }
  p, li {
    orphans:3;
    widows:3;
  }
  table {
    page-break-inside:avoid;
  }
  img {
    max-width:100%;
    page-break-inside:avoid;
  }
}

.print-page {
  background:#f6f8fc;
  padding:20px;
  min-height:100vh;
}

.print-page .paper {
  background:#fff;
  max-width:210mm;
  margin:0 auto;
  padding:40px;
  box-shadow:0 2px 8px rgba(0,0,0,0.1);
  border-radius:8px;
}

/* Additional responsive improvements */
@media (max-width: 768px){
  .page-header-content{
    gap:12px;
  }
  .page-title-section{
    gap:12px;
  }
  .page-icon-large{
    width:44px;
    height:44px;
  }
  .page-icon-large svg{
    width:22px;
    height:22px;
  }
  .page-header h3{
    font-size:18px;
  }
  .btn{
    font-size:13px;
    padding:9px 11px;
  }
  .card{
    padding:16px;
  }
  .form-grid{
    gap:14px;
  }
}

/* Tablet responsive */
@media (min-width: 641px) and (max-width: 980px){
  .form-grid{
    grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
    gap:14px;
  }
  .page-header-content{
    gap:14px;
  }
  .page-header-actions{
    gap:8px;
  }
}

/* Large screens - ensure consistency */
@media (min-width: 1280px){
  .container{
    max-width:1400px;
  }
  .form-grid{
    grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
  }
  .page-header-content{
    gap:20px;
  }
  .page-header-actions{
    gap:12px;
  }
}

/* Ensure all icons have consistent stroke-width */
svg{
  stroke-width:2.5;
}
/* Override for h3 and form-label icons to be smaller */
h3 svg,
.form-label svg{
  max-width:16px !important;
  max-height:16px !important;
}
.icon-btn svg,
.btn-icon svg,
.badge-icon svg,
.search-icon svg,
.date-input-icon svg,
.info-icon svg,
.file-input-icon svg,
.page-icon-large svg,
.kpi-card-icon svg,
.chart-card-icon svg,
.notification-icon svg,
.navcol a svg,
.mobilebar a svg{
  stroke-width:2.5;
}

/* Flash Messages */
.flash-message{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  border-radius:var(--radius);
  border:1px solid;
  background:var(--surface);
  animation:slideIn 0.3s ease-out;
  position:relative;
}
@keyframes slideIn{
  from{
    opacity:0;
    transform:translateY(-10px);
  }
  to{
    opacity:1;
    transform:translateY(0);
  }
}
.flash-success{
  border-color:rgba(22,163,74,.35);
  background:linear-gradient(135deg, rgba(22,163,74,.08), rgba(22,163,74,.03));
  color:var(--ok);
}
.flash-error{
  border-color:rgba(239,68,68,.35);
  background:linear-gradient(135deg, rgba(239,68,68,.08), rgba(239,68,68,.03));
  color:var(--danger);
}
.flash-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  width:20px;
  height:20px;
  flex-shrink:0;
}
.flash-icon svg{
  width:18px;
  height:18px;
  stroke-width:2.5;
}
.flash-content{
  flex:1;
  font-size:14px;
  font-weight:500;
  line-height:1.4;
}
.flash-close{
  display:flex;
  align-items:center;
  justify-content:center;
  width:24px;
  height:24px;
  border:none;
  background:transparent;
  cursor:pointer;
  border-radius:6px;
  color:inherit;
  opacity:0.6;
  transition:all 0.2s;
  flex-shrink:0;
  padding:0;
}
.flash-close:hover{
  opacity:1;
  background:rgba(0,0,0,.05);
}
.flash-close svg{
  width:14px;
  height:14px;
  stroke-width:2.5;
}

/* Consistent spacing utilities */
.mt-0{margin-top:0}
.mt-1{margin-top:8px}
.mt-2{margin-top:16px}
.mt-3{margin-top:24px}
.mb-0{margin-bottom:0}
.mb-1{margin-bottom:8px}
.mb-2{margin-bottom:16px}
.mb-3{margin-bottom:24px}
.p-0{padding:0}
.p-1{padding:8px}
.p-2{padding:16px}
.p-3{padding:24px}

/* Consistent text utilities */
.text-center{text-align:center}
.text-left{text-align:left}
.text-right{text-align:right}
.text-bold{font-weight:700}
.text-semibold{font-weight:600}
.text-medium{font-weight:500}
.text-normal{font-weight:400}

/* Consistent flex utilities */
.flex{display:flex}
.flex-col{flex-direction:column}
.flex-row{flex-direction:row}
.items-center{align-items:center}
.items-start{align-items:flex-start}
.items-end{align-items:flex-end}
.justify-center{justify-content:center}
.justify-between{justify-content:space-between}
.justify-start{justify-content:flex-start}
.justify-end{justify-content:flex-end}
.gap-1{gap:8px}
.gap-2{gap:16px}
.gap-3{gap:24px}
.flex-1{flex:1}
.flex-wrap{flex-wrap:wrap}
.flex-nowrap{flex-wrap:nowrap}

/* Radio Card Styling - Professional card-like radio buttons */
.radio-card{
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  gap:0;
  padding:20px 16px;
  border:2px solid var(--line);
  border-radius:12px;
  background:#fff;
  cursor:pointer;
  transition:all 0.3s ease;
  flex:1;
  min-width:150px;
  text-align:center;
  user-select:none;
}
.radio-card:hover{
  border-color:rgba(42,56,142,.3);
  background:#fbfcff;
  transform:translateY(-2px);
}
.radio-card input[type="radio"]{
  position:absolute;
  opacity:0;
  width:0;
  height:0;
}
.radio-card input[type="radio"]:checked + .radio-card-icon ~ .radio-card-content,
.radio-card input[type="radio"]:checked ~ .radio-card-content{
  color:var(--text);
}
.radio-card:has(input[type="radio"]:checked){
  border-color:var(--primary);
  background:linear-gradient(135deg, rgba(42,56,142,.08), rgba(0,156,197,.08));
  box-shadow:0 2px 8px rgba(42,56,142,.1);
}
.radio-card-icon{
  width:48px;
  height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(42,56,142,.06);
  border:1px solid rgba(42,56,142,.15);
  border-radius:10px;
  flex-shrink:0;
  transition:all 0.3s ease;
  margin-bottom:8px;
}
.radio-card-icon svg{
  width:22px;
  height:22px;
  color:var(--primary);
  stroke-width:2.5;
  flex-shrink:0;
}
.radio-card:has(input[type="radio"]:checked) .radio-card-icon{
  background:linear-gradient(135deg, rgba(42,56,142,.12), rgba(0,156,197,.12));
  border-color:rgba(42,56,142,.25);
}
.radio-card:has(input[type="radio"]:checked) .radio-card-icon svg{
  color:var(--primary);
}
.radio-card-content{
  display:flex;
  flex-direction:column;
  gap:4px;
  width:100%;
}
.radio-card-title{
  font-size:15px;
  font-weight:600;
  color:var(--text);
  line-height:1.3;
  margin-bottom:4px;
}
.radio-card-subtitle{
  font-size:12px;
  color:var(--muted);
  line-height:1.4;
}
.radio-card:has(input[type="radio"]:checked)::after{
  content:'';
  position:absolute;
  width:20px;
  height:20px;
  border-radius:50%;
  background:var(--primary);
  border:3px solid #fff;
  box-shadow:0 2px 4px rgba(42,56,142,.2);
  bottom:12px;
  left:12px;
  z-index:2;
}
.radio-card::after{
  display:none;
}
.radio-card:has(input[type="radio"]:checked)::after{
  display:block;
}

/* Icon standardization */
svg{
  stroke-width:2.5;
  transition:all 0.2s ease;
}
.icon-btn svg,
.btn-icon svg,
.badge-icon svg,
.search-icon svg,
.date-input-icon svg,
.info-icon svg,
.file-input-icon svg{
  stroke-width:2.5;
  flex-shrink:0;
}
.page-icon-large svg,
.kpi-card-icon svg,
.chart-card-icon svg,
.notification-icon svg{
  stroke-width:2.5;
}

/* Consistent spacing and typography */
h1, h2, h3, h4, h5, h6{
  margin:0;
  font-weight:700;
  color:var(--text);
  line-height:1.2;
}
h3{
  font-size:20px;
  margin-bottom:8px;
}
h4{
  font-size:18px;
  margin-bottom:6px;
}

/* Consistent button styling */
.btn{
  transition:all 0.2s ease;
  font-weight:500;
}
.btn:active{
  transform:translateY(0);
}
.btn.primary:active{
  transform:translateY(0);
  opacity:1;
}

/* Consistent input focus states */
.input:focus,
select:focus,
textarea:focus{
  transition:all 0.2s ease;
}

/* Consistent card hover effects */
.card{
  transition:all 0.2s ease;
}
.card:hover{
  transition:all 0.2s ease;
}

/* Consistent badge styling */
.badge{
  transition:all 0.2s ease;
  font-weight:500;
}

/* Consistent table row hover */
tr{
  transition:background-color 0.15s ease;
}

/* Consistent form group spacing */
.form-group + .form-group{
  margin-top:0;
}

/* Consistent hr spacing */
.hr{
  margin:16px 0;
  transition:opacity 0.2s ease;
}

/* ============================================
   MOBILE RESPONSIVE - Android & iOS Optimizations
   ============================================ */

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
  .container {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }
  .mobile-topbar {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-top: max(0px, env(safe-area-inset-top));
    height: max(56px, calc(56px + env(safe-area-inset-top)));
  }
  .mobilebar {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    bottom: max(10px, env(safe-area-inset-bottom));
  }
  body {
    padding-bottom: max(90px, calc(90px + env(safe-area-inset-bottom)));
  }
  @media (max-width: 980px) {
    .container {
      padding-top: max(66px, calc(66px + env(safe-area-inset-top)));
    }
  }
}

/* Touch-friendly improvements */
* {
  -webkit-tap-highlight-color: rgba(42, 56, 142, 0.1);
  -webkit-touch-callout: none;
}

/* Better scrolling on mobile */
html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  overflow-x: hidden;
}

/* Touch targets - minimum 44x44px for accessibility */
button, .btn, a.btn, input[type="button"], input[type="submit"], 
.icon-btn, .mobilebar a, .navcol a, .badge {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
}

/* Prevent zoom on input focus (iOS) */
@media screen and (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="date"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
  }
  
  .input {
    font-size: 16px !important;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
  }
}

/* Very Small Mobile Devices (iPhone SE, small Android) */
@media (max-width: 360px) {
  .container {
    padding: 8px;
  }
  .card {
    padding: 10px;
    border-radius: 12px;
  }
  .topbar {
    padding: 6px 8px;
    flex-direction: column;
    gap: 8px;
  }
  .topbar .search,
  .topbar .actions {
    width: 100%;
    order: unset;
  }
  .topbar .actions {
    gap: 6px;
  }
  .topbar .actions .btn {
    padding: 8px 4px;
    font-size: 11px;
  }
  .mobilebar {
    left: 5px;
    right: 5px;
    bottom: 5px;
    padding: 6px 2px;
  }
  .mobilebar a {
    padding: 6px 4px;
    font-size: 9px;
  }
  .mobilebar a span {
    font-size: 9px;
  }
  .mobilebar a svg {
    width: 14px;
    height: 14px;
  }
  .page-header h3 {
    font-size: 15px !important;
  }
  .kpi .num,
  .kpi-num {
    font-size: 22px;
  }
  .btn {
    padding: 10px 12px;
    font-size: 13px;
    min-height: 42px;
  }
  table {
    font-size: 12px;
  }
  th, td {
    padding: 6px 4px;
    font-size: 12px;
  }
  .form-label {
    font-size: 11px;
  }
  h3 {
    font-size: 15px;
  }
}

/* Small Mobile (iPhone 6/7/8, small Android) */
@media (min-width: 361px) and (max-width: 480px) {
  .container {
    padding: 12px;
  }
  .card {
    padding: 14px;
  }
  .mobilebar {
    left: 8px;
    right: 8px;
    bottom: 8px;
  }
  .mobilebar a span {
    font-size: 10px;
  }
}

/* Medium Mobile / Large Mobile Portrait */
@media (min-width: 481px) and (max-width: 640px) {
  .container {
    padding: 14px;
  }
  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
  }
}

/* Mobile Landscape Orientation */
@media (max-width: 980px) and (orientation: landscape) {
  .mobilebar {
    display: none !important;
  }
  body {
    padding-bottom: 0 !important;
  }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .container {
    padding: 10px;
  }
  .card {
    padding: 12px;
  }
  /* Optimize table scrolling for landscape */
  .table-responsive {
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Tablet Portrait (iPad, Android tablets) */
@media (min-width: 641px) and (max-width: 980px) {
  .container {
    padding: 16px;
  }
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
  }
  .topbar .actions .btn span:not(.btn-icon) {
    display: inline;
  }
  .kpi-card {
    grid-column: span 3;
  }
  .chart-card {
    grid-column: span 3;
  }
}

/* Enhanced Mobile Bar for iOS and Android */
@media (max-width: 980px) {
  .mobilebar {
    display: none !important; /* Hide bottom navbar on mobile - navbar is already at top */
  }
  body {
    padding-bottom: 0 !important; /* Remove padding since navbar is hidden */
  }
}

/* Improved Button Touch Targets */
@media (max-width: 980px) {
  .btn {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 14px;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
  }
  .btn:active {
    opacity: 0.8;
    transform: scale(0.98);
  }
  .icon-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }
  .badge {
    min-height: 32px;
    padding: 6px 12px;
  }
}

/* Form Improvements for Mobile */
@media (max-width: 980px) {
  .input,
  select,
  textarea {
    min-height: 44px;
    padding: 12px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
    -webkit-appearance: none;
    border-radius: 10px;
  }
  .date-input-wrapper {
    min-height: 44px;
  }
  .date-input-wrapper .input {
    padding-right: 40px;
  }
  .search-input-wrapper .input {
    padding-left: 40px;
  }
  /* Better checkbox and radio on mobile */
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    accent-color: var(--primary);
  }
  input[type="checkbox"]:checked,
  input[type="radio"]:checked {
    accent-color: var(--primary);
  }
}

/* Improved Table Scrolling for Mobile */
@media (max-width: 980px) {
  .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(42, 56, 142, 0.2) transparent;
  }
  .table-responsive::-webkit-scrollbar {
    height: 6px;
  }
  .table-responsive::-webkit-scrollbar-track {
    background: transparent;
  }
  .table-responsive::-webkit-scrollbar-thumb {
    background: rgba(42, 56, 142, 0.2);
    border-radius: 3px;
  }
  .table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(42, 56, 142, 0.3);
  }
  table {
    min-width: 100%;
    width: max-content;
  }
  th, td {
    white-space: nowrap;
    padding: 10px 8px;
  }
  /* Allow wrapping for specific columns if needed */
  td.text-wrap,
  th.text-wrap {
    white-space: normal;
    word-break: break-word;
  }
}

/* Card Improvements for Mobile */
@media (max-width: 980px) {
  .card {
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }
  .card:active {
    transform: scale(0.99);
  }
}

/* Page Header Mobile Optimization */
@media (max-width: 980px) {
  .page-header {
    padding: 14px;
    margin-bottom: 12px;
  }
  .page-header-content {
    gap: 12px;
  }
  .page-header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-header-actions .btn {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }
  .search-form-inline {
    width: 100%;
  }
  .search-form-inline .input,
  .search-form-inline select {
    width: 100%;
    min-width: 0;
  }
}

/* Flash Messages Mobile */
@media (max-width: 980px) {
  .flash-message {
    border-radius: 12px;
    margin: 10px 0;
    padding: 14px 16px;
  }
  .flash-close {
    min-width: 32px;
    min-height: 32px;
  }
}

/* Empty State Mobile */
@media (max-width: 980px) {
  .empty-state {
    padding: 32px 16px;
  }
  .empty-icon {
    width: 56px;
    height: 56px;
  }
  .empty-state h4 {
    font-size: 16px;
    margin: 12px 0 8px;
  }
}

/* Modal/Dialog Support for Mobile (if any) */
@media (max-width: 980px) {
  .modal,
  .dialog {
    width: calc(100% - 32px);
    max-width: calc(100% - 32px);
    margin: 16px;
    border-radius: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Prevent horizontal scroll on mobile */
@media (max-width: 980px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
  }
  .container {
    max-width: 100%;
    overflow-x: hidden;
  }
  .shell {
    overflow-x: hidden;
  }
}

/* Loading States for Mobile */
@media (max-width: 980px) {
  .loading,
  .spinner {
    min-width: 40px;
    min-height: 40px;
  }
}

/* Document Buttons Grid - For hygienic program buttons */
.document-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 980px) {
  .document-buttons-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .document-buttons-grid .btn {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 14px;
    min-height: 48px;
  }
  .document-buttons-grid .btn span:not(.btn-icon) {
    flex: 1;
    text-align: left;
  }
}

/* Fix table action buttons in mobile - ensure they stay in a row */
@media (max-width: 980px) {
  .table-responsive td:last-child .row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    justify-content: flex-start !important;
    align-items: center !important;
  }
  .table-responsive td:last-child .icon-btn {
    flex-shrink: 0;
    min-width: 36px;
    min-height: 36px;
    padding: 8px;
  }
  .table-responsive td:last-child form {
    display: inline-flex !important;
    flex-shrink: 0;
  }
}

/* Ensure search-form-inline buttons stack properly on mobile */
@media (max-width: 980px) {
  .page-header-actions .search-form-inline {
    width: 100%;
    margin-bottom: 10px;
  }
  .page-header-actions .search-form-inline + .btn {
    width: 100%;
    margin-top: 0;
  }
  .page-header-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
}

/* Print Styles - Hide mobile bar when printing */
@media print {
  .mobilebar,
  .topbar,
  .sidebar {
    display: none !important;
  }
  body {
    padding-bottom: 0 !important;
  }
}
