
*{box-sizing:border-box}
:root{
  --navy:#081426;
  --navy2:#0d1b32;
  --navy3:#152846;
  --blue:#4f7cff;
  --blue2:#365ee8;
  --cyan:#22d3ee;
  --indigo:#6366f1;
  --orange:#ff8a3d;
  --orange2:#ffb067;
  --bg:#f4f7fc;
  --surface:#ffffff;
  --surface2:#f8fafc;
  --text:#101828;
  --muted:#667085;
  --border:#e5eaf2;
  --border2:#d6deea;
  --danger:#dc2626;
  --success:#16a34a;
  --warning:#d97706;
  --shadow:0 8px 24px rgba(31,50,81,.065);
  --shadow-lg:0 22px 60px rgba(18,35,63,.16);
  --radius:16px;
  --radius-sm:10px;
}
html,body{
  margin:0;padding:0;min-height:100%;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
  background:
    radial-gradient(circle at 76% 0%,rgba(99,102,241,.10),transparent 25%),
    radial-gradient(circle at 8% 76%,rgba(34,211,238,.055),transparent 22%),
    linear-gradient(135deg,#f7f9fd 0%,#f3f6fb 52%,#f7f8fc 100%);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}
body{letter-spacing:-.01em}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
.hidden{display:none!important}

/* ---------- LOGIN / SETUP ---------- */
.login-screen{
  min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px;
  background:
    radial-gradient(circle at 15% 20%,rgba(37,99,235,.16),transparent 28%),
    radial-gradient(circle at 85% 80%,rgba(249,115,22,.12),transparent 26%),
    linear-gradient(145deg,#f8fbff,#eef3fb);
}
.login-card{
  width:min(440px,100%);
  background:rgba(255,255,255,.88);
  backdrop-filter:blur(22px);
  -webkit-backdrop-filter:blur(22px);
  border:1px solid rgba(255,255,255,.9);
  border-radius:28px;
  padding:34px;
  box-shadow:0 30px 90px rgba(15,23,42,.14);
  position:relative;
  overflow:hidden;
}
.login-card:before{
  content:"";position:absolute;left:0;right:0;top:0;height:4px;
  background:linear-gradient(90deg,var(--blue),var(--cyan),var(--orange));
}
.login-card h1{margin:12px 0 6px;font-size:31px;letter-spacing:-.04em}
.login-card p,.support-note,.stat-note{color:var(--muted)}
.login-card input{width:100%;margin-top:12px}
.login-card .btn{margin-top:16px}

/* ---------- BRAND ---------- */
.brand{font-weight:800;color:var(--blue);font-size:22px;letter-spacing:-.02em}
.brand-logo{display:flex;align-items:center;line-height:1.1}
.brand-image{display:block;width:min(100%,240px);height:auto;object-fit:contain}
.login-card .brand-logo{justify-content:center;margin-bottom:8px}
.login-card .brand-image{width:245px;max-height:245px}
.setup-card .brand-logo{margin-bottom:4px}
.setup-logo{width:250px;max-height:240px;object-fit:contain}

/* ---------- APP SHELL ---------- */
.app-shell{min-height:100vh;display:flex}
.sidebar{
  position:fixed;left:0;top:0;bottom:0;width:286px;
  background:
    radial-gradient(circle at 12% 0%,rgba(79,124,255,.22),transparent 30%),
    radial-gradient(circle at 95% 88%,rgba(34,211,238,.08),transparent 25%),
    linear-gradient(155deg,#081426 0%,#0b1930 52%,#0b1426 100%);
  color:#fff;padding:18px 15px 14px;
  display:flex;flex-direction:column;overflow:hidden;
  border-right:1px solid rgba(255,255,255,.07);
  box-shadow:12px 0 40px rgba(15,23,42,.10);
}
.sidebar:after{
  content:"";position:absolute;left:18px;right:18px;top:112px;height:1px;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.14),transparent);
}
.sidebar>.brand{color:#fff;font-size:24px;margin:2px 8px 16px}
.sidebar>.brand-logo{justify-content:center;margin:0 0 20px}
.sidebar .brand-image{width:185px;max-height:165px}
.org-name{
  color:#9aa8bd;margin:0 8px 22px;font-size:12px;
  text-transform:uppercase;letter-spacing:.12em;font-weight:800;
  text-align:center;
}
#nav{
  border-top:1px solid rgba(255,255,255,.08);
  padding-top:15px;flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding-right:3px;
  scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.18) transparent;
}
#nav button{
  display:block;width:100%;text-align:left;border:1px solid transparent;
  background:transparent;color:#c9d4e5;padding:9px 12px;border-radius:11px;margin:3px 0;
  font-weight:700;transition:.18s ease;position:relative;
}
#nav button:hover{
  background:rgba(255,255,255,.055);color:#fff;transform:translateX(2px);
}
#nav button.active{
  color:#fff;
  background:linear-gradient(90deg,rgba(79,124,255,.28),rgba(99,102,241,.11));
  border-color:rgba(96,165,250,.18);
  box-shadow:inset 3px 0 0 #67e8f9,0 6px 18px rgba(0,0,0,.10);
}
.side-user{
  position:static;flex:0 0 auto;margin-top:12px;padding:15px 10px 2px;
  border-top:1px solid rgba(255,255,255,.08);color:#fff;background:transparent;
}
.side-user small{display:block;color:#9aa8bd;margin:3px 0 8px}
.link-btn{border:0;background:transparent;color:#8fc3ff;padding:0;font-weight:700}

/* ---------- MAIN / TOPBAR ---------- */
.main{margin-left:286px;width:calc(100% - 286px);padding:28px 34px 55px}
.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:20px;
  border-bottom:1px solid var(--border);padding:2px 0 17px;margin-bottom:21px;
}
.topbar h1{margin:0;font-size:32px;line-height:1.05;letter-spacing:-.045em}
.topbar p{margin:7px 0 0;color:var(--muted);font-size:15px}
.top-actions{display:flex;align-items:center;gap:10px}
.badge{
  background:linear-gradient(135deg,#eef4ff,#e9f8ff);
  color:#1d4ed8;border:1px solid #d9e7ff;border-radius:999px;
  padding:8px 13px;font-weight:800;box-shadow:0 5px 15px rgba(37,99,235,.06);
}

/* ---------- BUTTONS ---------- */
.btn{
  border:1px solid transparent;border-radius:11px;padding:8px 13px;
  font-weight:800;letter-spacing:-.01em;transition:.18s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn.primary{
  background:linear-gradient(135deg,var(--blue),#3b82f6);
  color:#fff;box-shadow:0 6px 15px rgba(54,94,232,.20);
}
.btn.primary:hover{background:linear-gradient(135deg,var(--blue2),var(--blue))}
.btn.secondary{background:#fff;color:#344054;border-color:var(--border2)}
.btn.secondary:hover{background:#f8fafc;border-color:#c8d3e2}
.btn.danger{background:#dc2626;color:#fff;box-shadow:0 7px 15px rgba(220,38,38,.13)}
.btn.success{background:#16a34a;color:#fff}
.btn.small{padding:6px 9px;font-size:11px;border-radius:8px}
.btn.full{width:100%;margin-top:16px}

/* ---------- FORMS ---------- */
input,select,textarea{
  width:100%;border:1px solid var(--border2);background:#fff;border-radius:12px;
  padding:9px 12px;color:var(--text);outline:none;
  transition:border-color .18s,box-shadow .18s,background .18s;
}
input:hover,select:hover,textarea:hover{border-color:#c2cddd}
input:focus,select:focus,textarea:focus{
  border-color:#5b8def;
  box-shadow:0 0 0 4px rgba(37,99,235,.10);
  background:#fcfdff;
}
textarea{min-height:100px;resize:vertical}
.field{display:flex;flex-direction:column;gap:7px}
.field label{font-weight:800;color:#344054;font-size:13px}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}

/* ---------- CARDS / DASHBOARD ---------- */
.cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:17px;margin-bottom:23px}
.card,.panel{
  background:rgba(255,255,255,.92);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:17px 18px;
  box-shadow:var(--shadow);
}
.card{
  position:relative;overflow:hidden;
  transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease;
}
.card:before{
  content:"";position:absolute;left:0;top:0;bottom:0;width:3px;
  background:linear-gradient(180deg,var(--blue),var(--cyan));
  opacity:.85;
}
.card:hover{transform:translateY(-3px);box-shadow:0 18px 38px rgba(15,23,42,.09);border-color:#d8e2ef}
.card p{margin:0 0 9px;color:#667085;font-size:14px;font-weight:700}
.card h2{margin:0;font-size:27px;letter-spacing:-.04em}
.panel{margin-top:18px}
.panel h2{margin:0 0 8px;letter-spacing:-.025em}
.panel h3{margin-top:22px}
.toolbar{display:flex;justify-content:flex-end;gap:10px;margin-bottom:15px;align-items:stretch}
.empty{padding:45px 20px;text-align:center;color:var(--muted)}
.kpi-click{
  width:100%;text-align:left;border:1px solid var(--border);cursor:pointer;font:inherit;
  transition:transform .18s,box-shadow .18s,border-color .18s;background:#fff;
}
.kpi-click:hover{transform:translateY(-3px);box-shadow:0 12px 30px rgba(37,99,235,.10);border-color:#cddbf0}
.kpi-click:focus{outline:3px solid rgba(37,99,235,.18);outline-offset:2px}
.kpi-click small{display:block;margin-top:8px;color:#7b8799;font-size:12px}

/* ---------- TABLES ---------- */
.table-wrap{overflow:auto;border:1px solid var(--border);border-radius:14px}
.table{width:100%;border-collapse:separate;border-spacing:0;min-width:700px}
.table th,.table td{text-align:left;padding:10px 11px;border-bottom:1px solid #edf0f5;vertical-align:middle}
.table th{
  color:#667085;font-size:12px;text-transform:uppercase;letter-spacing:.055em;
  background:#f8fafc;font-weight:850;
}
.table th:first-child{border-top-left-radius:13px}
.table th:last-child{border-top-right-radius:13px}
.table tbody tr{background:#fff;transition:background .15s}
.table tbody tr:hover{background:#f8fbff}
.table tbody tr:last-child td{border-bottom:0}
.actions{display:flex;gap:7px;flex-wrap:wrap}
.status{
  display:inline-flex;align-items:center;padding:5px 9px;border-radius:999px;
  font-size:12px;font-weight:800;background:#dcfce7;color:#166534;border:1px solid #bbf7d0;
}
.status.expired{color:#991b1b;background:#fee2e2;border-color:#fecaca}

/* ---------- PIPELINE / CHIPS ---------- */
.pipeline{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin:18px 0}
.pipeline .stage{background:#fff;border:1px solid var(--border);border-radius:14px;padding:16px;box-shadow:0 5px 16px rgba(15,23,42,.04)}
.pipeline .stage b{display:block;font-size:22px;margin-top:5px}
.mini-note{font-size:12px;color:var(--muted)}
.kpi-inline{display:flex;gap:8px;flex-wrap:wrap}
.chip{display:inline-flex;padding:5px 9px;border-radius:999px;background:#eef4ff;color:#3730a3;font-size:12px;font-weight:800}
.lead-score{display:inline-flex;align-items:center;justify-content:center;min-width:44px;padding:5px 9px;border-radius:999px;font-size:12px;font-weight:850}
.lead-hot{background:#fee2e2;color:#b91c1c}.lead-warm{background:#ffedd5;color:#c2410c}
.lead-cool{background:#fef3c7;color:#92400e}.lead-cold{background:#e2e8f0;color:#475569}
.quote-win{background:#dcfce7;color:#166534}

/* ---------- MODALS ---------- */
.modal{
  position:fixed;inset:0;background:rgba(2,8,23,.62);
  backdrop-filter:blur(5px);-webkit-backdrop-filter:blur(5px);
  display:flex;align-items:center;justify-content:center;padding:20px;z-index:1000;
}
.modal-card{
  width:min(900px,100%);max-height:92vh;overflow:auto;background:#fff;
  border:1px solid rgba(255,255,255,.8);border-radius:22px;padding:24px;
  box-shadow:var(--shadow-lg);
}
.modal-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:20px}
.modal-head h2{margin:0;letter-spacing:-.03em}
.modal-head p{margin:5px 0 0;color:var(--muted)}
.close{
  border:1px solid var(--border);background:#f8fafc;color:#344054;border-radius:10px;
  width:38px;height:38px;font-size:18px;transition:.15s
}
.close:hover{background:#eef2f7;transform:rotate(3deg)}
.modal-card>.cards{grid-template-columns:repeat(4,minmax(0,1fr))}

/* ---------- FILES ---------- */
.file-list{display:grid;gap:10px;margin-top:16px}
.file-item{
  display:flex;justify-content:space-between;align-items:center;gap:15px;
  border:1px solid var(--border);padding:10px 11px;border-radius:10px;background:#fbfcfe
}

/* ---------- RTO ---------- */
/* ---------- SCANNER ---------- */
.scanner-drop{
  border:2px dashed #cbd7e8;text-align:center;padding:24px;border-radius:15px;
  background:linear-gradient(180deg,#fbfdff,#f7faff);
}
.progress{height:10px;background:#e8edf5;border-radius:999px;overflow:hidden}
.progress span{display:block;height:100%;background:linear-gradient(90deg,var(--blue),var(--cyan));transition:width .2s ease}
.scan-text{min-height:180px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
#scannerResult .field input{background:#fff}

/* ---------- PROFILE / MESSAGES ---------- */
.profile-message{margin:12px 0;padding:11px 14px;border-radius:11px;font-size:14px;border:1px solid #dbe4f0}
.profile-message.success{background:#ecfdf3;border-color:#bbf7d0;color:#166534}
.profile-message.error{background:#fef2f2;border-color:#fecaca;color:#991b1b}
.profile-message.hidden{display:none}
.support-note{margin-top:16px;text-align:center;font-size:13px}
.support-note a,.support-link{color:var(--blue);font-weight:800;text-decoration:none}
.support-note a:hover,.support-link:hover{text-decoration:underline}
.search{min-width:250px}
.grid3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}

/* ---------- SCROLLBARS ---------- */
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:999px;border:2px solid transparent;background-clip:padding-box}
::-webkit-scrollbar-thumb:hover{background:#94a3b8;border:2px solid transparent;background-clip:padding-box}

/* ---------- RESPONSIVE ---------- */
@media(max-width:1050px){
  .sidebar{width:230px}.main{margin-left:230px;width:calc(100% - 230px);padding:22px}
  .cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  .pipeline{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:760px){
  .sidebar{position:relative;width:100%;height:auto;min-height:0;padding:16px}
  .app-shell{display:block}.main{margin-left:0;width:100%;padding:18px}
  .side-user{position:static;margin-top:16px}
  .topbar{align-items:flex-start;flex-direction:column}
  .topbar h1{font-size:29px}
  .grid,.cards,.grid3{grid-template-columns:1fr}
  .check-grid{grid-template-columns:1fr}
  .pipeline{grid-template-columns:1fr}
  .modal-card>.cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  .toolbar{flex-wrap:wrap}
  .toolbar .btn{width:auto}
  .sidebar .brand-image{width:150px}
  .login-card .brand-image,.setup-logo{width:220px}
}

/* ===== VAHAN PRO 2026 — Premium UI Layer ===== */
.sidebar>.brand-logo{
  background:rgba(255,255,255,.97);
  border:1px solid rgba(255,255,255,.78);
  border-radius:16px;
  padding:8px 10px;
  box-shadow:0 12px 28px rgba(0,0,0,.18);
}
.sidebar .brand-image{
  width:185px;
  max-height:150px;
}
.sidebar .org-name{
  color:#a9b8cf;
  margin-top:10px;
  margin-bottom:16px;
  letter-spacing:.15em;
}
.main{
  background:
    radial-gradient(circle at 92% 4%,rgba(99,102,241,.055),transparent 20%),
    transparent;
}
.topbar .badge{
  background:linear-gradient(135deg,#f2f6ff,#eefaff);
  border-color:#dbe7ff;
  color:#365ee8;
}
.card,.panel{
  background:linear-gradient(145deg,rgba(255,255,255,.98),rgba(251,253,255,.94));
  box-shadow:0 7px 22px rgba(32,51,82,.055);
}
.card{
  padding:16px 17px;
}
.card:before{
  width:3px;
  background:linear-gradient(180deg,#4f7cff,#22d3ee);
}
.card:hover{
  transform:translateY(-2px);
  box-shadow:0 14px 30px rgba(32,51,82,.085);
}
.card p{font-size:13px;margin-bottom:7px}
.card h2{font-size:26px}
.kpi-click{min-height:0}
.kpi-click small{margin-top:6px}
.panel{padding:18px}
.table th{
  padding:9px 10px;
  background:linear-gradient(180deg,#f8faff,#f4f7fb);
}
.table td{padding:9px 10px}
.table tbody tr:hover{background:#f7faff}
.btn.primary{
  background:linear-gradient(135deg,#4f7cff 0%,#6366f1 58%,#22a6d5 125%);
}
.btn.primary:hover{
  background:linear-gradient(135deg,#416ff0 0%,#575be9 58%,#1698c7 125%);
}
.btn.secondary{
  background:linear-gradient(180deg,#fff,#f8fafc);
}
input,select,textarea{
  border-radius:10px;
}
.toolbar{
  gap:8px;
  margin-bottom:12px;
}
.toolbar>.search,.toolbar>input{min-height:40px}
.toolbar>select{min-height:40px}
.toolbar>.rto-new-btn{
  min-width:130px;
  min-height:40px;
}
.rto-table th,.rto-table td{
  padding:7px 7px;
}
.rto-table .actions .btn{
  padding:5px 7px;
  font-size:11px;
}
.modal-card{
  border-radius:18px;
  padding:20px;
}
.modal-head{margin-bottom:16px}
.pipeline .stage{padding:13px}
.pipeline .stage b{font-size:20px}
.sidebar .side-user{
  padding-top:12px;
}
#nav::-webkit-scrollbar{width:7px}
#nav::-webkit-scrollbar-thumb{
  background:rgba(148,163,184,.28);
  border:1px solid transparent;
}
@media(max-width:760px){
  .sidebar>.brand-logo{max-width:250px;margin-left:auto;margin-right:auto}
  .sidebar .brand-image{width:155px}
}

.receipt-preview-panel{background:linear-gradient(145deg,#f8fbff,#f3f7ff)}
.receipt-calc{display:grid;gap:5px}
.receipt-calc>div{display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px dashed #dbe4f0}
.receipt-calc .grand{font-size:18px;border-top:2px solid #4f7cff;border-bottom:0;padding-top:10px}
.company-details-panel{border:1px solid #d9e4f5;background:linear-gradient(145deg,#ffffff,#f5f9ff)}
.panel-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:18px}
.status-pill{font-size:10px;font-weight:800;letter-spacing:.08em;padding:8px 10px;border-radius:999px;background:linear-gradient(90deg,#e8f1ff,#e9fbff);color:#1d4ed8;border:1px solid #cfe0ff;white-space:nowrap}
.company-details-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}
.company-details-grid .field-wide{grid-column:1/-1}
.company-details-grid textarea{width:100%;resize:vertical}
.company-preview{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:18px;padding:14px;border-radius:12px;background:#eef5ff;border:1px solid #d9e6f8}
.company-preview>div{display:flex;flex-direction:column;gap:5px;min-width:0}.company-preview b{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:#71809a}.company-preview span{font-size:12px;color:#1e3150;word-break:break-word}
@media(max-width:900px){.company-details-grid{grid-template-columns:1fr}.company-details-grid .field-wide{grid-column:auto}.company-preview{grid-template-columns:1fr 1fr}.panel-head{flex-direction:column}}


/* ===== FINAL AUTH + RESPONSIVE PATCH ===== */
.forgot-link{display:block;width:100%;border:0;background:transparent;color:var(--blue);font-weight:800;font-size:13px;padding:11px 4px 2px;text-align:center;cursor:pointer}
.forgot-link:hover{text-decoration:underline}
#loginMessage{margin-top:12px;text-align:center}
.login-card form{width:100%}
@media(max-width:760px){
  .login-screen{padding:14px;align-items:flex-start;padding-top:22px;overflow:auto}
  .login-card{padding:24px 18px;border-radius:22px}
  .login-card h1{font-size:27px}
  .login-card .brand-image,.setup-logo{width:min(210px,80vw);max-height:190px}
  .sidebar{padding:12px;overflow:visible}
  .sidebar>.brand-logo{margin-bottom:10px}
  .sidebar .org-name{margin-bottom:10px}
  #nav{display:flex;gap:6px;overflow-x:auto;overflow-y:hidden;padding:8px 2px;white-space:nowrap;border-top:1px solid rgba(255,255,255,.08)}
  #nav button{width:auto;min-width:max-content;margin:0;padding:9px 11px}
  .side-user{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
  .side-user small{margin:0}
  .main{padding:14px 12px 35px}
  .top-actions{width:100%;justify-content:space-between;flex-wrap:wrap}
  .top-actions .btn{flex:1;min-width:150px}
  .table-wrap{-webkit-overflow-scrolling:touch}
  .modal{padding:10px}
  .modal-card{padding:16px;border-radius:16px;max-height:94vh}
}
@media(min-width:761px) and (max-width:1050px){
  .sidebar{width:230px}.main{margin-left:230px;width:calc(100% - 230px)}
}

.profile-message.info{background:#eff6ff;border-color:#bfdbfe;color:#1d4ed8}

/* ============================================================
   VAHAN PRO — RTO FINAL LAYOUT
   Uses the same normal toolbar/button treatment as Insurance.
   No fixed tall buttons, no global toolbar overrides.
   ============================================================ */

/* Toolbar: compact controls, wrapping only when the viewport needs it. */
.rto-toolbar{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  flex-wrap:wrap !important;
  gap:8px !important;
  width:100% !important;
  min-width:0 !important;
}

.rto-toolbar > input,
.rto-toolbar > .search{
  flex:1 1 280px !important;
  min-width:240px !important;
  width:auto !important;
}

.rto-toolbar > select{
  flex:0 1 165px !important;
  min-width:150px !important;
  width:auto !important;
}

.rto-toolbar > .btn{
  flex:0 0 auto !important;
  width:auto !important;
  min-width:0 !important;
  white-space:nowrap !important;
}

/* Keep the action buttons at the same natural height as Insurance. */
.rto-toolbar > .btn{
  padding:8px 13px !important;
  line-height:1.1 !important;
}
.rto-toolbar > .rto-new-btn{
  min-width:130px !important;
}

/* RTO table fits the panel on desktop instead of forcing the whole panel sideways. */
.rto-table{
  width:100% !important;
  min-width:0 !important;
  table-layout:fixed !important;
}
.rto-table th,
.rto-table td{
  padding:8px 8px !important;
  vertical-align:middle !important;
}
.rto-table th:nth-child(1),
.rto-table td:nth-child(1){width:15%}
.rto-table th:nth-child(2),
.rto-table td:nth-child(2){width:14%}
.rto-table th:nth-child(3),
.rto-table td:nth-child(3){width:10%}
.rto-table th:nth-child(4),
.rto-table td:nth-child(4){width:10%}
.rto-table th:nth-child(5),
.rto-table td:nth-child(5){width:10%}
.rto-table th:nth-child(6),
.rto-table td:nth-child(6){width:10%}
.rto-table th:nth-child(7),
.rto-table td:nth-child(7){width:10%}
.rto-table th:nth-child(8),
.rto-table td:nth-child(8){width:11%}
.rto-table th:nth-child(9),
.rto-table td:nth-child(9){width:10%;min-width:105px}

.rto-table td{
  overflow-wrap:anywhere;
}
.rto-table td:nth-child(5),
.rto-table td:nth-child(6),
.rto-table td:nth-child(7){
  white-space:nowrap;
}
.rto-table .actions{
  display:flex !important;
  align-items:center !important;
  gap:5px !important;
  flex-wrap:wrap !important;
  white-space:normal !important;
}
.rto-table .actions .btn{
  padding:5px 7px !important;
  font-size:11px !important;
}

/* On smaller desktops, let only the toolbar wrap naturally. */
@media(max-width:1100px){
  .rto-toolbar > input,
  .rto-toolbar > .search{
    flex-basis:260px !important;
  }
  .rto-toolbar > select{
    flex-basis:155px !important;
  }
}

@media(max-width:760px){
  .rto-toolbar > input,
  .rto-toolbar > .search,
  .rto-toolbar > select,
  .rto-toolbar > .btn{
    width:100% !important;
    flex:1 1 100% !important;
    min-width:0 !important;
  }
  .rto-table{
    min-width:850px !important;
    table-layout:auto !important;
  }
}


/* Dashboard cloud sync bar */
.cloud-sync-panel{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:18px 0 22px;padding:14px 18px;}
.cloud-sync-panel h3{margin:0 0 3px;}
.cloud-sync-panel .stat-note{margin:0;}
.cloud-sync-panel .btn{flex:0 0 auto;white-space:nowrap;}
@media(max-width:700px){.cloud-sync-panel{align-items:stretch;flex-direction:column}.cloud-sync-panel .btn{width:100%;}}


/* FINAL CLOUD SYNC RELIABILITY PATCH */
[data-cloud-sync].sync-busy{opacity:.78;cursor:wait;pointer-events:none}
[data-cloud-sync]:disabled{cursor:wait}

/* ============================================================
   VAHAN PRO — MOBILE APP EXPERIENCE v5
   Phone: compact app shell + bottom navigation + touch targets
   Tablet: adaptive rail + 2-column workspace
   Desktop: existing layout remains unchanged
   ============================================================ */
@media (max-width: 760px){
  html,body{width:100%;overflow-x:hidden;-webkit-tap-highlight-color:transparent}
  body{padding-bottom:0}
  .app-shell{display:block;min-height:100dvh;width:100%}

  /* Compact app header */
  .sidebar{
    position:fixed;z-index:900;left:0;right:0;top:0;bottom:auto;
    width:100%;height:68px;min-height:68px;padding:8px 12px;
    display:flex;flex-direction:row;align-items:center;justify-content:space-between;
    border-right:0;border-bottom:1px solid rgba(255,255,255,.10);
    box-shadow:0 8px 28px rgba(2,8,23,.20);
    overflow:visible;
  }
  .sidebar:after{display:none}
  .sidebar>.brand-logo{margin:0!important;padding:0!important;background:transparent!important;border:0!important;box-shadow:none!important;max-width:none}
  .sidebar .brand-image{width:108px!important;height:50px!important;max-height:50px!important;object-fit:contain}
  .org-name{display:none!important}
  .side-user{display:flex!important;align-items:center;gap:7px;margin:0!important;padding:0!important;border:0!important;font-size:11px;white-space:nowrap}
  .side-user #sideUserName{max-width:105px;overflow:hidden;text-overflow:ellipsis;font-weight:800}
  .side-user small{display:none!important}
  .side-user .link-btn{font-size:11px;padding:7px 9px;border-radius:999px;background:rgba(255,255,255,.10)}

  /* Bottom app navigation */
  #nav{
    position:fixed;z-index:950;left:0;right:0;bottom:0;height:76px;
    display:flex!important;align-items:stretch;gap:4px;
    overflow-x:auto!important;overflow-y:hidden!important;
    padding:7px 7px calc(7px + env(safe-area-inset-bottom))!important;
    margin:0!important;border:0!important;
    background:rgba(8,20,38,.97);
    box-shadow:0 -10px 30px rgba(2,8,23,.18);
    backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);
    scrollbar-width:none;
  }
  #nav::-webkit-scrollbar{display:none}
  #nav button{
    flex:0 0 76px;width:76px;min-width:76px;height:60px;
    margin:0!important;padding:7px 4px!important;border-radius:13px!important;
    display:flex!important;align-items:center;justify-content:center;text-align:center;
    font-size:10px!important;line-height:1.15!important;font-weight:800!important;
    white-space:normal!important;color:#b8c6da!important;
  }
  #nav button.active{color:#fff!important;background:linear-gradient(180deg,rgba(79,124,255,.34),rgba(34,211,238,.12))!important;box-shadow:inset 0 2px 0 rgba(103,232,249,.85),0 5px 16px rgba(0,0,0,.15)!important}
  #nav button:active{transform:scale(.96)!important}

  .main{
    margin:0!important;width:100%!important;max-width:100%!important;
    padding:84px 12px 94px!important;
  }
  .topbar{
    position:relative;display:flex!important;flex-direction:column!important;align-items:stretch!important;
    gap:11px!important;padding:0 2px 14px!important;margin-bottom:14px!important;
    border-bottom:1px solid rgba(214,222,234,.85)!important;
  }
  .topbar h1{font-size:27px!important;letter-spacing:-.045em!important}
  .topbar p{font-size:13px!important;margin-top:5px!important}
  .top-actions{display:grid!important;grid-template-columns:1fr auto;gap:8px!important;width:100%!important}
  .top-actions .badge{min-width:0;overflow:hidden;text-overflow:ellipsis;padding:9px 12px;font-size:12px;text-align:center}
  .top-actions .btn{min-height:44px!important;padding:10px 13px!important;font-size:13px!important;white-space:nowrap}

  .page{width:100%;min-width:0}
  .cards{grid-template-columns:1fr!important;gap:11px!important;margin-bottom:13px!important}
  .card,.panel{border-radius:18px!important;padding:16px!important;box-shadow:0 7px 22px rgba(31,50,81,.065)!important}
  .card{min-height:108px}
  .card p{font-size:13px!important;margin-bottom:8px!important}
  .card h2{font-size:29px!important}
  .card:before{width:3px!important}
  .card:hover{transform:none!important;box-shadow:0 7px 22px rgba(31,50,81,.065)!important}

  .cloud-sync-panel{margin:13px 0!important;padding:15px!important;gap:10px!important;border-radius:18px!important}
  .cloud-sync-panel h3{font-size:18px;margin:0 0 3px}
  .cloud-sync-panel .stat-note{font-size:12px}
  .cloud-sync-panel .btn{width:100%!important;min-height:46px!important;border-radius:13px!important;font-size:14px!important}

  .toolbar{display:grid!important;grid-template-columns:1fr!important;gap:8px!important;margin-bottom:12px!important}
  .toolbar>*{width:100%!important;min-width:0!important;min-height:44px!important}
  .rto-toolbar{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
  .rto-toolbar>*{width:100%!important;min-width:0!important;min-height:44px!important}

  input,select,textarea{font-size:16px!important;min-height:44px}
  textarea{min-height:110px}
  .btn{min-height:42px}
  .btn.small{min-height:36px}
  .form-actions{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
  .grid,.grid3,.company-details-grid{grid-template-columns:1fr!important;gap:11px!important}
  .pipeline{grid-template-columns:1fr!important;gap:10px!important}

  .panel h2{font-size:21px!important}
  .panel h3{font-size:17px}
  .table-wrap{border-radius:13px!important;-webkit-overflow-scrolling:touch;box-shadow:inset 0 0 0 1px rgba(229,234,242,.35)}
  .table{min-width:720px!important}
  .table th,.table td{padding:10px 9px!important;font-size:12px}

  .modal{padding:8px!important;align-items:flex-end!important}
  .modal-card{width:100%!important;max-height:92dvh!important;border-radius:22px 22px 12px 12px!important;padding:17px!important}
  .modal-head{position:sticky;top:-17px;background:#fff;z-index:2;padding:3px 0 12px;margin-bottom:12px!important}
  .modal-card>.cards{grid-template-columns:1fr!important}
  .close{width:42px;height:42px;flex:0 0 42px}

  /* Touch-friendly action groups */
  .actions{gap:6px!important}
  .actions .btn{min-height:38px!important}

  /* Keep horizontal data tables inside their own card, never the page */
  .rto-table{min-width:850px!important}
  .rto-table th,.rto-table td{font-size:11px!important}

  /* Customer / company preview grids */
  .company-preview{grid-template-columns:1fr 1fr!important;gap:8px!important}
  .file-item{align-items:flex-start;flex-direction:column}
}

@media (max-width: 390px){
  .sidebar .brand-image{width:96px!important}
  .side-user #sideUserName{max-width:82px}
  .top-actions{grid-template-columns:1fr}
  .top-actions .badge{width:100%}
  #nav button{flex-basis:70px;min-width:70px;width:70px;font-size:9.5px!important}
  .main{padding-left:10px!important;padding-right:10px!important}
}

/* Tablet: app-like compact rail without sacrificing desktop productivity */
@media (min-width:761px) and (max-width:1050px){
  .sidebar{width:220px;padding:15px 11px}
  .sidebar .brand-image{width:155px;max-height:140px}
  .main{margin-left:220px;width:calc(100% - 220px);padding:22px 20px 45px}
  .topbar h1{font-size:29px}
  .cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}
  .card{min-height:112px}
  .toolbar{flex-wrap:wrap}
  .toolbar>*{min-height:42px}
  .panel{padding:15px}
}

/* Large tablets / landscape touch screens */
@media (min-width:1051px) and (max-width:1280px){
  .sidebar{width:250px}
  .main{margin-left:250px;width:calc(100% - 250px);padding:24px 26px 50px}
  .cards{gap:13px}
}

/* Reduce motion for users who request it */
@media (prefers-reduced-motion:reduce){
  *,*:before,*:after{scroll-behavior:auto!important;transition:none!important;animation:none!important}
}

/* ============================================================
   VAHAN PRO — MOBILE APP UI v6
   Inspired by modern insurance-agent mobile UX: clear hierarchy,
   quick actions, compact KPI grid, bottom navigation and a More sheet.
   ============================================================ */
.mobile-header{display:none}

@media(max-width:760px){
  body{background:#f7f9fd;color:#152238}
  .mobile-header{
    display:flex;position:fixed;z-index:940;top:0;left:0;right:0;height:78px;
    align-items:center;gap:10px;padding:9px 13px 9px 11px;
    background:rgba(255,255,255,.97);border-bottom:1px solid #edf0f5;
    box-shadow:0 5px 22px rgba(27,49,83,.08);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)
  }
  .mobile-avatar{width:50px;height:50px;flex:0 0 50px;border-radius:50%;padding:4px;background:#eef4ff;border:1px solid #dfe8f7;display:grid;place-items:center;overflow:hidden}
  .mobile-avatar img{width:100%;height:100%;object-fit:contain;border-radius:50%}
  .mobile-user{min-width:0;flex:1}
  .mobile-greeting{font-size:11px;color:#8490a3;line-height:1.15;margin-bottom:3px}
  .mobile-user-name{font-size:17px;font-weight:850;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#0f1728}
  .mobile-header-actions{display:flex;gap:7px}
  .mobile-icon-btn{width:42px;height:42px;border-radius:50%;border:1px solid #dfe5ef;background:#fff;color:#1d477f;font-size:18px;font-weight:800;box-shadow:0 4px 12px rgba(30,60,100,.07);display:grid;place-items:center}
  .mobile-icon-btn:active{transform:scale(.94)}

  .main{padding:96px 12px 98px!important}
  .topbar{padding:0 4px 13px!important;margin-bottom:12px!important;border-bottom:0!important}
  .topbar>div:first-child{display:none}
  .top-actions{display:grid!important;grid-template-columns:1fr auto!important;gap:8px!important}
  .top-actions .badge{display:none}
  .top-actions .btn{width:100%;min-height:46px!important;border-radius:14px!important;font-size:14px!important;box-shadow:0 8px 20px rgba(57,104,218,.18)}

  .mobile-dashboard-intro{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin:0 2px 14px;padding:2px 2px 0}
  .mobile-dashboard-intro .eyebrow{font-size:10px;letter-spacing:.13em;font-weight:900;color:#5876a4}
  .mobile-dashboard-intro h2{font-size:23px;line-height:1.08;margin:4px 0 4px;letter-spacing:-.04em;color:#17283f}
  .mobile-dashboard-intro p{font-size:12px;line-height:1.4;color:#7b8798;margin:0;max-width:250px}
  .mobile-sync-mini{border:0;background:#153e87;color:#fff;border-radius:999px;padding:10px 12px;font-weight:800;font-size:12px;white-space:nowrap;box-shadow:0 8px 18px rgba(21,62,135,.18)}

  .mobile-quick-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;margin:0 0 15px}
  .mobile-quick-actions button{min-width:0;border:1px solid #e8edf5;background:#fff;border-radius:15px;padding:10px 5px 9px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;box-shadow:0 5px 16px rgba(35,57,90,.055);color:#18355c}
  .mobile-quick-actions button:active{transform:translateY(1px)}
  .mobile-quick-actions span{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:#eef4ff;font-size:16px}
  .mobile-quick-actions b{font-size:10px;line-height:1.15;text-align:center}
  .mobile-quick-actions small{font-size:8px;color:#8a96a8;line-height:1.05;text-align:center}

  .cards{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important;margin:0 0 13px!important}
  .card{min-height:96px!important;padding:13px 12px!important;border-radius:16px!important;background:#fff!important;border:1px solid #e8edf5!important;box-shadow:0 5px 17px rgba(31,50,81,.05)!important}
  .card p{font-size:11px!important;line-height:1.2!important;margin:0 0 7px!important;color:#738097!important;font-weight:750!important}
  .card h2{font-size:22px!important;line-height:1.1!important;letter-spacing:-.04em!important;color:#16253c!important}
  .card:before{width:3px!important;border-radius:4px!important}

  .cloud-sync-panel{margin:2px 0 13px!important;padding:14px!important;border-radius:17px!important;background:#f1f6ff!important;border:1px solid #dfe9fb!important;box-shadow:none!important;gap:10px!important}
  .cloud-sync-panel h3{font-size:16px!important}
  .cloud-sync-panel .stat-note{font-size:11px!important}
  .cloud-sync-panel .btn{min-height:43px!important;border-radius:12px!important;font-size:13px!important}

  .panel{border-radius:18px!important;padding:14px!important;background:#fff!important;border:1px solid #e9edf4!important;box-shadow:0 6px 18px rgba(31,50,81,.045)!important}
  .panel h2{font-size:19px!important;letter-spacing:-.03em!important}
  .section-head-mobile{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}
  .section-head-mobile h2{margin:0!important}
  .text-link-mobile{border:0;background:transparent;color:#1d56a0;font-size:12px;font-weight:800;padding:5px}

  .table-wrap{overflow-x:auto!important;max-width:100%!important;border:1px solid #edf0f4!important}
  .table{min-width:650px!important}

  #nav{height:78px!important;padding:7px 7px calc(7px + env(safe-area-inset-bottom))!important;background:rgba(255,255,255,.98)!important;border-top:1px solid #e8edf3!important;box-shadow:0 -8px 26px rgba(25,46,78,.09)!important;backdrop-filter:blur(18px)!important;-webkit-backdrop-filter:blur(18px)!important}
  #nav button{flex:1 1 0!important;width:auto!important;min-width:0!important;height:62px!important;border-radius:15px!important;color:#6e7888!important;background:transparent!important;box-shadow:none!important;font-size:10px!important;font-weight:800!important;gap:3px!important}
  #nav button .nav-icon{display:grid;place-items:center;font-size:19px;line-height:1;height:27px}
  #nav button.active{color:#174d9d!important;background:#eaf2ff!important;box-shadow:none!important}
  #nav button:active{transform:scale(.96)!important}

  .modal{padding:8px!important;align-items:flex-end!important;background:rgba(12,24,42,.35)!important}
  .modal-card{width:100%!important;max-height:91dvh!important;border-radius:24px 24px 12px 12px!important;padding:16px!important}
  .mobile-more-sheet{width:100%}
  .mobile-menu-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;max-height:58dvh;overflow:auto;padding:2px 0 8px}
  .mobile-menu-item{display:grid;grid-template-columns:34px 1fr 16px;align-items:center;gap:7px;text-align:left;border:1px solid #e9edf4;background:#f9fbfe;border-radius:14px;padding:11px 9px;color:#17345b}
  .mobile-menu-item>span{width:30px;height:30px;display:grid;place-items:center;background:#edf3ff;border-radius:50%;font-size:16px}
  .mobile-menu-item b{font-size:11px;line-height:1.2}
  .mobile-menu-item small{font-size:18px;color:#8290a4}
  .mobile-logout{width:100%;margin-top:4px;min-height:44px;border:1px solid #ffd7d7;background:#fff4f4;color:#c83b3b;border-radius:13px;font-weight:800}

  /* Tables, forms and pages keep the app feel without losing information. */
  .toolbar{gap:7px!important}
  .toolbar>*{border-radius:12px!important}
  .btn{border-radius:12px!important;font-weight:800!important}
  .actions .btn{border-radius:10px!important}
}

@media(max-width:390px){
  .mobile-header{padding-left:8px;padding-right:8px}
  .mobile-avatar{width:46px;height:46px;flex-basis:46px}
  .mobile-user-name{font-size:15px}
  .mobile-icon-btn{width:38px;height:38px}
  .mobile-quick-actions{gap:5px}
  .mobile-quick-actions b{font-size:9px}
  .mobile-quick-actions small{display:none}
  .cards{gap:7px!important}
  .card{padding:12px 10px!important;min-height:90px!important}
  .card h2{font-size:20px!important}
}
