/* ============================================================
   base.css — WMS Design System — Mobile-First
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --bg:           #0a0e1a;
  --bg2:          #0f1420;
  --surface:      #131929;
  --surface2:     #1a2236;
  --surface3:     #1f2a42;
  --border:       #1e2d47;
  --border2:      #28395a;
  --text:         #e8eef8;
  --text2:        #7e95b8;
  --muted:        #3d5270;
  --brand:        #2563eb;
  --brand-bg:     #0c1e40;
  --brand-hover:  #1d4ed8;
  --brand-light:  #60a5fa;
  --ok:           #16a34a;
  --ok-light:     #4ade80;
  --ok-bg:        #052e16;
  --ok-border:    #15803d;
  --warn:         #d97706;
  --warn-light:   #fbbf24;
  --warn-bg:      #1c1000;
  --danger:       #dc2626;
  --danger-light: #f87171;
  --danger-bg:    #1f0707;
  --danger-border:#991b1b;
  --casulo:       #7c3aed;
  --casulo-light: #a78bfa;
  --casulo-bg:    #150d2e;
  --casulo-border:#4c1d95;
  --sidebar-w:    240px;
  --topbar-h:     56px;
  --botbar-h:     64px;
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    14px;
  --font:         'Inter', 'Segoe UI', system-ui, sans-serif;
  --mono:         'JetBrains Mono', 'Courier New', monospace;
  --tap:          48px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding-left: 0;
}

/* TOPBAR (substitui menu lateral) */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(19,25,41,.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.app-home {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border2);
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.app-home:hover { background: var(--surface2); }
.app-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  letter-spacing: -.2px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-title-icon { opacity: .9; }
.app-topbar-right { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.app-user { font-family: var(--mono); font-size: 12px; color: var(--text2); max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-store { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.app-logout {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border2);
  color: var(--text2);
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
}
.app-logout:hover { background: var(--surface2); color: var(--text); }

/* HOME (menu.php) */
body.home {
  padding-left: 0;
  background:
    radial-gradient(900px 420px at 18% -8%, rgba(96,165,250,.18), transparent 60%),
    radial-gradient(760px 420px at 92% 18%, rgba(167,139,250,.14), transparent 60%),
    var(--bg);
}
.home-wrap { max-width: 520px; margin: 0 auto; padding: 18px 14px 22px; }
.home-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.home-brand { font-size: 16px; font-weight: 800; letter-spacing: -.3px; line-height: 1.2; }
.home-sub { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .3px; text-transform: uppercase; margin-top: 2px; }
.home-logout {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border2);
  color: var(--text2); text-decoration: none;
  font-weight: 700; font-size: 13px;
}
.home-logout:hover { background: var(--surface2); color: var(--text); }
.home-user {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(31,42,66,.95) 0%, rgba(19,25,41,.95) 100%);
  border: 1px solid rgba(40,57,90,.85);
  box-shadow: 0 10px 22px rgba(0,0,0,.35);
  margin-bottom: 12px;
}
.home-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(96,165,250,.55), rgba(37,99,235,.20) 55%, rgba(37,99,235,.08) 100%);
  border: 1px solid rgba(37,99,235,.22);
  flex-shrink: 0;
}
.home-usertext { display: grid; gap: 2px; min-width: 0; }
.home-username-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.home-username { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-settings {
  width: 34px; height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--border2);
  color: var(--text2);
  text-decoration: none;
  flex-shrink: 0;
}
.home-settings:hover { background: var(--surface2); color: var(--text); }
.home-store { font-size: 12px; color: var(--text2); font-weight: 600; }
.home-menu { display: grid; gap: 10px; margin-top: 10px; }
.home-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(31,42,66,.92) 0%, rgba(19,25,41,.92) 100%);
  border: 1px solid rgba(40,57,90,.8);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(0,0,0,.28);
  min-height: 66px;
}
.home-item:hover { border-color: rgba(96,165,250,.35); transform: translateY(-1px); }
.home-item-icon {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(96,165,250,.55), rgba(37,99,235,.22) 55%, rgba(37,99,235,.10) 100%);
  border: 1px solid rgba(37,99,235,.22);
  flex-shrink: 0;
}
.home-item-body { display: grid; gap: 1px; min-width: 0; }
.home-item-title { font-weight: 900; letter-spacing: -.2px; }
.home-item-sub { font-size: 12px; color: var(--text2); font-weight: 600; }
.home-item-arrow { margin-left: auto; color: rgba(232,238,248,.35); font-size: 22px; line-height: 1; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100; overflow-y: auto; overflow-x: hidden;
}
.sidebar::before {
  content: ''; display: block; height: 3px; flex-shrink: 0;
  background: linear-gradient(90deg, var(--brand) 0%, var(--casulo-light) 100%);
}
.sidebar-head {
  padding: 14px 16px 12px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-shrink: 0;
}
.brand { font-size: 13px; font-weight: 800; color: var(--text); letter-spacing: -.3px; line-height: 1.2; }
.brand-sub { font-size: 10px; color: var(--muted); font-weight: 500; margin-top: 1px; letter-spacing: .3px; text-transform: uppercase; }
.nav-toggle {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text2); border-radius: var(--radius-sm);
  width: 40px; height: 40px;
  cursor: pointer; font-size: 18px; display: none;
  align-items: center; justify-content: center;
  font-family: var(--font); flex-shrink: 0;
}
.menu-vertical { flex: 1; padding: 8px 6px; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; }
.menu-vertical a {
  display: flex; align-items: center; gap: 10px;
  color: var(--text2); text-decoration: none;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  transition: background .12s, color .12s;
  min-height: var(--tap); position: relative;
}
.menu-vertical a:hover { background: var(--surface2); color: var(--text); }
.menu-vertical a.active {
  background: var(--brand-bg); color: var(--brand-light);
  border: 1px solid rgba(37,99,235,.25); font-weight: 600;
}
.menu-vertical a.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%; background: var(--brand-light);
  border-radius: 0 3px 3px 0;
}
.menu-vertical a .mi { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.menu-divider { height: 1px; background: var(--border); margin: 6px 0; }
.menu-user { padding: 8px 12px 4px; font-size: 11px; color: var(--muted); font-family: var(--mono); display: flex; align-items: center; gap: 6px; }
.menu-user::before { content: 'online'; color: var(--ok-light); font-size: 9px; font-weight: 700; background: var(--ok-bg); border: 1px solid var(--ok-border); padding: 1px 5px; border-radius: 4px; }
.sidebar-footer { padding: 10px 16px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .3px; text-transform: uppercase; flex-shrink: 0; }
.nav-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.65); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90; backdrop-filter: blur(2px); }

/* ── MOBILE TOPBAR ── */
.mobile-topbar {
  display: none; position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  z-index: 80; align-items: center; padding: 0 14px; gap: 12px;
}
.mobile-topbar::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--casulo-light) 100%);
}
.mobile-topbar .brand { font-size: 14px; flex: 1; }

/* ── MOBILE BOTTOM NAV ── */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  z-index: 80; padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-inner { display: flex; height: var(--botbar-h); align-items: stretch; }
.bnav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none;
  font-size: 9px; font-weight: 600; letter-spacing: .3px;
  transition: color .12s, background .12s;
  padding: 6px 2px; position: relative; min-width: 0;
  -webkit-tap-highlight-color: transparent;
}
.bnav-item:hover, .bnav-item.active { color: var(--brand-light); background: rgba(37,99,235,.06); }
.bnav-item.active::before {
  content: ''; position: absolute; top: 0; left: 15%; right: 15%;
  height: 2px; background: var(--brand-light); border-radius: 0 0 3px 3px;
}
.bnav-icon { font-size: 22px; line-height: 1; }
.bnav-label { font-size: 9px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: 0 2px; }

/* ── DRAWER (mobile full menu) ── */
.drawer {
  position: fixed; top: 0; left: 0;
  width: min(300px, 85vw); height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
  z-index: 100; display: flex; flex-direction: column; overflow-y: auto;
}
.drawer::before { content: ''; display: block; height: 3px; flex-shrink: 0; background: linear-gradient(90deg, var(--brand) 0%, var(--casulo-light) 100%); }
.drawer-head { padding: 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.drawer-close { background: var(--surface2); border: 1px solid var(--border); color: var(--text2); border-radius: var(--radius-sm); width: 40px; height: 40px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; }
.drawer-menu { flex: 1; padding: 8px 6px; display: flex; flex-direction: column; gap: 1px; }
.drawer-menu a {
  display: flex; align-items: center; gap: 12px;
  color: var(--text2); text-decoration: none;
  padding: 14px 14px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500;
  transition: background .12s, color .12s; min-height: 54px;
}
.drawer-menu a:hover { background: var(--surface2); color: var(--text); }
.drawer-menu a.active { background: var(--brand-bg); color: var(--brand-light); font-weight: 700; }
.drawer-menu .mi { font-size: 22px; width: 28px; text-align: center; flex-shrink: 0; }
.drawer-divider { height: 1px; background: var(--border); margin: 6px 0; }
.drawer-footer { padding: 14px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }
.drawer-user { font-size: 12px; color: var(--muted); font-family: var(--mono); display: flex; align-items: center; gap: 6px; }
.drawer-user::before { content: 'online'; color: var(--ok-light); font-size: 9px; font-weight: 700; background: var(--ok-bg); border: 1px solid var(--ok-border); padding: 1px 5px; border-radius: 4px; }
.drawer-loja { font-size: 11px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .5px; }

body.drawer-open .drawer { transform: translateX(0); }
body.drawer-open .nav-overlay { opacity: 1; pointer-events: auto; }

/* ── LAYOUT ── */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px; }

/* ── CARD ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; color: var(--text); }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── AUTH ── */
.auth { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.auth .card { max-width: 420px; width: 100%; margin: 0; }
.auth h1 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }

/* ── TYPOGRAPHY ── */
h1 { font-size: 18px; font-weight: 700; margin-bottom: 14px; color: var(--text); }
h2 { font-size: 15px; font-weight: 700; margin-bottom: 10px; color: var(--text); }
h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.muted { color: var(--muted); font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; }

/* ── FORMS ── */
label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .6px; }
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], input[type="url"], input[type="search"],
select, textarea {
  width: 100%; padding: 11px 14px;
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px;
  font-family: var(--font); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  margin-bottom: 12px; -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select option { background: var(--surface2); }
textarea { resize: vertical; min-height: 80px; }
input[type="checkbox"] { width: auto; margin: 0; accent-color: var(--brand); }

/* ── BUTTONS ── */
.btn, button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; background: var(--brand); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: var(--font);
  cursor: pointer; text-decoration: none;
  transition: background .15s; white-space: nowrap;
  min-height: var(--tap); touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover, button[type="submit"]:hover { background: var(--brand-hover); }
.btn:active { opacity: .85; }
.btn.danger, .btn-danger { background: var(--danger); }
.btn.danger:hover, .btn-danger:hover { background: #b91c1c; }
.btn.ghost, .btn-ghost { background: transparent; color: var(--text2); border: 1.5px solid var(--border); }
.btn.ghost:hover, .btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-sm { padding: 7px 12px; font-size: 13px; min-height: 38px; }
.btn-xs { padding: 4px 10px; font-size: 12px; min-height: 32px; }
button { font-family: var(--font); margin-top: 0; }
.btn-icon { background: transparent; border: 1px solid var(--border); color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-family: var(--font); transition: all .15s; min-height: var(--tap); min-width: var(--tap); display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { border-color: var(--brand); color: var(--brand-light); }
.btn-icon.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ── ALERTS ── */
.alert, .alert-danger { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-size: 14px; margin-bottom: 14px; background: var(--danger-bg); color: #fca5a5; border-color: var(--danger-border); }
.alert-success, .success { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-size: 14px; margin-bottom: 14px; background: var(--ok-bg); color: #86efac; border-color: var(--ok-border); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface2); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 10px 14px; background: var(--surface3); text-align: left; font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.018); }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.badge-brand  { background: var(--brand-bg);  color: var(--brand-light);  border: 1px solid rgba(37,99,235,.25); }
.badge-ok     { background: var(--ok-bg);      color: #4ade80;             border: 1px solid var(--ok-border); }
.badge-warn   { background: var(--warn-bg);    color: var(--warn-light);   border: 1px solid rgba(217,119,6,.3); }
.badge-danger { background: var(--danger-bg);  color: var(--danger-light); border: 1px solid var(--danger-border); }
.badge-casulo { background: var(--casulo-bg);  color: var(--casulo-light); border: 1px solid var(--casulo-border); }

/* ── SEARCH ── */
.search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.search input, .search select { margin-bottom: 0; flex: 1 1 200px; }
.search button { background: var(--brand); color: #fff; border: none; border-radius: var(--radius-sm); padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: var(--font); white-space: nowrap; margin: 0; min-height: var(--tap); }
.search button:hover { background: var(--brand-hover); }

/* filter */
.filter-menu { position: relative; }
.filter-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--surface2); border: 1.5px solid var(--border); color: var(--text2); padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; font-family: var(--font); white-space: nowrap; transition: border-color .15s; margin: 0; min-height: var(--tap); }
.filter-pill::after { content: "▾"; font-size: 10px; color: var(--muted); margin-left: 2px; }
.filter-pill:hover { border-color: var(--brand); color: var(--text); }
.filter-pop { position: absolute; top: calc(100% + 6px); left: 0; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); box-shadow: 0 16px 40px rgba(0,0,0,.5); padding: 8px; min-width: 230px; display: none; z-index: 20; }
.filter-pop.show { display: block; }
.filter-pop[hidden] { display: none !important; }
.filter-section { padding: 8px; }
.filter-section + .filter-section { border-top: 1px solid var(--border); }
.filter-title { font-size: 11px; font-weight: 700; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.filter-section input { margin-bottom: 0; }

/* ── RESULTS ── */
.result { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-top: 10px; display: flex; gap: 14px; align-items: flex-start; background: var(--surface2); transition: border-color .15s; }
.result:hover { border-color: var(--border2); }
.result-info { flex: 1; min-width: 0; }
.result-location { display: inline-flex; align-items: center; gap: 6px; background: var(--casulo-bg); border: 1px solid var(--casulo-border); color: var(--casulo-light); padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; font-family: var(--mono); margin-bottom: 8px; letter-spacing: .3px; }
.location { font-weight: 700; margin-bottom: 6px; color: var(--casulo-light); font-family: var(--mono); font-size: 13px; }
.detail { margin-top: 3px; font-size: 13px; color: var(--text2); }
.detail strong { color: var(--text); }
.result-name { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.result-detail { font-size: 12px; color: var(--text2); line-height: 1.7; }
.result-detail strong { color: var(--text); }
.result-photo { width: 70px; height: 70px; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface3); display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); }
.result-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-placeholder { color: var(--muted); font-size: 10px; text-align: center; padding: 4px; }

/* ── MISC ── */
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; }
.edit-row { display: none; background: var(--surface3); }
.edit-row.show { display: table-row; }
.edit-row td { padding: 14px 12px; }
.edit-form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.edit-form input, .edit-form select { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.thumb { width: 42px; height: 42px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.hero { display: grid; gap: 12px; }
details summary { cursor: pointer; font-weight: 700; margin: 8px 0 12px; color: var(--text2); }
.permissions { display: flex; gap: 14px; flex-wrap: wrap; margin: 8px 0 12px; }
.permissions label { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--text2); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.user-card { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.actions #grade-min, .actions #grade-max { max-width: 140px; }
#grade-cor { width: 100%; }
.grade-wrap { display: none; margin-top: 12px; }
.grade-wrap table input { width: 100%; min-width: 110px; }
.grade-wrap table input[readonly] { background: var(--surface3); color: var(--muted); }
.anexar-wrap { display: none; margin-top: 12px; }
.anexar-wrap.open { display: block; }
.hidden { display: none; }
.code-cell { min-width: 210px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: var(--surface3); border: 1px solid var(--border); color: var(--text2); padding: 6px 12px; border-radius: 20px; font-size: 12px; cursor: pointer; min-height: 36px; }
.chip:hover { background: var(--brand-bg); border-color: rgba(37,99,235,.3); color: var(--brand-light); }
.chip img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.search-toggle { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.search-toggle input { width: auto; }
.filter-input { display: none; min-width: 180px; }
.filter-input.show { display: inline-flex; }
.smart-wrap { position: relative; }
.smart-wrap input { width: 100%; box-sizing: border-box; }
.smart-dropdown { position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius-sm); z-index: 300; box-shadow: 0 8px 24px rgba(0,0,0,.4); max-height: 200px; overflow-y: auto; }
.smart-opt { padding: 10px 12px; font-size: 14px; cursor: pointer; min-height: var(--tap); display: flex; align-items: center; }
.smart-opt:hover { background: var(--surface2); color: var(--casulo-light); }

/* ── MOBILE ── */
@media (max-width: 768px) {
  body { padding-left: 0; padding-top: 0; padding-bottom: calc(var(--botbar-h) + env(safe-area-inset-bottom, 0px)); }
  body.home { padding-top: 0; padding-bottom: max(0px, env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .mobile-topbar { display: flex; }
  .bottom-nav { display: block; }
  .container { padding: 12px 10px; }
  .card { padding: 13px 12px; border-radius: var(--radius); }
  input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="url"], input[type="search"], select, textarea { font-size: 16px !important; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }
  .card-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .inline-form { width: 100%; }
  .inline-form select { width: 100%; }
  .grid { grid-template-columns: 1fr !important; }
  .result { flex-direction: column; }
  .edit-form { grid-template-columns: 1fr; }
  .ba { min-height: 42px !important; padding: 9px 13px !important; }
  td { padding: 10px; }
  h1 { font-size: 16px; }
  h2 { font-size: 14px; }
  .actions { flex-direction: column; align-items: stretch; }

  /* TABLE -> CARDS (portrait) */
  .table-wrap.table-cards { overflow-x: visible; }
  .table-wrap.table-cards table { min-width: 0; width: 100%; }
  .table-wrap.table-cards thead { display: none; }

  .table-wrap.table-cards tbody tr:not(.edit-row) {
    display: block;
    margin-bottom: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(255,255,255,.02);
    overflow: hidden;
  }

  .table-wrap.table-cards tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    overflow-wrap: anywhere;
  }
  .table-wrap.table-cards tbody tr:not(.edit-row) td:last-child { border-bottom: 0; }

  .table-wrap.table-cards tbody td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    color: var(--text2);
    font-weight: 800;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .35px;
    padding-top: 2px;
  }
  .table-wrap.table-cards tbody td:not([data-label])::before { display: none; }

  .table-wrap.table-cards tbody td.actions {
    flex-direction: column;
    align-items: stretch;
  }
  .table-wrap.table-cards tbody td.actions::before { flex: none; }
  .table-wrap.table-cards tbody td.actions form { width: 100%; }
  .table-wrap.table-cards tbody td.actions .btn,
  .table-wrap.table-cards tbody td.actions button { width: 100%; }

  /* Edit row (inline forms) */
  .table-wrap.table-cards tbody tr.edit-row { display: none; }
  .table-wrap.table-cards tbody tr.edit-row.show { display: block; }
  .table-wrap.table-cards tbody tr.edit-row td {
    display: block;
    border-bottom: 0;
    padding: 12px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
  .menu-vertical a { font-size: 12px; padding: 9px 10px; }
  .brand { font-size: 12px; }
  .container { padding: 18px 16px; }
}

@supports (padding: max(0px)) {
  body { padding-bottom: max(0px, env(safe-area-inset-bottom)); }
  .sidebar { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .bottom-nav { height: calc(var(--botbar-h) + env(safe-area-inset-bottom, 0px)); }
}
