/* ============================================================
   assets/style.css — MKT Telecom (Mobile-First Responsive)
   ============================================================ */
:root{
  --bg:#090e1b;--surface:#0f1729;--card:#141e33;--card2:#1a2640;
  --border:#1e3356;--border2:#2a4a7f;
  --cyan:#00d4ff;--cyan2:#0ea5e9;--green:#10b981;--amber:#f59e0b;
  --red:#ef4444;--purple:#8b5cf6;--text:#dde8f5;--muted:#5a7a9a;
  --mono:'Share Tech Mono',monospace;--ui:'Exo 2',sans-serif;
  --bnav-h:62px;--topbar-h:52px;
}
*{box-sizing:border-box;margin:0;padding:0;}
html{-webkit-tap-highlight-color:transparent;}
body{background:var(--bg);color:var(--text);font-family:var(--ui);min-height:100vh;overflow-x:hidden;}
a{color:inherit;text-decoration:none;}

/* SHELL */
.shell{display:flex;height:100vh;overflow:hidden;}
.main{flex:1;overflow-y:auto;display:flex;flex-direction:column;min-width:0;}

/* SIDEBAR */
.sidebar{width:220px;min-width:220px;background:var(--surface);border-right:1px solid var(--border);display:flex;flex-direction:column;z-index:200;transition:transform .28s cubic-bezier(.4,0,.2,1);}
.logo{padding:22px 20px 16px;border-bottom:1px solid var(--border);}
.logo-tag{font-family:var(--mono);font-size:9px;color:var(--cyan);letter-spacing:3px;margin-bottom:4px;}
.logo-name{font-size:20px;font-weight:800;color:var(--text);letter-spacing:-.5px;}
.logo-sub{font-size:10px;color:var(--muted);font-family:var(--mono);}
.nav{flex:1;padding:12px 0;overflow-y:auto;}
.nav-section{font-size:9px;font-family:var(--mono);color:var(--muted);letter-spacing:2px;padding:14px 20px 6px;}
.nav-item{display:flex;align-items:center;gap:10px;padding:10px 20px;cursor:pointer;font-size:13px;font-weight:500;color:var(--muted);transition:all .15s;border-left:2px solid transparent;user-select:none;}
.nav-item:hover{color:var(--text);background:rgba(0,212,255,.04);}
.nav-item.active{color:var(--cyan);border-left-color:var(--cyan);background:rgba(0,212,255,.07);}
.nav-icon{font-size:15px;width:18px;text-align:center;}
.sidebar-bottom{padding:16px 20px;border-top:1px solid var(--border);}
.user-badge{display:flex;align-items:center;gap:10px;}
.user-av{width:32px;height:32px;border-radius:50%;background:linear-gradient(135deg,var(--cyan),var(--purple));display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;color:#fff;flex-shrink:0;}
.user-name{font-size:12px;font-weight:600;}
.user-role{font-size:10px;color:var(--muted);font-family:var(--mono);}
.drawer-overlay{display:none;}

/* TOPBAR */
.topbar{background:var(--surface);border-bottom:1px solid var(--border);padding:12px 20px;display:flex;align-items:center;justify-content:space-between;flex-shrink:0;min-height:var(--topbar-h);position:sticky;top:0;z-index:100;}
.topbar-left{display:flex;align-items:center;gap:10px;min-width:0;flex:1;}
.page-title{font-size:15px;font-weight:700;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.page-sub{font-size:11px;color:var(--muted);font-family:var(--mono);}
.topbar-actions{display:flex;gap:8px;align-items:center;flex-shrink:0;}
.btn-hamburger{display:none;background:none;border:1px solid var(--border);border-radius:7px;color:var(--muted);cursor:pointer;padding:7px 10px;font-size:18px;line-height:1;align-items:center;justify-content:center;flex-shrink:0;}

/* BUTTONS */
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 14px;border-radius:7px;font-family:var(--ui);font-size:12px;font-weight:600;cursor:pointer;border:none;transition:all .15s;user-select:none;text-decoration:none;white-space:nowrap;}
.btn-primary{background:var(--cyan);color:#050e1a;}
.btn-primary:hover,.btn-primary:active{background:#22dcff;box-shadow:0 0 16px rgba(0,212,255,.35);color:#050e1a;}
.btn-ghost{background:rgba(255,255,255,.04);color:var(--muted);border:1px solid var(--border);}
.btn-ghost:hover{border-color:var(--border2);color:var(--text);}
.btn-danger{background:rgba(239,68,68,.15);color:var(--red);border:1px solid rgba(239,68,68,.3);}
.btn-danger:hover{background:rgba(239,68,68,.25);}
.btn-success{background:rgba(16,185,129,.15);color:var(--green);border:1px solid rgba(16,185,129,.3);}
.btn-success:hover{background:rgba(16,185,129,.25);}
.btn-sm{padding:5px 10px;font-size:11px;}
.btn-xs{padding:3px 7px;font-size:10px;}

/* CONTENT */
.content{padding:20px 22px;flex:1;}
.section-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;gap:10px;flex-wrap:wrap;}
.section-title{font-size:13px;font-weight:700;color:var(--text);letter-spacing:.3px;}

/* STAT CARDS */
.stats-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:12px;margin-bottom:20px;}
.stat-card{background:var(--card);border:1px solid var(--border);border-radius:10px;padding:16px 18px;position:relative;overflow:hidden;}
.stat-card::before{content:'';position:absolute;inset:0;background:linear-gradient(135deg,rgba(255,255,255,.02),transparent);}
.stat-accent{width:3px;height:36px;border-radius:2px;position:absolute;top:16px;right:14px;}
.stat-label{font-size:9px;font-family:var(--mono);color:var(--muted);letter-spacing:1.5px;margin-bottom:7px;}
.stat-val{font-size:28px;font-weight:800;color:var(--text);line-height:1;}
.stat-sub{font-size:11px;color:var(--muted);margin-top:5px;}
.stat-sub b{color:var(--green);font-weight:600;}

/* TABLES */
.table-wrap{background:var(--card);border:1px solid var(--border);border-radius:10px;overflow:hidden;}
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;}
table{width:100%;border-collapse:collapse;min-width:460px;}
thead tr{background:var(--card2);border-bottom:1px solid var(--border);}
th{padding:10px 14px;text-align:left;font-size:10px;font-family:var(--mono);color:var(--muted);letter-spacing:1.5px;font-weight:400;white-space:nowrap;}
td{padding:11px 14px;font-size:12.5px;border-bottom:1px solid rgba(30,51,86,.5);color:var(--text);vertical-align:middle;}
tbody tr:last-child td{border-bottom:none;}
tbody tr.clickable:hover{background:rgba(0,212,255,.03);cursor:pointer;}
.mono{font-family:var(--mono);font-size:11px;}
.td-nome b{display:block;font-size:13px;}
.td-nome small{font-family:var(--mono);font-size:10px;color:var(--muted);}
.empty-row td{text-align:center;color:var(--muted);font-style:italic;padding:28px;}

/* MOBILE CARD LIST (replaces table on phones) */
.card-list{display:none;flex-direction:column;gap:8px;}
.cli-card{background:var(--card);border:1px solid var(--border);border-radius:10px;overflow:hidden;cursor:pointer;transition:border .15s;}
.cli-card:active{border-color:var(--border2);}
.cli-card-body{padding:14px 16px;}
.cli-card-top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;margin-bottom:8px;}
.cli-card-name{font-size:14px;font-weight:700;color:var(--text);}
.cli-card-doc{font-size:10px;color:var(--muted);font-family:var(--mono);margin-top:2px;}
.cli-card-meta{display:flex;gap:10px;flex-wrap:wrap;}
.cli-card-meta span{font-size:11px;color:var(--muted);font-family:var(--mono);}
.cli-card-actions{display:flex;background:rgba(0,0,0,.2);border-top:1px solid var(--border);}
.cli-card-btn{flex:1;display:flex;align-items:center;justify-content:center;gap:5px;padding:10px 4px;font-size:10px;font-family:var(--mono);font-weight:700;color:var(--muted);border-right:1px solid var(--border);cursor:pointer;transition:background .15s;text-decoration:none;}
.cli-card-btn:last-child{border-right:none;}
.cli-card-btn:active{background:rgba(0,212,255,.08);color:var(--cyan);}
.cli-card-btn .ico{font-size:14px;}

/* OS card list */
.os-card{background:var(--card);border:1px solid var(--border);border-radius:10px;padding:14px;cursor:pointer;transition:border .15s;margin-bottom:8px;}
.os-card:active{border-color:var(--border2);}
.os-card-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;}
.os-card-num{font-family:var(--mono);font-size:11px;color:var(--cyan);}
.os-card-tipo{font-size:13px;font-weight:700;margin-bottom:4px;}
.os-card-meta{font-family:var(--mono);font-size:10px;color:var(--muted);}

/* BADGES */
.badge{display:inline-flex;align-items:center;gap:4px;padding:3px 9px;border-radius:20px;font-size:10px;font-weight:700;font-family:var(--mono);letter-spacing:.5px;white-space:nowrap;}
.badge::before{content:'';width:5px;height:5px;border-radius:50%;background:currentColor;opacity:.7;}
.badge-green{background:rgba(16,185,129,.12);color:var(--green);}
.badge-cyan{background:rgba(0,212,255,.12);color:var(--cyan);}
.badge-amber{background:rgba(245,158,11,.12);color:var(--amber);}
.badge-red{background:rgba(239,68,68,.12);color:var(--red);}
.badge-purple{background:rgba(139,92,246,.12);color:var(--purple);}
.badge-muted{background:rgba(90,122,154,.12);color:var(--muted);}

/* SEARCH / FILTERS */
.search-wrap{position:relative;flex:1;max-width:360px;}
.search-wrap input{width:100%;background:var(--card);border:1px solid var(--border);border-radius:7px;padding:8px 12px 8px 34px;font-family:var(--ui);font-size:14px;color:var(--text);outline:none;transition:border .15s;}
.search-wrap input:focus{border-color:var(--border2);}
.search-wrap input::placeholder{color:var(--muted);}
.search-icon{position:absolute;left:10px;top:50%;transform:translateY(-50%);font-size:13px;color:var(--muted);}
.filter-bar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:14px;}
.filter-select{background:var(--card);border:1px solid var(--border);border-radius:6px;padding:6px 10px;color:var(--muted);font-family:var(--ui);font-size:12px;outline:none;-webkit-appearance:none;}
.filter-select option{background:var(--card);}

/* TABS */
.tabs{display:flex;gap:2px;padding:3px;background:var(--card);border-radius:8px;margin-bottom:16px;overflow-x:auto;-webkit-overflow-scrolling:touch;max-width:100%;}
.tab{padding:6px 14px;border-radius:6px;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s;color:var(--muted);white-space:nowrap;flex-shrink:0;}
.tab.active{background:var(--card2);color:var(--cyan);}

/* FORM */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;}
.form-grid.cols3{grid-template-columns:1fr 1fr 1fr;}
.form-grid.cols4{grid-template-columns:repeat(4,1fr);}
.form-group{display:flex;flex-direction:column;gap:5px;}
.form-group.full{grid-column:1/-1;}
.form-label{font-size:10px;font-family:var(--mono);color:var(--muted);letter-spacing:1.2px;}
.form-input,.form-select,.form-textarea{background:var(--card);border:1px solid var(--border);border-radius:7px;padding:11px 12px;font-family:var(--ui);font-size:16px;color:var(--text);outline:none;transition:border .15s;width:100%;-webkit-appearance:none;}
.form-input:focus,.form-select:focus,.form-textarea:focus{border-color:var(--cyan2);}
.form-input:read-only{color:var(--muted);background:var(--surface);}
.form-select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%235a7a9a' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:30px;}
.form-select option{background:var(--card);}
.form-textarea{resize:vertical;min-height:80px;font-size:14px;}
.form-section-title{font-size:10px;font-family:var(--mono);color:var(--cyan);letter-spacing:2px;margin:20px 0 12px;padding-bottom:8px;border-bottom:1px solid rgba(0,212,255,.15);}
.form-card{background:var(--card);border:1px solid var(--border);border-radius:10px;padding:18px;}
.form-error{font-size:11px;color:var(--red);margin-top:4px;}
.form-hint{font-size:10px;color:var(--muted);margin-top:4px;font-family:var(--mono);}

/* MODAL */
.modal-overlay{position:fixed;inset:0;background:rgba(5,10,25,.88);backdrop-filter:blur(4px);z-index:1000;display:flex;align-items:center;justify-content:center;opacity:0;pointer-events:none;transition:opacity .2s;}
.modal-overlay.open{opacity:1;pointer-events:all;}
.modal{background:var(--surface);border:1px solid var(--border2);border-radius:14px;width:680px;max-width:96vw;max-height:90vh;overflow-y:auto;transform:scale(.95);transition:transform .2s;}
.modal-overlay.open .modal{transform:scale(1);}
.modal-header{padding:18px 20px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:flex-start;position:sticky;top:0;background:var(--surface);z-index:1;}
.modal-title{font-size:15px;font-weight:700;}
.modal-sub{font-size:11px;color:var(--muted);font-family:var(--mono);margin-top:3px;}
.modal-close{background:none;border:none;color:var(--muted);font-size:24px;cursor:pointer;padding:0 6px;border-radius:4px;line-height:1;}
.modal-body{padding:18px 20px;}
.modal-footer{padding:14px 20px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:10px;position:sticky;bottom:0;background:var(--surface);}

/* DETAIL CARDS */
.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;}
.detail-item{background:var(--card);border:1px solid var(--border);border-radius:8px;padding:12px 14px;}
.detail-label{font-size:9px;font-family:var(--mono);color:var(--muted);letter-spacing:1.5px;margin-bottom:5px;}
.detail-val{font-size:13px;font-weight:600;color:var(--text);}
.detail-val.mono{font-family:var(--mono);font-size:12px;}

/* OS ROW */
.os-row{background:var(--card);border:1px solid var(--border);border-radius:8px;padding:14px;margin-bottom:8px;cursor:pointer;transition:border .15s;}
.os-row:hover{border-color:var(--border2);}
.os-row-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;}
.os-num{font-family:var(--mono);font-size:11px;color:var(--cyan);}
.os-tipo{font-size:13px;font-weight:700;margin-bottom:3px;}
.os-desc{font-size:12px;color:var(--muted);}
.os-meta{font-family:var(--mono);font-size:10px;color:var(--muted);margin-top:8px;}

/* GEO STATUS */
.geo-status{display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:6px;font-size:11px;font-family:var(--mono);margin-top:10px;}
.geo-status.loading{background:rgba(245,158,11,.1);color:var(--amber);border:1px solid rgba(245,158,11,.2);}
.geo-status.ok{background:rgba(16,185,129,.1);color:var(--green);border:1px solid rgba(16,185,129,.2);}
.geo-status.err{background:rgba(239,68,68,.1);color:var(--red);border:1px solid rgba(239,68,68,.2);}

/* MINI MAP */
.mini-map{height:180px;border-radius:8px;border:1px solid var(--border);overflow:hidden;margin-top:12px;}

/* MAP PAGE */
#main-map{height:calc(100vh - 180px);border-radius:10px;border:1px solid var(--border);overflow:hidden;}
.leaflet-container{background:#0a1220!important;}
.map-legend{background:var(--card);border:1px solid var(--border);border-radius:8px;padding:12px 14px;display:flex;gap:16px;flex-wrap:wrap;margin-top:12px;}
.legend-item{display:flex;align-items:center;gap:7px;font-size:11px;color:var(--muted);}
.legend-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0;}
.legend-square{width:10px;height:10px;transform:rotate(45deg);flex-shrink:0;}

/* ALERTS */
.alert{padding:12px 16px;border-radius:8px;font-size:13px;margin-bottom:14px;line-height:1.5;}
.alert-success{background:rgba(16,185,129,.12);border:1px solid rgba(16,185,129,.25);color:var(--green);}
.alert-danger{background:rgba(239,68,68,.12);border:1px solid rgba(239,68,68,.25);color:var(--red);}
.alert-warning{background:rgba(245,158,11,.12);border:1px solid rgba(245,158,11,.25);color:var(--amber);}
.alert-info{background:rgba(0,212,255,.08);border:1px solid rgba(0,212,255,.2);color:var(--cyan);}

/* TOAST */
.notif{position:fixed;bottom:80px;right:16px;background:var(--card2);border:1px solid var(--green);border-radius:10px;padding:13px 18px;font-size:13px;color:var(--green);z-index:3000;opacity:0;transform:translateY(8px);transition:all .3s;min-width:220px;max-width:90vw;}
.notif.show{opacity:1;transform:translateY(0);}
.notif.error{border-color:var(--red);color:var(--red);}

/* MISC */
.pulse{display:inline-block;width:8px;height:8px;border-radius:50%;background:currentColor;animation:pulseA 1.4s ease-in-out infinite;}
@keyframes pulseA{0%,100%{opacity:.4;transform:scale(.8)}50%{opacity:1;transform:scale(1.1)}}
.text-muted{color:var(--muted);}
.text-cyan{color:var(--cyan);}
.text-green{color:var(--green);}
.text-red{color:var(--red);}
.text-amber{color:var(--amber);}
.text-purple{color:var(--purple);}
.divider{border:none;border-top:1px solid var(--border);margin:14px 0;}
.chip{display:inline-block;background:var(--card);border:1px solid var(--border);border-radius:4px;padding:2px 8px;font-family:var(--mono);font-size:11px;color:var(--muted);}
.hidden{display:none!important;}
::-webkit-scrollbar{width:4px;height:4px;}
::-webkit-scrollbar-track{background:var(--bg);}
::-webkit-scrollbar-thumb{background:var(--border2);border-radius:3px;}

/* LOGIN */
.login-page{min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--bg);padding:16px;}
.login-card{background:var(--surface);border:1px solid var(--border2);border-radius:16px;padding:36px 32px;width:400px;max-width:100%;}
.login-logo{text-align:center;margin-bottom:28px;}
.login-logo .logo-tag{font-family:var(--mono);font-size:10px;color:var(--cyan);letter-spacing:3px;}
.login-logo .logo-name{font-size:36px;font-weight:800;margin:4px 0;}
.login-logo .logo-sub{font-size:12px;color:var(--muted);font-family:var(--mono);}

/* BOTTOM NAV (mobile only) */
.bottom-nav{display:none;position:fixed;bottom:0;left:0;right:0;background:var(--surface);border-top:1px solid var(--border);z-index:300;height:var(--bnav-h);padding-bottom:env(safe-area-inset-bottom,0px);}
.bottom-nav-inner{display:flex;height:100%;align-items:stretch;}
.bn-item{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;cursor:pointer;color:var(--muted);text-decoration:none;font-size:9px;font-family:var(--mono);letter-spacing:.5px;font-weight:700;padding:4px 2px;border-top:2px solid transparent;transition:color .15s;min-width:0;overflow:hidden;}
.bn-item.active{color:var(--cyan);border-top-color:var(--cyan);}
.bn-item:active{background:rgba(0,212,255,.06);}
.bn-icon{font-size:20px;line-height:1;}
.bn-label{font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;}

/* RESPONSIVE BREAKPOINTS */
@media(max-width:1100px){.stats-grid{grid-template-columns:repeat(3,1fr);}}
@media(max-width:900px){.stats-grid{grid-template-columns:repeat(2,1fr);}.form-grid.cols4{grid-template-columns:1fr 1fr;}}
/* Dashboard 2-col grid — collapses to 1 col on mobile */
.dash-grid{display:grid;grid-template-columns:1.6fr 1fr;gap:18px;}
@media(max-width:767px){.dash-grid{grid-template-columns:1fr;}}

@media(max-width:767px){
  /* Shell */
  .shell{flex-direction:column;}
  .sidebar{position:fixed;top:0;left:0;bottom:0;width:280px;min-width:unset;transform:translateX(-100%);box-shadow:6px 0 40px rgba(0,0,0,.7);z-index:500;}
  .sidebar.open{transform:translateX(0);}
  .drawer-overlay{display:block;position:fixed;inset:0;background:rgba(0,0,0,.65);backdrop-filter:blur(3px);z-index:499;opacity:0;pointer-events:none;transition:opacity .25s;}
  .drawer-overlay.open{opacity:1;pointer-events:all;}
  .btn-hamburger{display:inline-flex;}
  .main{width:100%;}
  /* Topbar */
  .topbar{padding:10px 14px;}
  .page-title{font-size:14px;}
  .page-sub{display:none;}
  .topbar-actions .btn-ghost{display:none;}
  .topbar-actions .btn-primary{padding:8px 12px;font-size:11px;}
  /* Content */
  .content{padding:14px 10px calc(var(--bnav-h) + 14px);}
  /* Stats */
  .stats-grid{grid-template-columns:1fr 1fr;gap:10px;}
  .stat-val{font-size:24px;}
  /* ─── TABELAS MOBILE: scroll horizontal em vez de ocultar ─── */
  .table-wrap{display:block;overflow-x:auto;-webkit-overflow-scrolling:touch;border-radius:10px;}
  .table-wrap table{min-width:600px;font-size:11px;}
  .table-wrap th,.table-wrap td{padding:8px 10px;white-space:nowrap;}
  /* Oculta colunas menos importantes no mobile */
  .table-wrap .col-hide-mobile{display:none;}
  /* Card list — mostrado só quando o PHP gerar .card-list com itens */
  .card-list{display:flex;}
  /* Form grids 1-col */
  .form-grid,.form-grid.cols3,.form-grid.cols4{grid-template-columns:1fr;}
  .form-group.full{grid-column:1;}
  /* Two-col content */
  [style*="grid-template-columns:1fr 1fr"]{grid-template-columns:1fr!important;}
  .detail-grid{grid-template-columns:1fr;}
  /* Modal bottom-sheet */
  .modal-overlay{align-items:flex-end;}
  .modal{width:100%;max-width:100%;border-radius:20px 20px 0 0;max-height:88vh;transform:translateY(40px);}
  .modal-overlay.open .modal{transform:translateY(0);}
  /* Bottom nav */
  .bottom-nav{display:block;}
  /* Toast above bottom nav */
  .notif{bottom:calc(var(--bnav-h) + 12px);right:12px;left:12px;min-width:unset;}
  /* Map */
  #main-map{height:calc(100vh - 200px);}
  /* Filter bar */
  .search-wrap{max-width:100%;}
  .filter-bar{flex-wrap:wrap;}
  .filter-bar .filter-select{flex:1;min-width:120px;}
  .search-wrap{flex:1 1 100%;}
  .section-head{flex-direction:column;align-items:stretch;}
  .section-head .btn{justify-content:center;}
}
@media(max-width:400px){
  .stats-grid{grid-template-columns:1fr;}
  .stat-val{font-size:22px;}
  .table-wrap table{min-width:480px;font-size:10px;}
  .table-wrap th,.table-wrap td{padding:6px 8px;}
}
