:root {
    --primary: #0D3B66;
    --primary-light: #1F4E79;
    --accent: #F4A261;
    --orange: #E85D04;
    --orange-light: #F48C06;
    --bg: #f0f4f8;
    --card: #ffffff;
    --success: #2a9d8f;
    --danger: #e76f51;
    --text: #264653;
    --muted: #6c757d;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
  }

  /* LOGIN */
  #loginScreen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, #08284d 0%, #0D3B66 35%, #1a5276 70%, #0D3B66 100%);
    padding: 20px;
    padding-bottom: 100px;
  }
  #loginScreen::before,
  #loginScreen::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.35;
    pointer-events: none;
  }
  #loginScreen::before {
    width: 420px; height: 420px;
    background: radial-gradient(circle, var(--orange-light), transparent 70%);
    top: -160px; left: -140px;
    animation: floatBlob 9s ease-in-out infinite;
  }
  #loginScreen::after {
    width: 380px; height: 380px;
    background: radial-gradient(circle, #4fb3d9, transparent 70%);
    bottom: -160px; right: -120px;
    animation: floatBlob 11s ease-in-out infinite reverse;
  }
  @keyframes floatBlob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -20px) scale(1.08); }
  }
  .login-brand { text-align: center; margin-bottom: 28px; position: relative; z-index: 1; animation: loginRise 0.7s ease both; }
  .login-logo {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, var(--orange), var(--orange-light));
    border-radius: 22px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 26px; color: white;
    margin: 0 auto 14px;
    box-shadow: 0 10px 28px rgba(232,93,4,0.45), 0 0 0 6px rgba(255,255,255,0.08);
    letter-spacing: 1px;
  }
  .login-company {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--orange);
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  }
  .login-sub { color: rgba(255,255,255,0.75); font-size: 0.95rem; margin-top: 6px; }
  .login-box {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(16px);
    border-radius: 22px;
    padding: 34px 30px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.15);
    position: relative;
    z-index: 1;
    animation: loginRise 0.7s ease 0.1s both;
  }
  @keyframes loginRise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .login-box-title {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
  }
  .login-box-subtitle {
    text-align: center;
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 24px;
  }
  .login-group { margin-bottom: 16px; }
  .login-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--muted);
  }
  .login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
  }
  .login-input-wrap .login-input-icon {
    position: absolute;
    left: 13px;
    display: flex;
    color: #a8b3bd;
    pointer-events: none;
  }
  .login-group input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    background: #f8fafc;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  }
  .login-group input:focus {
    border-color: var(--orange);
    background: white;
    box-shadow: 0 0 0 4px rgba(232,93,4,0.12);
  }
  .login-toggle-pass {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #a8b3bd;
    display: flex;
    padding: 4px;
  }
  .login-toggle-pass:hover { color: var(--muted); }
  .login-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -2px 0 20px;
  }
  .login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
    color: var(--text);
  }
  .login-remember input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #cfd8e2;
    border-radius: 5px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
  }
  .login-remember input[type="checkbox"]:checked {
    background: var(--orange);
    border-color: var(--orange);
  }
  .login-remember input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px; top: 1px;
    width: 5px; height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
  }
  .login-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--orange), var(--orange-light));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .login-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(232,93,4,0.45); }
  .login-btn:active { transform: translateY(0); }
  .login-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.88rem;
    margin-bottom: 14px;
    display: none;
    text-align: center;
    animation: loginShake 0.4s ease;
  }
  @keyframes loginShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
  }
  .login-hint {
    text-align: center;
    margin-top: 20px;
    font-size: 0.78rem;
    color: var(--muted);
  }

  /* APP */
  #app { display: none; }
  .header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .brand { display: flex; align-items: center; gap: 12px; }
  .brand-logo {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--orange), var(--orange-light));
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px; color: white;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .brand-logo:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(232,93,4,0.4);
  }
  .brand-text { display: flex; flex-direction: column; }
  .brand-name input {
    background: transparent;
    border: none;
    border-bottom: 2px dashed rgba(244,162,97,0.5);
    color: var(--orange);
    font-size: 1.3rem;
    font-weight: 800;
    width: 180px;
    outline: none;
  }
  .brand-tag { font-size: 0.7rem; opacity: 0.8; }
  .header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .user-info { font-size: 0.8rem; opacity: 0.9; }
  .role-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
  }
  .btn {
    padding: 7px 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
  }
  .btn-accent { background: var(--orange); color: white; }
  .btn-accent:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,93,4,0.4); }
  .btn-outline { background: transparent; border: 1px solid rgba(255,255,255,0.5); color: white; }
  .btn-outline:hover { background: rgba(255,255,255,0.12); }
  .btn-primary { background: var(--primary); color: white; }
  .btn-success { background: var(--success); color: white; }
  .btn-danger { background: var(--danger); color: white; }
  .btn-sm { padding: 4px 8px; font-size: 0.75rem; }
  .btn:disabled { opacity: 0.45; cursor: not-allowed; }

  .container { max-width: 1200px; width: 100%; margin: 0 auto; padding: 20px; transition: transform 0.25s ease; }
  .content-area { width: 100%; display: flex; justify-content: center; box-sizing: border-box; transition: padding-right 0.25s ease, padding-left 0.22s ease; }
  /* Keep the main page content perfectly centered on screen no matter which
     side panel (Admin Settings / Daily Collection) is open or collapsed. */
  body.is-admin .content-area { padding-left: var(--as-w-expanded); padding-right: var(--rs-w-expanded); }
  body.is-admin .container { transform: translateX(calc((var(--rs-w-expanded) - var(--as-w-expanded)) / 2)); }
  body.is-admin.as-collapsed .content-area { padding-left: var(--as-w-collapsed); }
  body.is-admin.as-collapsed .container { transform: translateX(calc((var(--rs-w-expanded) - var(--as-w-collapsed)) / 2)); }
  body.is-admin.rs-collapsed .content-area { padding-right: var(--rs-w-collapsed); }
  body.is-admin.rs-collapsed .container { transform: translateX(calc((var(--rs-w-collapsed) - var(--as-w-expanded)) / 2)); }
  body.is-admin.as-collapsed.rs-collapsed .content-area { padding-left: var(--as-w-collapsed); padding-right: var(--rs-w-collapsed); }
  body.is-admin.as-collapsed.rs-collapsed .container { transform: translateX(calc((var(--rs-w-collapsed) - var(--as-w-collapsed)) / 2)); }
  .search-card {
    background: var(--card);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  }
  .search-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .search-input {
    flex: 1;
    min-width: 220px;
    padding: 11px 14px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
  }
  .search-input:focus { border-color: var(--orange); }
  .search-hint { font-size: 0.76rem; color: var(--muted); margin-top: 8px; }

  .stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
  }
  .stat-card {
    background: var(--card);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
  }
  .stat-value { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
  .stat-label { font-size: 0.76rem; color: var(--muted); margin-top: 3px; }

  .section-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .table-wrap {
    background: var(--card);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  }
  table { width: 100%; border-collapse: collapse; }
  th {
    background: var(--primary);
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
  }
  td {
    padding: 9px 12px;
    border-bottom: 1px solid #edf2f7;
    font-size: 0.84rem;
  }
  .customer-pagination {
    display: flex !important;
    width: 100%;
    box-sizing: border-box;
    margin: -8px 0 18px;
    padding: 10px 14px;
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }
  .customer-page-info { font-size: 0.78rem; color: var(--muted); }
  .customer-page-controls { display:flex; align-items:center; gap:5px; flex-wrap:wrap; }
  .customer-page-btn {
    min-width: 34px; height: 34px; padding: 0 9px;
    border: 1px solid #d8e0e8; background: #fff; color: var(--primary);
    border-radius: 8px; cursor: pointer; font-weight: 700;
  }
  .customer-page-btn:hover:not(:disabled) { border-color: var(--orange); color: var(--orange); }
  .customer-page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
  .customer-page-btn:disabled { opacity: .45; cursor: not-allowed; }
  .customer-page-gap { color: var(--muted); padding: 0 2px; }
  tr:hover td { background: #f8fafc; }
  .badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
  }
  .badge-active { background: #d1fae5; color: #065f46; }
  .badge-inactive { background: #fee2e2; color: #991b1b; }
  .badge-edit { background: #dbeafe; color: #1e40af; }
  .badge-view { background: #fef3c7; color: #92400e; }
  .badge-admin { background: #fce7f3; color: #9d174d; }
  .actions { display: flex; gap: 4px; }

  /* Modal */
  .modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
  }
  .modal-overlay.show { display: flex; }
  .modal {
    background: white;
    border-radius: 16px;
    width: 95%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 22px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
  }
  .modal h2 { margin-bottom: 16px; color: var(--primary); font-size: 1.15rem; }
  .form-group { margin-bottom: 12px; }
  .form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--muted);
  }
  .form-group input, .form-group select {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid #e0e6ed;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
  }
  .form-group input:focus, .form-group select:focus { border-color: var(--orange); }
  /* Hide number input spinner arrows */
  input[type=number]::-webkit-outer-spin-button,
  input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
  }

  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 16px;
  }

  .empty { text-align: center; padding: 36px 20px; color: var(--muted); }
  .toast {
    position: fixed;
    bottom: 22px;
    right: 22px;
    background: var(--primary);
    color: white;
    padding: 11px 18px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 300;
  }
  .toast.show { opacity: 1; transform: translateY(0); }

  .users-list { margin-top: 10px; }
  .user-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    background: #fafbfc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 0.88rem;
    transition: box-shadow 0.15s, border-color 0.15s;
  }
  .user-row:hover { border-color: #d7dde5; box-shadow: 0 3px 10px rgba(13,59,102,0.06); }
  .user-row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
  .user-identity { display: flex; align-items: center; gap: 8px; }
  .main-admin-tag { font-size: 0.75rem; color: #999; font-weight: 600; }
  .user-actions {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
    margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e6ecf3; flex-wrap: wrap;
  }
  .user-action-group { display: flex; flex-direction: column; gap: 3px; }
  .user-action-group label {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted);
  }
  .user-action-group select {
    padding: 6px 8px; border: 1px solid #dde3ea; border-radius: 8px;
    font-size: 0.8rem; font-family: inherit; background: #fff; color: var(--text);
  }
  .um-section {
    background: #f7f9fc; border: 1px solid #edf2f7; border-radius: 12px;
    padding: 14px 14px 4px;
  }
  .um-section-title {
    font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--primary); margin: 4px 0 10px;
  }
  .um-hint { margin-bottom: 14px; font-size: 0.82rem; color: var(--muted); }
  .um-list-title {
    font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--muted); margin: 18px 0 8px;
  }

  @media (max-width: 700px) {
    .form-row { grid-template-columns: 1fr; }
    .header { flex-direction: column; gap: 8px; }
    .login-company { font-size: 1.7rem; }
  }

  /* ===== DASHBOARD ===== */
  .db-hero {
    position: relative; overflow: hidden;
    display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 24px 28px; margin-bottom: 18px;
    border-radius: 20px; color: #fff;
    background: linear-gradient(120deg, #0D3B66 0%, #1F6FA8 100%);
    box-shadow: 0 10px 30px rgba(13,59,102,0.22);
  }
  .db-hero::before, .db-hero::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
  .db-hero::before { width: 300px; height: 300px; right: -70px; top: -150px; background: radial-gradient(circle, rgba(244,162,97,0.65) 0%, rgba(244,162,97,0) 68%); }
  .db-hero::after { width: 150px; height: 150px; right: 150px; bottom: -90px; background: rgba(255,255,255,0.10); }
  .db-hero > * { position: relative; z-index: 1; }
  .db-hello { font-size: 1.6rem; font-weight: 800; letter-spacing: 0.2px; }
  .db-sub { font-size: 0.9rem; opacity: 0.85; margin-top: 4px; }
  .db-date {
    font-size: 0.82rem; font-weight: 600;
    background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.25);
    padding: 7px 14px; border-radius: 999px; backdrop-filter: blur(4px);
  }

  .db-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 18px; }
  .db-stat {
    display: flex; align-items: center; gap: 16px;
    background: var(--card); border-radius: 18px; padding: 20px;
    box-shadow: 0 2px 12px rgba(13,59,102,0.07); border: 1px solid #edf2f7;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .db-stat:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(13,59,102,0.13); }
  .db-stat-clickable { cursor: pointer; user-select: none; }
  .db-stat-clickable:active { transform: translateY(-1px); }
  .db-ic { width: 54px; height: 54px; border-radius: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
  .db-ic svg { width: 26px; height: 26px; }
  .ic-blue { background: linear-gradient(135deg, #1F6FA8, #0D3B66); box-shadow: 0 6px 14px rgba(31,111,168,0.35); }
  .ic-green { background: linear-gradient(135deg, #34d399, #2a9d8f); box-shadow: 0 6px 14px rgba(42,157,143,0.35); }
  .ic-orange { background: linear-gradient(135deg, #F48C06, #E85D04); box-shadow: 0 6px 14px rgba(232,93,4,0.35); }
  .db-num { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1.05; }
  .db-lbl { font-size: 0.82rem; color: var(--muted); margin-top: 4px; font-weight: 600; }

  .db-panels { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 18px; align-items: start; }
  .db-panel { background: var(--card); border-radius: 18px; padding: 20px 22px; box-shadow: 0 2px 12px rgba(13,59,102,0.07); border: 1px solid #edf2f7; }
  .db-panel-title { font-size: 0.95rem; font-weight: 700; color: var(--primary); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
  .db-panel-title::before { content: ''; width: 4px; height: 16px; border-radius: 4px; background: linear-gradient(var(--orange), var(--orange-light)); }

  /* Daily Collection panel */
  .dc-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 8px; }
  .dc-panel-head .db-panel-title { margin-bottom: 0; }
  .dc-add-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 11px; border: none; border-radius: 999px;
    background: rgba(232,93,4,0.1); color: var(--orange);
    font-size: 0.75rem; font-weight: 700; cursor: pointer;
    white-space: nowrap; transition: background 0.15s;
  }
  .dc-add-btn:hover { background: rgba(232,93,4,0.18); }
  .dc-add-btn svg { width: 13px; height: 13px; }
  .dc-totals { display: flex; gap: 8px; margin-bottom: 12px; }
  .dc-total-chip { flex: 1; border-radius: 12px; padding: 8px 10px; background: #f7f9fc; border: 1px solid #edf2f7; text-align: center; }
  .dc-total-chip strong { display: block; font-size: 0.95rem; }
  .dc-total-chip span { font-size: 0.66rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
  .dc-total-chip.dc-paid strong { color: var(--success); }
  .dc-total-chip.dc-unpaid strong { color: var(--danger); }
  .dc-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
  .dc-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border-radius: 12px;
    background: #f7f9fc; border: 1px solid #edf2f7;
  }
  .dc-row-info { min-width: 0; }
  .dc-row-name { font-size: 0.84rem; font-weight: 700; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dc-row-meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
  .dc-row-amt { font-size: 0.86rem; font-weight: 700; color: var(--text); white-space: nowrap; margin-left: auto; }
  .dc-badge {
    flex-shrink: 0; font-size: 0.7rem; font-weight: 700; padding: 4px 11px; border-radius: 999px;
    letter-spacing: 0.3px;
  }
  .dc-badge-paid { background: rgba(42,157,143,0.14); color: var(--success); }
  .dc-badge-unpaid { background: rgba(231,111,81,0.14); color: var(--danger); }
  .dc-badge.dc-clickable { cursor: pointer; border: none; font-family: inherit; }
  .dc-badge.dc-clickable:hover { filter: brightness(0.94); }
  .dc-empty { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 22px 6px; }
  .dc-group + .dc-group { border-top: 1px dashed #e6ecf3; margin-top: 10px; padding-top: 10px; }
  .dc-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
  .dc-group-user { font-size: 0.82rem; font-weight: 800; color: var(--primary); }
  .dc-group-user::before { content: '👤 '; }
  .dc-group-sub { font-size: 0.72rem; color: var(--muted); white-space: nowrap; }
  .dc-group-sub em { font-style: normal; color: var(--danger); font-weight: 700; }
  .dc-group-items { display: flex; flex-direction: column; gap: 8px; }
  .dc-cust-results {
    display: none;
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    max-height: 220px; overflow-y: auto;
    background: #fff; border: 1px solid #e0e6ed; border-radius: 12px;
    box-shadow: 0 10px 28px rgba(13,59,102,0.18);
    z-index: 20;
  }
  .dc-cust-results.show { display: block; }
  .dc-cust-result-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid #f0f3f7; }
  .dc-cust-result-item:last-child { border-bottom: none; }
  .dc-cust-result-item:hover { background: #f7f9fc; }
  .dc-cri-name { font-size: 0.85rem; font-weight: 700; color: var(--primary); }
  .dc-cri-meta { font-size: 0.74rem; color: var(--muted); margin-top: 1px; }
  .dc-cust-result-empty { padding: 12px; text-align: center; font-size: 0.8rem; color: var(--muted); }
  .dc-selected-customer {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: #f7f9fc; border: 1.5px solid #e6ecf3; border-radius: 12px;
    padding: 10px 12px; margin: -8px 0 14px;
  }
  .dc-sc-info { min-width: 0; }
  .dc-sc-name { font-size: 0.88rem; font-weight: 700; color: var(--primary); }
  .dc-sc-addr { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
  .db-bar-row { margin-bottom: 14px; }
  .db-bar-row:last-child { margin-bottom: 0; }
  .db-bar-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.86rem; font-weight: 600; margin-bottom: 6px; }
  .db-bar-head strong { color: var(--primary); }
  .db-bar-head em { font-style: normal; font-weight: 500; color: var(--muted); font-size: 0.76rem; margin-left: 6px; }
  .db-bar { height: 10px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
  .db-bar span { display: block; height: 100%; border-radius: 999px; transition: width 0.6s ease; }
  .bar-0 { background: linear-gradient(90deg, #E85D04, #F48C06); }
  .bar-1 { background: linear-gradient(90deg, #0D3B66, #1F6FA8); }
  .bar-2 { background: linear-gradient(90deg, #2a9d8f, #34d399); }
  .bar-x { background: linear-gradient(90deg, #94a3b8, #cbd5e1); }

  .search-card { border-radius: 18px; padding: 22px; border: 1px solid #edf2f7; box-shadow: 0 2px 12px rgba(13,59,102,0.07); }
  .search-card .search-input {
    padding: 13px 14px 13px 44px; border-radius: 12px; background-color: #f8fafc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 14px center; background-size: 19px;
  }
  .search-card .search-input:focus { background-color: #fff; }
  @media (max-width: 800px) { .db-panels { grid-template-columns: 1fr; } .db-hello { font-size: 1.3rem; } }

  /* ===== ADMIN PROFILE (top-right) ===== */
  body.non-admin .admin-only { display: none !important; }
  .header-actions { flex: 1; justify-content: flex-end; margin: 0 16px; }
  .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
  }
  .layout-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: inherit;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
  }
  .layout-switch-btn:hover { background: rgba(255,255,255,0.24); }
  .layout-switch-btn:active { transform: scale(0.97); }
  .layout-switch-icon { font-size: 0.95rem; line-height: 1; }
  .layout-switch-label { letter-spacing: 0.2px; }
  body.force-desktop .layout-switch-btn { background: rgba(52,211,153,0.22); border-color: rgba(52,211,153,0.45); }
  body.force-mobile .layout-switch-btn { background: rgba(244,162,97,0.25); border-color: rgba(244,162,97,0.5); }

  .profile-wrap { position: relative; flex-shrink: 0; }
  .profile-btn {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.85rem; font-weight: 600;
    transition: background 0.2s;
  }
  .profile-btn:hover, .profile-btn[aria-expanded="true"] { background: rgba(255,255,255,0.24); }
  .profile-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: linear-gradient(135deg, var(--orange), var(--orange-light));
    color: #fff; font-weight: 800; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .profile-name { display: none; }
  .profile-caret { font-size: 0.7rem; opacity: 0.8; }
  .profile-btn .profile-avatar { position: relative; }
  .profile-btn .profile-avatar::after {
    content: ''; position: absolute; right: -1px; bottom: -1px;
    width: 9px; height: 9px; border-radius: 50%;
    background: #34d399; border: 2px solid #1F4E79;
  }
  .profile-menu {
    display: none;
    position: absolute; top: calc(100% + 12px); right: 0;
    width: 290px;
    background: #fff; color: var(--text);
    border-radius: 20px;
    box-shadow: 0 18px 50px rgba(13,59,102,0.35), 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    z-index: 150;
    transform-origin: top right;
  }
  .profile-menu.show { display: block; animation: pmIn 0.18s ease-out; }
  @keyframes pmIn { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: none; } }

  .pm-banner {
    height: 78px;
    background: linear-gradient(135deg, var(--primary) 0%, #2a6fa8 100%);
    position: relative; overflow: hidden;
  }
  .pm-banner::before, .pm-banner::after { content: ''; position: absolute; border-radius: 50%; }
  .pm-banner::before { width: 130px; height: 130px; right: -30px; top: -60px; background: rgba(244,162,97,0.35); }
  .pm-banner::after { width: 80px; height: 80px; left: -20px; bottom: -44px; background: rgba(255,255,255,0.12); }
  .pm-body { padding: 0 18px 8px; text-align: center; }
  .pm-avatar-wrap { position: relative; width: 68px; margin: -36px auto 8px; }
  .pm-avatar {
    width: 68px; height: 68px; font-size: 1.8rem;
    border: 4px solid #fff;
    box-shadow: 0 4px 14px rgba(232,93,4,0.35);
  }
  .pm-online {
    position: absolute; right: 2px; bottom: 4px;
    width: 14px; height: 14px; border-radius: 50%;
    background: #34d399; border: 3px solid #fff;
  }
  .profile-avatar.has-photo { background-size: cover; background-position: center; background-repeat: no-repeat; color: transparent; font-size: 0; }
  .pm-cam {
    position: absolute; inset: 0; z-index: 1;
    border: none; border-radius: 50%;
    background: rgba(13,59,102,0.55); color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; transition: opacity 0.15s;
  }
  .pm-avatar-wrap:hover .pm-cam, .pm-cam:focus-visible { opacity: 1; }
  .pm-cam svg { width: 24px; height: 24px; }
  .pm-online { z-index: 2; }
  .pm-photo-x {
    display: none;
    position: absolute; top: -2px; right: -4px; z-index: 3;
    width: 22px; height: 22px; padding: 0;
    align-items: center; justify-content: center;
    border: 2px solid #fff; border-radius: 50%;
    background: var(--danger); color: #fff;
    cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  }
  .pm-photo-x svg { width: 10px; height: 10px; }
  .pm-photo-x:hover { background: #d1441f; }
  .pm-avatar-wrap.has-photo .pm-photo-x { display: flex; }
  .pm-name { display: flex; align-items: center; justify-content: center; gap: 4px; }
  .pm-name input {
    flex: 0 1 190px; min-width: 0;
    text-align: center;
    background: transparent;
    border: none; border-bottom: 2px solid transparent;
    border-radius: 6px 6px 0 0;
    padding: 3px 6px;
    font-size: 1.1rem; font-weight: 700; color: var(--primary);
    outline: none;
    transition: background 0.15s, border-color 0.15s;
    text-overflow: ellipsis;
  }
  .pm-name input:hover { background: #f3f6fa; }
  .pm-name input:focus { background: #fff7f0; border-bottom-color: var(--orange); }
  .pm-edit {
    width: 26px; height: 26px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 50%;
    background: #eef2f7; color: var(--muted);
    cursor: pointer; transition: all 0.15s;
  }
  .pm-edit:hover { background: #e2e8f0; color: var(--primary); }
  .pm-edit svg { width: 14px; height: 14px; }
  .pm-edit .ic-check { display: none; }
  .pm-name.editing .pm-edit { background: var(--orange); color: #fff; }
  .pm-name.editing .ic-pen { display: none; }
  .pm-name.editing .ic-check { display: block; }
  .pm-role { margin-top: 6px; }
  .pm-role .role-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 12px; border-radius: 999px;
    background: rgba(232,93,4,0.1); color: var(--orange);
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  }
  .pm-role .role-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .pm-list { padding: 8px 10px 10px; border-top: 1px solid #eef2f7; margin-top: 10px; }
  .pm-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 9px 10px;
    background: none; border: none; border-radius: 12px;
    text-align: left; cursor: pointer;
    font-size: 0.88rem; font-weight: 600; color: var(--text);
    transition: background 0.15s;
  }
  .pm-item:hover { background: #f3f6fa; }
  .pm-ic {
    width: 34px; height: 34px; border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
  }
  .pm-ic svg { width: 17px; height: 17px; }
  .pm-item .pm-arrow { margin-left: auto; opacity: 0.35; font-size: 1.1rem; }
  .pm-danger .pm-ic { background: #fff1ee; color: var(--danger); }
  .pm-danger:hover { background: #fff1ee; }
  .pm-data .pm-ic { background: #eef2f7; color: var(--primary); }
  .pm-data:hover { background: #eef2f7; }
  .pm-users .pm-ic { background: #eef2f7; color: var(--primary); }
  .pm-users:hover { background: #eef2f7; }
  .pm-password .pm-ic { background: #eef2f7; color: var(--primary); }
  .pm-password:hover { background: #eef2f7; }
  .pm-logout .pm-ic { background: #eef2f7; color: var(--primary); }
  .pm-logout:hover { background: #eef2f7; }
  .pm-sep { height: 1px; background: #eef2f7; margin: 6px 6px; }

  /* Data Management modal */
  .dm-section { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }
  .dm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .dm-tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    padding: 12px; text-align: left;
    background: #f7f9fc; border: 1.5px solid #e6ecf3; border-radius: 12px;
    cursor: pointer; color: var(--text); font-family: inherit;
    transition: all 0.15s;
  }
  .dm-tile:hover { border-color: var(--orange); background: #fff7f0; transform: translateY(-1px); }
  .dm-tile strong { display: block; font-size: 0.86rem; color: var(--primary); }
  .dm-tile small, .dm-switch-row small { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 2px; font-weight: 400; }
  .dm-ic { font-size: 1.3rem; line-height: 1; }
  .dm-warn:hover { border-color: var(--danger); background: #fff1ee; }
  .dm-switch-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    margin-top: 10px; padding: 10px 12px;
    background: #f7f9fc; border: 1.5px solid #e6ecf3; border-radius: 12px; cursor: pointer;
  }
  .dm-switch-row strong { font-size: 0.86rem; color: var(--primary); }
  .dm-switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
  .dm-switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
  .dm-slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background 0.2s; }
  .dm-slider::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.2s; }
  .dm-switch input:checked + .dm-slider { background: var(--orange); }
  .dm-switch input:checked + .dm-slider::after { transform: translateX(18px); }
  @media (max-width: 520px) { .dm-grid { grid-template-columns: 1fr; } .dm-tile { flex-direction: row; align-items: center; } }

  /* Bulk remove modal */
  .bulk-note { font-size: 0.82rem; color: #92400e; background: #fef3c7; border-radius: 8px; padding: 9px 12px; margin-bottom: 12px; }
  .bulk-toolbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
  .bulk-toolbar .search-input { min-width: 180px; padding: 9px 12px; font-size: 0.88rem; }
  .bulk-toolbar select { padding: 9px 10px; border: 2px solid #e0e6ed; border-radius: 10px; font-size: 0.85rem; }
  .bulk-bar { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; margin-bottom: 8px; color: var(--muted); }
  .bulk-bar label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; color: var(--text); }
  .bulk-bar input, #bulkBody input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--danger); }
  .bulk-list { max-height: 320px; overflow: auto; border: 1px solid #e5e7eb; border-radius: 10px; }
  .bulk-list th { position: sticky; top: 0; z-index: 1; }
  #bulkBody tr { cursor: pointer; }
  #bulkBody tr.sel td { background: #fdeeea; }

  @media (max-width: 700px) {
    .header { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .header-actions { order: 3; width: 100%; margin: 0; justify-content: flex-start; flex: none; }
    .profile-btn { padding-right: 8px; }
    .profile-menu { width: min(300px, calc(100vw - 24px)); }
  }

  /* ===== ADMIN SETTINGS (left sidebar) ===== */
  :root { --as-w-expanded: 226px; --as-w-collapsed: 68px; --header-h: 66px; --rs-w-expanded: 340px; --rs-w-collapsed: 60px; }
  .admin-sidebar {
    display: none;
    position: fixed;
    top: var(--header-h); left: 0;
    height: calc(100vh - var(--header-h));
    width: var(--as-w-expanded);
    background: linear-gradient(180deg, var(--primary) 0%, #123f66 100%);
    color: #fff;
    z-index: 90;
    flex-direction: column;
    padding: 16px 10px;
    box-shadow: 2px 0 18px rgba(13,59,102,0.2);
    transition: width 0.22s ease;
    overflow-y: auto;
    overflow-x: hidden;
  }
  body.is-admin .admin-sidebar { display: flex; }
  body.is-admin.as-collapsed .admin-sidebar { width: var(--as-w-collapsed); }

  .as-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-shrink: 0; }
  body.as-collapsed .as-toggle-row { justify-content: center; }
  .as-toggle-label {
    font-size: 0.86rem; font-weight: 800; color: #fff; letter-spacing: 0.2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  body.as-collapsed .as-toggle-label { display: none; }
  .as-toggle {
    width: 36px; height: 36px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 10px;
    color: #fff; cursor: pointer;
    transition: background 0.15s;
  }
  .as-toggle:hover { background: rgba(255,255,255,0.24); }
  .as-toggle svg { width: 17px; height: 17px; }

  .as-title {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    padding: 2px 10px 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  body.as-collapsed .as-title { opacity: 0; height: 0; padding: 0; overflow: hidden; }

  .as-list { display: flex; flex-direction: column; gap: 4px; }
  .as-caret { margin-left: auto; font-size: 0.7rem; opacity: 0.8; flex-shrink: 0; }
  body.as-collapsed .as-caret { display: none; }
  .as-item {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 10px; font-family: inherit;
    background: none; border: none; border-radius: 12px;
    color: #fff; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; text-align: left;
    transition: background 0.15s;
    white-space: nowrap;
  }
  .as-item:hover { background: rgba(255,255,255,0.14); }
  .as-item.as-danger:hover { background: rgba(231,111,81,0.35); }
  body.as-collapsed .as-item { justify-content: center; padding: 10px 0; }
  .as-ic {
    width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px;
    background: rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center;
  }
  .as-item.as-danger .as-ic { color: #ffb4a2; }
  .as-ic svg { width: 16px; height: 16px; }
  .as-label { overflow: hidden; text-overflow: ellipsis; }
  body.as-collapsed .as-label { display: none; }

  /* Manage Users — inline dropdown inside the sidebar */
  .as-dropdown { display: none; background: #fff; border-radius: 12px; padding: 12px; margin: 2px 2px 10px; box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
  .as-dropdown.open { display: block; }
  body.as-collapsed .as-dropdown { display: none !important; }
  .as-dd-title { font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); margin-bottom: 8px; }
  .as-dd-input {
    width: 100%; box-sizing: border-box; padding: 7px 9px; margin-bottom: 7px;
    border: 1px solid #dde3ea; border-radius: 8px; font-size: 0.8rem; font-family: inherit; color: var(--text);
  }
  .as-dd-add-btn {
    width: 100%; padding: 8px; border: none; border-radius: 8px; background: var(--orange); color: #fff;
    font-weight: 700; font-size: 0.8rem; cursor: pointer;
  }
  .as-dd-add-btn:hover { background: var(--orange-light); }
  .as-dd-full-btn {
    width: 100%; margin-top: 10px; padding: 7px; border: 1px solid #dde3ea; border-radius: 8px;
    background: #f7f9fc; color: var(--primary); font-weight: 700; font-size: 0.74rem; cursor: pointer;
  }
  .as-dd-full-btn:hover { background: #eef2f7; }
  .mu-user { border: 1px solid #edf2f7; border-radius: 9px; padding: 8px 9px; margin-bottom: 7px; background: #fafbfc; }
  .mu-user-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 6px; }
  .mu-user-name { font-size: 0.8rem; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mu-perm {
    width: 100%; box-sizing: border-box; padding: 5px 7px; margin-bottom: 6px;
    border: 1px solid #dde3ea; border-radius: 7px; font-size: 0.75rem; font-family: inherit; color: var(--text);
  }
  .mu-del { width: 100%; padding: 6px; border: none; border-radius: 7px; background: var(--danger); color: #fff; font-size: 0.75rem; font-weight: 700; cursor: pointer; }
  .mu-del:hover { opacity: 0.9; }
  .mu-main-tag { font-size: 0.72rem; color: #999; font-weight: 600; }

  /* ===== DAILY COLLECTION REPORTS (right sidebar) ===== */
  .reports-sidebar {
    display: none;
    position: fixed;
    top: var(--header-h); right: 0;
    height: calc(100vh - var(--header-h));
    width: var(--rs-w-expanded);
    z-index: 95;
    overflow: hidden;
    transition: width 0.22s ease;
  }
  body.is-admin .reports-sidebar { display: flex; }
  body.rs-collapsed .reports-sidebar { width: var(--rs-w-collapsed); }
  .rs-panel {
    width: 100%; background: var(--card);
    box-shadow: -4px 0 22px rgba(13,59,102,0.16);
    display: flex; flex-direction: column; overflow: hidden;
  }
  .rs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 16px 10px; flex-shrink: 0; }
  body.rs-collapsed .rs-head { justify-content: center; padding: 16px 8px 10px; }
  .rs-title { font-size: 0.92rem; font-weight: 800; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.rs-collapsed .rs-title { display: none; }
  .rs-toggle {
    width: 32px; height: 32px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #eef2f7; border: 1px solid #dde3ea; border-radius: 9px;
    color: var(--primary); cursor: pointer; transition: background 0.15s;
  }
  .rs-toggle:hover { background: #e4ecf5; }
  .rs-toggle svg { width: 16px; height: 16px; }
  body.rs-collapsed .rs-date-row,
  body.rs-collapsed .rs-day-total,
  body.rs-collapsed .rs-body { display: none; }
  .rs-close { background: none; border: none; cursor: pointer; font-size: 0.95rem; color: var(--muted); padding: 4px; line-height: 1; }
  .rs-close:hover { color: var(--danger); }
  .rs-date-row { display: flex; align-items: center; gap: 6px; padding: 0 16px 12px; flex-shrink: 0; }
  .rs-date-row input[type=date] { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid #dde3ea; border-radius: 8px; font-size: 0.78rem; font-family: inherit; }
  .rs-date-nav {
    width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px; border: 1px solid #dde3ea;
    background: #f7f9fc; cursor: pointer; font-size: 0.95rem; color: var(--primary); line-height: 1;
  }
  .rs-date-nav:hover { background: #eef2f7; }
  .rs-today-btn {
    padding: 6px 10px; border-radius: 8px; border: 1px solid #dde3ea; background: #f7f9fc;
    font-size: 0.72rem; font-weight: 700; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  }
  .rs-today-btn:hover { background: #eef2f7; }
  .rs-day-total {
    margin: 0 16px 14px; flex-shrink: 0;
    background: linear-gradient(135deg, #e85d04, #f4a261); color: #fff;
    border-radius: 12px; padding: 10px 14px; font-size: 0.78rem;
    display: flex; justify-content: space-between; align-items: center;
  }
  .rs-day-total strong { font-size: 1.05rem; }
  .rs-body { flex: 1; overflow-y: auto; padding: 0 16px 16px; }
  .rs-group { margin-bottom: 16px; }
  .rs-group + .rs-group { border-top: 1px dashed #e6ecf3; padding-top: 12px; }
  .rs-group-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 6px; }
  .rs-group-user { font-size: 0.82rem; font-weight: 800; color: var(--primary); }
  .rs-group-total { font-size: 0.8rem; font-weight: 700; color: var(--success); white-space: nowrap; }
  .rs-entry {
    display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 8px 10px; background: #f7f9fc; border: 1px solid #edf2f7; border-radius: 10px; margin-bottom: 6px;
  }
  .rs-entry-info { min-width: 0; }
  .rs-entry-name { font-size: 0.8rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rs-entry-addr { font-size: 0.7rem; color: var(--muted); margin-top: 1px; }
  .rs-entry-amt { font-size: 0.8rem; font-weight: 700; color: var(--primary); white-space: nowrap; flex-shrink: 0; }
  .rs-entry { flex-wrap: wrap; }
  .rs-entry-name.rs-clickable { cursor: pointer; color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
  .rs-entry-name.rs-clickable:hover { color: var(--orange); }
  .rs-entry-actions {
    display: none; width: 100%; gap: 8px; padding-top: 6px; margin-top: 2px;
    border-top: 1px dashed #e6ecf3; align-items: center;
    position: relative; z-index: 20; pointer-events: auto;
  }
  .rs-entry-actions.show { display: flex; }
  .rs-act-btn {
    position: relative; z-index: 21; pointer-events: auto !important; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    width: 36px; height: 36px; min-width: 36px; min-height: 36px; padding: 0; border: none; border-radius: 9px;
    cursor: pointer; font-size: 0.95rem; line-height: 1;
    transition: background 0.15s, transform 0.1s;
  }
  .rs-act-btn:hover { transform: scale(1.08); }
  .rs-act-edit { background: #e8f0fe; color: #1e40af; }
  .rs-act-edit:hover { background: #d2e3fc; }
  .rs-act-del { background: #fee2e2; color: #991b1b; }
  .rs-act-del:hover { background: #fecaca; }
  .um-name-edit {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px;
  }
  .um-name-edit input {
    flex: 1; min-width: 120px; padding: 6px 8px; border: 1px solid #dde3ea;
    border-radius: 8px; font-size: 0.82rem; font-family: inherit;
  }

  .rs-empty { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 30px 6px; }

  /* Mobile FABs — hidden on desktop */
  .mobile-fab { display: none; }

  /* Nepali (BS) date hover tooltip */
  .bs-date-tip {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    background: linear-gradient(135deg, #0D3B66, #1F6FA8);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(13,59,102,0.35);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    max-width: calc(100vw - 16px);
  }
  .bs-date-tip.show {
    opacity: 1;
    visibility: visible;
  }
  .bs-date-tip::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -6px;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1F6FA8;
  }
  .bs-date-input { cursor: pointer; }
  .bs-date-cell { cursor: default; }
  .bs-date-cell[data-date]:not([data-date=""]) { cursor: help; text-decoration: underline dotted rgba(13,59,102,0.35); text-underline-offset: 2px; }

  /* ===== MOBILE RESPONSIVE ===== */
  @media (max-width: 800px) {
    .db-panels { grid-template-columns: 1fr; }
    .db-hello { font-size: 1.3rem; }
    .db-stats { grid-template-columns: 1fr; }
    .db-stat { padding: 14px 16px; }
    .db-num { font-size: 1.55rem; }
    .db-ic { width: 46px; height: 46px; border-radius: 14px; }
    .db-ic svg { width: 22px; height: 22px; }
  }

  @media (max-width: 700px) {
    :root {
      --as-w-expanded: min(280px, 82vw);
      --as-w-collapsed: 0px;
      --rs-w-expanded: min(320px, 88vw);
      --rs-w-collapsed: 0px;
      --header-h: 58px;
    }

    /* Content never shifted by sidebars on phone */
    body.is-admin .content-area,
    body.is-admin.as-collapsed .content-area,
    body.is-admin.rs-collapsed .content-area,
    body.is-admin.as-collapsed.rs-collapsed .content-area {
      padding-left: 0 !important;
      padding-right: 0 !important;
    }
    body.is-admin .container,
    body.is-admin.as-collapsed .container,
    body.is-admin.rs-collapsed .container,
    body.is-admin.as-collapsed.rs-collapsed .container {
      transform: none !important;
    }

    .container { padding: 12px; }
    .content-area { padding: 0; }

    /* Header */
    .header {
      flex-direction: row;
      flex-wrap: wrap;
      align-items: center;
      padding: 10px 12px;
      gap: 8px;
    }
    .header-actions {
      order: 3;
      width: 100%;
      margin: 0;
      justify-content: flex-start;
      flex: none;
    }
    .brand-logo { width: 36px; height: 36px; font-size: 12px; border-radius: 9px; }
    .profile-btn { padding-right: 8px; }
    .profile-menu { width: min(300px, calc(100vw - 24px)); right: 0; }
    .layout-switch-btn { padding: 6px 10px; font-size: 0.72rem; margin-right: 4px; }
    .layout-switch-label { /* keep short label on phone */ }

    /* Sidebars become overlays (drawer) */
    .admin-sidebar {
      width: var(--as-w-expanded);
      box-shadow: 8px 0 28px rgba(0,0,0,0.28);
      z-index: 120;
    }
    body.is-admin.as-collapsed .admin-sidebar {
      width: 0;
      padding: 0;
      overflow: hidden;
      border: none;
      box-shadow: none;
    }
    .reports-sidebar {
      width: var(--rs-w-expanded);
      box-shadow: -8px 0 28px rgba(0,0,0,0.28);
      z-index: 120;
    }
    body.rs-collapsed .reports-sidebar {
      width: 0;
      overflow: hidden;
      box-shadow: none;
    }

    /* Floating action buttons to reopen sidebars */
    .mobile-fab {
      display: none;
      position: fixed;
      bottom: 18px;
      width: 48px;
      height: 48px;
      border-radius: 50%;
      border: none;
      color: #fff;
      font-size: 1.25rem;
      font-weight: 800;
      z-index: 130;
      cursor: pointer;
      box-shadow: 0 6px 18px rgba(0,0,0,0.28);
      align-items: center;
      justify-content: center;
      line-height: 1;
      padding: 0;
    }
    .mobile-fab-admin {
      left: 12px;
      background: linear-gradient(135deg, var(--primary), var(--primary-light));
    }
    .mobile-fab-reports {
      right: 12px;
      background: linear-gradient(135deg, var(--orange), var(--orange-light));
    }
    body.is-admin.as-collapsed .mobile-fab-admin { display: flex; }
    body.is-admin.rs-collapsed .mobile-fab-reports { display: flex; }
    body.non-admin .mobile-fab { display: none !important; }

    /* Dashboard */
    .db-hero {
      padding: 16px 18px;
      border-radius: 14px;
      flex-direction: column;
      align-items: flex-start;
    }
    .db-hello { font-size: 1.2rem; }
    .db-date { font-size: 0.75rem; padding: 5px 10px; }
    .db-stats { grid-template-columns: 1fr; gap: 10px; }
    .search-card { padding: 14px; border-radius: 14px; }
    .search-row {
      flex-direction: column;
      align-items: stretch;
    }
    .search-input { min-width: 0; width: 100%; }
    .search-row .btn { width: 100%; padding: 12px; font-size: 0.95rem; }
    .search-card > div[style*="margin-top:16px"] {
      flex-direction: column !important;
      gap: 8px !important;
    }
    .search-card > div[style*="margin-top:16px"] .btn {
      width: 100%;
      padding: 12px 16px !important;
      font-size: 0.95rem !important;
    }

    /* Table: horizontal scroll + denser cells */
    .table-wrap {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      border-radius: 12px;
    }
    table { min-width: 720px; }
    th, td { padding: 8px 10px; font-size: 0.78rem; white-space: nowrap; }
    .actions { flex-wrap: wrap; gap: 4px; }
    .btn-sm { padding: 6px 10px; font-size: 0.72rem; min-height: 32px; }

    .customer-pagination { margin-top: -6px; padding: 10px; align-items: stretch; }
    .customer-page-info { width: 100%; text-align: center; }
    .customer-page-controls { width: 100%; justify-content: center; }

    /* Stats row under list */
    .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 1.2rem; }

    /* Forms / modals — bottom sheet style */
    .form-row { grid-template-columns: 1fr; }
    .modal {
      width: 100%;
      max-width: 100%;
      max-height: 92vh;
      border-radius: 16px 16px 0 0;
      margin-top: auto;
      padding: 18px 14px;
    }
    .modal-overlay {
      align-items: flex-end;
      padding: 0;
    }
    .modal h2 { font-size: 1.05rem; }
    .modal-actions {
      flex-direction: column-reverse;
      gap: 8px;
    }
    .modal-actions .btn { width: 100%; padding: 12px; }

    /* Login */
    .login-company { font-size: 1.55rem; }
    .login-box { padding: 26px 20px; border-radius: 18px; }
    .login-logo { width: 68px; height: 68px; font-size: 22px; }
    #loginScreen { padding: 16px; padding-bottom: 40px; }

    /* Daily collection / QR cards */
    .dc-totals { flex-direction: column; }
    .dc-row { flex-wrap: wrap; }
    .dc-panel-head { flex-wrap: wrap; gap: 8px; }

    /* Bulk / data grids */
    .dm-grid { grid-template-columns: 1fr; }
    .dm-tile { flex-direction: row; align-items: center; }
    .bulk-toolbar { flex-direction: column; }
    .bulk-toolbar .search-input { min-width: 0; width: 100%; }
    .bulk-list { max-height: 50vh; }

    /* Monthly table modal */
    #monthlyModal .modal { max-width: 100%; }
    #monthlyModal table { min-width: 680px; }

    /* Quick recharge */
    #quickRechargeCard .form-row { grid-template-columns: 1fr; }

    /* Toast */
    .toast {
      left: 12px;
      right: 12px;
      bottom: 16px;
      text-align: center;
    }
  }

  @media (max-width: 420px) {
    .db-hello { font-size: 1.1rem; }
    .brand-logo { width: 32px; height: 32px; }
    .container { padding: 10px; }
    .db-hero { padding: 14px; }
    th, td { font-size: 0.74rem; padding: 7px 8px; }
  }

/* ===== RMS V3.1.4 additive UI features ===== */
.modal { position: relative; }
.modal-close-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 1.45rem;
  line-height: 1;
  font-family: inherit;
  cursor: pointer;
  z-index: 5;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.modal-close-x:hover {
  background: #fee2e2;
  color: var(--danger);
  transform: scale(1.05);
}
.modal-close-x:focus-visible {
  outline: 3px solid rgba(232,93,4,.2);
  outline-offset: 2px;
}

.dc-due-box {
  display: flex;
  flex: 0 0 auto;
  min-width: 132px;
  flex-direction: column;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1.5px solid #edf2f7;
  background: #f7f9fc;
  text-align: right;
}
.dc-due-box span {
  font-size: .66rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .35px;
}
.dc-due-box strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--danger);
  margin-top: 2px;
  line-height: 1.15;
}
.dc-due-box small {
  font-size: .65rem;
  color: var(--danger);
  font-weight: 700;
  margin-top: 2px;
}

.rs-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.rs-scroll .rs-body {
  overflow: visible;
  flex: none;
}
.rs-sec-title {
  padding: 4px 16px 8px;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
}
.rs-sec-recharge {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px dashed #dfe6ee;
  color: var(--orange);
}
.rs-recharge-total {
  background: linear-gradient(135deg, #0D3B66, #1F6FA8);
}
.rs-pkg-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(232,93,4,.1);
  color: var(--orange);
  font-size: .66rem;
  font-weight: 800;
}
body.rs-collapsed .rs-scroll { display: none; }

@media (max-width: 700px) {
  .dc-selected-customer {
    flex-wrap: wrap;
  }
  .dc-selected-customer .dc-sc-info {
    flex: 1 1 100%;
  }
  .dc-due-box {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
  }
  .modal-close-x {
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
  }
}
