:root{
  --brand:#005082;
  --brand-2:#0b6fb3;
  --brand-3:#0ea5b7;
  --accent:#f6c343;
  --danger:#dc2626;
  --success:#0f766e;
  --bg:#eef4f8;
  --bg-2:#f8fbfd;
  --surface:#ffffff;
  --surface-2:#f4f8fb;
  --surface-3:#eaf2f7;
  --text:#102434;
  --muted:#64748b;
  --border:#d8e3eb;
  --border-strong:#b8c9d6;
  --shadow:0 14px 36px rgba(0,42,74,.10);
  --shadow-soft:0 8px 22px rgba(0,42,74,.07);
  --radius:12px;
  --radius-sm:8px;
  --ring:0 0 0 3px rgba(14,165,183,.22);
}

:root[data-theme="dark"]{
  --bg:#07131d;
  --bg-2:#0b1b28;
  --surface:#102333;
  --surface-2:#142d40;
  --surface-3:#1b3a50;
  --text:#e8f2f8;
  --muted:#a7bac8;
  --border:#25445a;
  --border-strong:#35627d;
  --shadow:0 18px 42px rgba(0,0,0,.34);
  --shadow-soft:0 10px 24px rgba(0,0,0,.24);
  --ring:0 0 0 3px rgba(14,165,183,.32);
}

*{ box-sizing:border-box; }
html{ color-scheme:light; }
html[data-theme="dark"]{ color-scheme:dark; }

body{
  margin:0;
  min-height:100vh;
  font-family:Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 16% -12%, rgba(14,165,183,.16), transparent 34rem),
    radial-gradient(circle at 92% 4%, rgba(246,195,67,.12), transparent 26rem),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}

body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    linear-gradient(90deg, rgba(255,255,255,.20) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255,255,255,.16) 1px, transparent 1px);
  background-size:48px 48px;
  mask-image:linear-gradient(180deg, rgba(0,0,0,.36), transparent 52%);
  opacity:.35;
}

html[data-theme="dark"] body::before{ opacity:.13; }

a{ color:var(--brand-2); }
a:visited{ color:var(--brand-2); }

.app-header{
  position:sticky;
  top:0;
  z-index:40;
  padding:10px 16px;
  background:
    linear-gradient(135deg, rgba(0,80,130,.98), rgba(0,93,143,.96) 52%, rgba(10,119,154,.96));
  color:#fff;
  box-shadow:0 10px 30px rgba(0,42,74,.24);
}

.app-header-inner{
  display:flex;
  align-items:center;
  gap:14px;
  max-width:1600px;
  margin:0 auto;
}

.brand-link{
  display:flex;
  align-items:center;
  gap:10px;
  color:#fff;
  text-decoration:none;
  min-width:190px;
}

.brand-link:visited{ color:#fff; }
.brand-mark{
  width:38px;
  height:38px;
  border-radius:10px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg, rgba(255,255,255,.20), rgba(255,255,255,.08));
  border:1px solid rgba(255,255,255,.24);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.22);
}
.brand-mark img{ width:24px; height:24px; display:block; }
.brand-text{ display:flex; flex-direction:column; line-height:1.05; }
.brand-title{ font-weight:800; letter-spacing:.2px; }
.brand-caption{ font-size:11px; color:rgba(255,255,255,.76); margin-top:3px; }

.main-nav{
  display:flex;
  align-items:center;
  gap:4px;
  flex:1;
  min-width:0;
  overflow-x:auto;
  scrollbar-width:thin;
  padding:2px;
}

.main-nav a{
  color:rgba(255,255,255,.82);
  text-decoration:none;
  padding:9px 11px;
  border-radius:9px;
  white-space:nowrap;
  font-weight:700;
  font-size:14px;
  transition:background .16s ease, color .16s ease, transform .16s ease;
}
.main-nav a:visited{ color:rgba(255,255,255,.82); }
.main-nav a:hover{
  color:#fff;
  background:rgba(255,255,255,.12);
  transform:translateY(-1px);
}
.main-nav a.active{
  color:#08324d;
  background:#fff;
  box-shadow:0 6px 18px rgba(0,0,0,.16);
}

.header-actions{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}

.theme-toggle,
.power-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  height:36px;
  padding:0 12px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.28);
  background:rgba(255,255,255,.10);
  color:#fff;
  font-weight:800;
  cursor:pointer;
  transition:background .16s ease, transform .16s ease, border-color .16s ease;
}
.theme-toggle:hover,
.power-btn:hover{ background:rgba(255,255,255,.18); transform:translateY(-1px); }
.theme-dot{
  width:14px;
  height:14px;
  border-radius:999px;
  background:linear-gradient(135deg, #fff, #f6c343);
  box-shadow:0 0 0 3px rgba(255,255,255,.16);
}
html[data-theme="dark"] .theme-dot{ background:linear-gradient(135deg, #9ad7ff, #0b1b28); }
.power-form{ margin:0; }
.power-btn-danger{
  background:rgba(220,38,38,.20);
  border-color:rgba(255,255,255,.24);
}
.power-btn-danger:hover{ background:rgba(220,38,38,.34); }

.app-main{
  width:min(100%, 1600px);
  margin:0 auto;
  padding:20px;
}

.card{
  background:color-mix(in srgb, var(--surface) 94%, transparent);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px;
  box-shadow:var(--shadow-soft);
  margin-bottom:16px;
  backdrop-filter:blur(10px);
}

.card:hover{ box-shadow:var(--shadow); }
.hero{
  background:
    linear-gradient(135deg, rgba(0,80,130,.12), rgba(14,165,183,.08)),
    var(--surface);
  border-color:color-mix(in srgb, var(--brand) 22%, var(--border));
}
.flash-message{ padding:12px 14px; animation:softPop .18s ease-out; }

.grid{
  display:grid;
  gap:16px;
  grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));
}

h1,h2,h3,h4{ color:var(--text); letter-spacing:0; }
h2{ font-size:24px; }
h3{ font-size:18px; }
.small{ font-size:12px; color:var(--muted); }

label{
  display:block;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
  font-weight:700;
}

input, select, textarea{
  width:100%;
  padding:10px 11px;
  border-radius:9px;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text);
  outline:none;
  transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:focus, select:focus, textarea:focus{
  border-color:var(--brand-3);
  box-shadow:var(--ring);
}
input::placeholder, textarea::placeholder{ color:color-mix(in srgb, var(--muted) 70%, transparent); }

button,
.btn-primary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid color-mix(in srgb, var(--brand) 70%, #fff);
  background:linear-gradient(135deg, var(--brand), var(--brand-2));
  color:#fff;
  cursor:pointer;
  font-weight:800;
  transition:transform .15s ease, box-shadow .15s ease, filter .15s ease;
  box-shadow:0 8px 18px rgba(0,80,130,.18);
  text-decoration:none;
}
button:hover,
.btn-primary:hover{ transform:translateY(-1px); filter:brightness(1.02); }
button:active,
.btn-primary:active{ transform:translateY(0); }

.btn-secondary,
a.btn-secondary{
  display:inline-block;
  padding:9px 11px;
  border-radius:10px;
  background:var(--surface-2);
  color:var(--text);
  border:1px solid var(--border);
  text-decoration:none;
  font-weight:800;
  box-shadow:none;
}
.btn-secondary:visited,
a.btn-secondary:visited{ color:var(--text); }
.btn-secondary:hover,
a.btn-secondary:hover{
  background:var(--surface-3);
  transform:translateY(-1px);
}

.btn-danger{
  background:color-mix(in srgb, var(--danger) 12%, var(--surface));
  border:1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
  color:#991b1b;
  padding:7px 10px;
  border-radius:10px;
  cursor:pointer;
  font-weight:800;
}
html[data-theme="dark"] .btn-danger{ color:#fecaca; }
.btn-danger:hover{ background:color-mix(in srgb, var(--danger) 20%, var(--surface)); }

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  background:var(--surface);
  border-radius:var(--radius);
  overflow:visible;
}
th, td{
  padding:9px 11px;
  border-bottom:1px solid var(--border);
  text-align:left;
  color:var(--text);
}
th{
  background:var(--surface-2);
  color:var(--muted);
  font-size:12px;
  text-transform:none;
  position:sticky;
  top:0;
  z-index:1;
}
tbody tr{ transition:background .12s ease; }
tbody tr:hover td{ background:color-mix(in srgb, var(--brand-3) 7%, transparent); }

table.dataTable thead th,
table.dataTable thead td{
  position:sticky !important;
  top:0;
  z-index:5;
  background:var(--surface-2) !important;
}
table.dataTable thead tr.filters th,
table.dataTable thead tr.filters td{
  top:var(--dt-head-h, 44px) !important;
  z-index:6;
  background:var(--surface-2) !important;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_processing,
.dataTables_wrapper .dataTables_paginate{ color:var(--muted) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button{
  color:var(--text) !important;
  border-radius:8px !important;
  border:1px solid transparent !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current{
  color:#fff !important;
  background:linear-gradient(135deg, var(--brand), var(--brand-2)) !important;
  border-color:transparent !important;
}
.dataTables_wrapper .dt-bottom{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px 16px;
  flex-wrap:wrap;
  margin-top:12px;
  padding-top:10px;
  border-top:1px solid var(--border);
}
.dataTables_wrapper .dt-bottom .dataTables_length,
.dataTables_wrapper .dt-bottom .dataTables_info,
.dataTables_wrapper .dt-bottom .dataTables_paginate{
  float:none !important;
  margin:0 !important;
  padding:0 !important;
}
.dataTables_wrapper .dt-bottom .dataTables_info{
  margin-right:auto !important;
}
.dataTables_wrapper .dataTables_filter{
  display:none !important;
}
.dataTables_wrapper .dataTables_length label{
  display:flex;
  align-items:center;
  gap:6px;
}
.dataTables_wrapper .dataTables_length select{
  width:auto;
  min-width:76px;
  height:32px;
  padding:3px 8px;
}
.dt-stabilize{
  visibility:hidden;
}
.dt-stabilize.dt-ready{
  visibility:visible;
}

.date-range-picker{
  position:relative;
  min-width:260px;
}
.date-range-picker input[type="hidden"]{
  display:none;
}
.date-range-trigger{
  width:100%;
  min-height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:8px 12px;
  border:1px solid var(--border-strong);
  border-radius:8px;
  background:var(--surface);
  color:var(--text);
  font-weight:760;
  cursor:pointer;
}
.date-range-trigger:hover{
  border-color:var(--brand-2);
}
.date-range-label{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.date-range-popover{
  display:none;
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  z-index:9000;
  width:min(330px, calc(100vw - 32px));
  padding:12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface);
  color:var(--text);
  box-shadow:0 18px 42px rgba(0,0,0,.24);
}
.date-range-picker.open .date-range-popover{
  display:block;
}
.date-range-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:10px;
}
.date-range-month{
  font-weight:850;
  text-align:center;
}
.date-range-nav{
  width:32px;
  height:32px;
  display:inline-grid;
  place-items:center;
  padding:0;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface-2);
  color:var(--text);
  cursor:pointer;
}
.date-range-grid{
  display:grid;
  grid-template-columns:repeat(7, 1fr);
  gap:4px;
}
.date-range-weekday{
  color:var(--muted);
  font-size:11px;
  font-weight:850;
  text-align:center;
  padding:4px 0;
}
.date-range-day{
  height:34px;
  border:1px solid transparent;
  border-radius:8px;
  background:transparent;
  color:var(--text);
  cursor:pointer;
  font-weight:760;
}
.date-range-day:hover{
  border-color:var(--brand-2);
}
.date-range-day.is-muted{
  opacity:.35;
}
.date-range-day.is-in-range{
  background:color-mix(in srgb, var(--brand-2) 12%, var(--surface));
}
.date-range-day.is-selected{
  background:var(--brand-2);
  border-color:var(--brand-2);
  color:#fff;
}
.date-range-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-top:10px;
  flex-wrap:wrap;
}
.date-range-help{
  color:var(--muted);
  font-size:12px;
  min-height:16px;
}
.date-range-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.date-range-actions button{
  min-height:30px;
  padding:5px 9px;
  border-radius:8px;
}
.date-range-trigger svg{
  width:18px !important;
  height:18px !important;
  flex:0 0 18px;
}

.period-filter{
  display:flex;
  align-items:flex-end;
  gap:8px;
  flex-wrap:wrap;
  position:relative;
  z-index:35;
}
.period-filter-field{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin:0;
}
.period-filter-field select{
  height:38px;
  padding:7px 10px;
  border:1px solid var(--border-strong);
  border-radius:8px;
  background:var(--surface);
  color:var(--text);
  box-sizing:border-box;
}
.period-filter-field[data-period-year-field] select{ width:96px; }
.period-filter-field[data-period-month-field] select{ width:144px; }
.period-filter-field[data-period-day-field] select{ width:98px; }
.period-filter-icon-btn{
  width:38px;
  height:38px;
  display:inline-grid;
  place-items:center;
  padding:0 !important;
  border:1px solid var(--border-strong);
  border-radius:8px;
  background:var(--surface);
  color:var(--text);
  cursor:pointer;
}
.period-filter-icon-btn svg{
  width:18px !important;
  height:18px !important;
  display:block;
}
.period-filter-summary{
  min-width:178px;
  max-width:220px;
  min-height:38px;
  height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface-2);
  color:var(--muted);
  font-weight:780;
  box-sizing:border-box;
  cursor:pointer;
  line-height:1;
  text-align:left;
}
.period-filter-summary svg{
  width:16px !important;
  height:16px !important;
  flex:0 0 16px;
}
.period-filter-popover{
  display:none;
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  z-index:99990;
  width:min(360px, calc(100vw - 32px));
  padding:12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface);
  color:var(--text);
  box-shadow:0 20px 48px rgba(0,0,0,.28);
}
.period-filter.open .period-filter-popover{
  display:block;
}
.period-filter-popover-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.period-filter-popover label{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin:0;
}
.period-filter-popover input[type="date"]{
  height:38px;
  padding:7px 9px;
  border:1px solid var(--border-strong);
  border-radius:8px;
  background:var(--surface);
  color:var(--text);
}
.period-filter-popover-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:12px;
}
.period-filter-popover-actions button,
.period-filter-popover-actions .btn-secondary{
  min-height:34px;
  padding:7px 10px !important;
}
.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button{
  -webkit-appearance:none;
  margin:0;
}
.no-spinner{
  appearance:textfield;
  -moz-appearance:textfield;
}

.badge{
  display:inline-block;
  padding:3px 8px;
  border-radius:999px;
  background:var(--surface-3);
  color:var(--text);
  border:1px solid var(--border);
  font-weight:800;
}
.img-thumb{
  width:44px;
  height:44px;
  object-fit:cover;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--surface-2);
}
.img-thumb-lg{ width:88px; height:88px; }
.photo-placeholder{
  width:44px;
  height:44px;
  flex:0 0 44px;
  display:inline-grid;
  place-items:center;
  box-sizing:border-box;
  border:1px dashed var(--border);
  border-radius:10px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface-2) 84%, transparent), var(--surface));
  color:var(--muted);
  user-select:none;
  overflow:hidden;
  position:relative;
}
.photo-placeholder::before{
  content:"";
  display:block;
  width:20px;
  height:16px;
  box-sizing:border-box;
  border:1.5px solid color-mix(in srgb, var(--muted) 50%, transparent);
  border-radius:4px;
  opacity:.78;
  background:
    radial-gradient(circle at 5px 5px, color-mix(in srgb, var(--muted) 58%, transparent) 0 2px, transparent 2.3px),
    linear-gradient(135deg, transparent 50%, color-mix(in srgb, var(--muted) 48%, transparent) 51% 57%, transparent 58%),
    linear-gradient(45deg, transparent 54%, color-mix(in srgb, var(--muted) 38%, transparent) 55% 61%, transparent 62%);
}
.photo-placeholder::after{ content:""; display:none; }
.photo-placeholder.photo-28{ width:28px; height:28px; flex-basis:28px; border-radius:7px; }
.photo-placeholder.photo-28::before{ width:15px; height:12px; border-radius:3px; }
.photo-placeholder.photo-32{ width:32px; height:32px; flex-basis:32px; border-radius:7px; }
.photo-placeholder.photo-32::before{ width:17px; height:13px; border-radius:3px; }
.photo-placeholder.photo-34{ width:34px; height:34px; flex-basis:34px; border-radius:7px; }
.photo-placeholder.photo-36{ width:36px; height:36px; flex-basis:36px; border-radius:7px; }
.photo-placeholder.photo-38{ width:38px; height:38px; flex-basis:38px; border-radius:8px; }
.photo-placeholder.photo-42{ width:42px; height:42px; flex-basis:42px; border-radius:8px; }
.photo-placeholder.photo-44{ width:44px; height:44px; flex-basis:44px; }
.photo-placeholder.photo-200{ width:200px; height:200px; flex-basis:200px; border-radius:12px; }
.photo-placeholder.photo-200::before{ width:58px; height:44px; border-radius:8px; border-width:2px; }
.photo-placeholder.has-image::before,
.photo-placeholder.has-image::after{ content:""; display:none; }

tr.month-sep td{
  background:var(--surface-2);
  font-weight:800;
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border);
}

.drop{
  border:2px dashed var(--border-strong);
  border-radius:var(--radius);
  padding:14px;
  text-align:center;
  background:var(--surface-2);
}
.drop.dragover{
  background:color-mix(in srgb, var(--brand-3) 14%, var(--surface));
  border-color:var(--brand-3);
}

.inline-form{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.inline-form input[type="number"],
.inline-form input[type="text"]{ max-width:170px; }
.inline-form button{ padding:8px 10px; border-radius:10px; }

.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(3,12,20,.62);
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:50;
  backdrop-filter:blur(4px);
}
.modal-backdrop.open{ display:flex; }
.modal-content{
  background:var(--surface);
  border:1px solid var(--border);
  color:var(--text);
  border-radius:14px;
  padding:12px;
  max-width:92vw;
  max-height:92vh;
  box-shadow:0 24px 60px rgba(0,0,0,.36);
  animation:softPop .16s ease-out;
}
.modal-content img{
  max-width:90vw;
  max-height:88vh;
  display:block;
  border-radius:12px;
}

.suggest-wrap{ position:relative; }
.suggest-box,
.suggestions{
  background:var(--surface) !important;
  color:var(--text);
  border:1px solid var(--border) !important;
  border-radius:12px !important;
  box-shadow:0 18px 36px rgba(0,42,74,.16) !important;
}
.suggest-box a{ color:var(--text); text-decoration:none; display:inline-block; padding:6px 8px; border-radius:9px; width:100%; }
.suggest-box a:hover{ background:var(--surface-2); }

.form-row{ display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
.form-row > div{ flex:1 1 260px; }
.form-row .rate{ flex:0 1 280px; }
.form-row .actions{ flex:0 0 auto; }

.form-grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:16px;
  align-items:stretch;
}
.form-grid > div{ display:flex; flex-direction:column; justify-content:flex-start; }

.home-hero{
  display:grid;
  grid-template-columns:minmax(260px, 380px) 1fr;
  gap:28px;
  align-items:center;
  padding:28px;
  overflow:hidden;
}
.home-logo-panel{
  min-height:220px;
  display:grid;
  place-items:center;
  border-radius:18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,255,255,.04)),
    linear-gradient(135deg, #005082, #0b6fb3);
  border:1px solid rgba(255,255,255,.18);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.18), 0 18px 36px rgba(0,80,130,.22);
}
.home-logo{
  max-width:250px;
  width:78%;
  height:auto;
  display:block;
  margin:0;
  filter:drop-shadow(0 12px 22px rgba(0,0,0,.20));
}
.home-logo-center{ margin-left:auto; margin-right:auto; }
.home-eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background:var(--surface-2);
  color:var(--muted);
  font-weight:800;
  font-size:12px;
  border:1px solid var(--border);
}
.home-title{
  margin:14px 0 8px;
  font-size:34px;
  line-height:1.05;
}
.home-subtitle{
  max-width:700px;
  font-size:15px;
  line-height:1.55;
}
.home-actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:18px; }
.module-card{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height:170px;
  margin-bottom:0;
  transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.module-card:hover{
  transform:translateY(-2px);
  border-color:color-mix(in srgb, var(--brand-3) 35%, var(--border));
}
.module-kicker{ color:var(--brand-2); font-size:12px; font-weight:900; text-transform:uppercase; }
.module-card p{ flex:1; margin:0; line-height:1.45; }
.module-actions{ display:flex; gap:10px; margin-top:auto; flex-wrap:wrap; align-items:center; }

.neg{ color:#b91c1c; font-weight:800; }
html[data-theme="dark"] .neg{ color:#fca5a5; }
.locked,
.locked-display{
  background:var(--surface-2) !important;
  color:var(--text) !important;
}
.locked-display:focus{ outline:none; box-shadow:none; }

.qty-over{
  color:#b42318;
  border-color:#fda29b;
  background:#fffbfa;
  font-weight:800;
}
html[data-theme="dark"] .qty-over{
  color:#fecaca;
  background:rgba(127,29,29,.34);
}

.locked-meta{
  opacity:.85;
  margin-top:4px;
  user-select:none;
  pointer-events:none;
}

.money-wrap,
.pct-wrap{ position:relative; }
.money-wrap::before,
.pct-wrap::before{
  position:absolute;
  left:10px;
  top:50%;
  transform:translateY(-58%);
  color:var(--muted);
  opacity:.9;
  font-family:inherit;
  font-size:inherit;
  font-weight:500;
  line-height:1;
  pointer-events:none;
}
.money-wrap::before{ content:"R$"; }
.pct-wrap::before{ content:"%"; }
.money-wrap .money-input{ padding-left:38px; }
.pct-wrap .pct-input{ padding-left:28px; width:100%; max-width:100%; box-sizing:border-box; }

.product-cell{ position:relative; z-index:10; display:flex; align-items:center; gap:8px; }
.product-input-wrap{ overflow:visible; }
.product-input-wrap .suggestions{ z-index:99999 !important; }
.clearable-input{ position:relative; }
.clearable-input .product-name{ width:100%; box-sizing:border-box; padding-right:28px; }
.clearable-input .clear-btn{
  position:absolute;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  width:18px;
  height:18px;
  border:0;
  border-radius:999px;
  background:transparent;
  color:var(--muted);
  cursor:pointer;
  padding:0;
  line-height:18px;
  font-size:16px;
  box-shadow:none;
}
.clearable-input .clear-btn:hover{ background:var(--surface-3); color:var(--text); }

.thumb-slot{
  width:34px;
  height:34px;
  flex:0 0 34px;
  border-radius:8px;
  border:1px solid var(--border);
  background:var(--surface-2);
  overflow:hidden;
  position:relative;
}
.thumb-slot .thumb-img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  opacity:0;
  transition:opacity .12s ease;
}
.thumb-slot.thumb-empty::after{
  content:"x";
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  font-size:15px;
  line-height:1;
  font-weight:800;
  opacity:.8;
  user-select:none;
  pointer-events:none;
}

#itemsTable td,
#itemsTable th{ vertical-align:top; }
.field label{ height:18px; display:flex; align-items:center; }

.balance-form{ display:flex; flex-direction:column; gap:10px; }
.balance-actions{ display:flex; justify-content:flex-end; }
.money-input{ width:160px; max-width:100%; }
.profit-row{ display:flex; align-items:center; gap:12px; justify-content:flex-start; }
.profit-row > button{ white-space:nowrap; }
.seed-table th:first-child,
.seed-table td:first-child{ width:35%; }
.seed-table th:last-child,
.seed-table td:last-child{ width:65%; }
.seed-table input[type="number"]{ max-width:220px; }

.move-grid,
.adjust-grid{
  display:grid;
  gap:12px;
  align-items:end;
  max-width:950px;
  margin-right:auto;
}
.move-grid{
  grid-template-columns:minmax(360px, 1fr) 130px 220px 220px;
}
.move-grid .move-comment{ grid-column:1 / span 2; }
.move-grid .move-btn{ grid-column:3; justify-self:start; }
.adjust-grid{
  grid-template-columns:minmax(360px, 1fr) 220px 160px 170px;
}
.adjust-grid .adjust-comment{ grid-column:1 / span 2; }
.adjust-grid .adjust-btn{ grid-column:3; justify-self:start; }

html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background:#fff"]{
  background:var(--surface-2) !important;
}
html[data-theme="dark"] [style*="color:#334155"],
html[data-theme="dark"] [style*="color: #334155"],
html[data-theme="dark"] [style*="color:#64748b"],
html[data-theme="dark"] [style*="color: #64748b"]{
  color:var(--muted) !important;
}
html[data-theme="dark"] [style*="border:1px solid #e2e8f0"],
html[data-theme="dark"] [style*="border: 1px solid #e2e8f0"]{
  border-color:var(--border) !important;
}

@keyframes softPop{
  from{ opacity:0; transform:translateY(4px) scale(.99); }
  to{ opacity:1; transform:translateY(0) scale(1); }
}

@media (max-width:1100px){
  .app-header-inner{ flex-wrap:wrap; }
  .main-nav{ order:3; flex-basis:100%; }
  .home-hero{ grid-template-columns:1fr; }
  .move-grid,
  .adjust-grid{ grid-template-columns:1fr 1fr; }
  .move-grid .move-comment,
  .adjust-grid .adjust-comment{ grid-column:1 / span 2; }
  .move-grid .move-btn,
  .adjust-grid .adjust-btn{ grid-column:1; }
  .form-grid{ grid-template-columns:repeat(2, minmax(220px, 1fr)); }
}

@media (max-width:650px){
  .app-main{ padding:14px; }
  .app-header{ padding:10px 12px; }
  .brand-link{ min-width:0; }
  .brand-caption{ display:none; }
  .header-actions{ width:100%; justify-content:flex-end; }
  .home-title{ font-size:27px; }
  .home-hero{ padding:18px; }
  .home-logo-panel{ min-height:170px; }
  .form-grid,
  .move-grid,
  .adjust-grid{ grid-template-columns:1fr; }
  .move-grid .move-comment,
  .adjust-grid .adjust-comment,
  .move-grid .move-btn,
  .adjust-grid .adjust-btn{ grid-column:auto; }
}

/* ===== Mundo Shiny v6.2: app shell mais moderno ===== */
body{
  background:
    radial-gradient(circle at 8% 0%, rgba(14,165,183,.20), transparent 30rem),
    radial-gradient(circle at 92% 12%, rgba(246,195,67,.16), transparent 22rem),
    linear-gradient(135deg, var(--bg-2), var(--bg));
}

.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:248px minmax(0, 1fr);
}

.app-sidebar{
  position:sticky;
  top:0;
  height:100vh;
  display:flex;
  flex-direction:column;
  padding:16px 12px;
  color:#fff;
  background:
    linear-gradient(180deg, rgba(0,80,130,.98), rgba(6,50,78,.98)),
    radial-gradient(circle at 30% 0%, rgba(255,255,255,.18), transparent 18rem);
  border-right:1px solid rgba(255,255,255,.12);
  box-shadow:10px 0 34px rgba(0,42,74,.20);
  z-index:30;
}

.sidebar-brand{
  display:flex;
  align-items:center;
  gap:11px;
  padding:10px 10px 16px;
  color:#fff;
  text-decoration:none;
  border-bottom:1px solid rgba(255,255,255,.14);
  margin-bottom:12px;
}
.sidebar-brand:visited{ color:#fff; }
.sidebar-brand-mark{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border-radius:12px;
  background:linear-gradient(135deg, rgba(255,255,255,.24), rgba(255,255,255,.08));
  border:1px solid rgba(255,255,255,.22);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.24);
}
.sidebar-brand-mark img{ width:26px; height:26px; display:block; }
.sidebar-brand-title{ display:block; font-weight:900; letter-spacing:.1px; line-height:1; }
.sidebar-brand-subtitle{ display:block; margin-top:4px; color:rgba(255,255,255,.72); font-size:11px; font-weight:700; }

.side-nav{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:2px 4px;
}
.side-nav-group{
  margin:14px 8px 6px;
  color:rgba(255,255,255,.52);
  font-size:11px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.side-nav a{
  display:flex;
  align-items:center;
  gap:10px;
  color:rgba(255,255,255,.82);
  text-decoration:none;
  padding:9px 10px;
  border-radius:10px;
  font-weight:800;
  transition:background .15s ease, color .15s ease, transform .15s ease;
}
.side-nav a:visited{ color:rgba(255,255,255,.82); }
.side-nav a:hover{
  color:#fff;
  background:rgba(255,255,255,.10);
  transform:translateX(2px);
}
.side-nav a.active{
  color:#08324d;
  background:linear-gradient(135deg, #fff, #e9f7fc);
  box-shadow:0 12px 24px rgba(0,0,0,.18);
}
.nav-glyph{
  width:26px;
  height:26px;
  display:grid;
  place-items:center;
  border-radius:8px;
  background:rgba(255,255,255,.12);
  color:#fff;
  font-size:12px;
  font-weight:900;
  flex:0 0 auto;
}
.side-nav a.active .nav-glyph{
  color:#fff;
  background:linear-gradient(135deg, var(--brand), var(--brand-3));
}

.sidebar-footer{
  margin-top:auto;
  display:grid;
  gap:8px;
  padding:12px 4px 2px;
}
.sidebar-footer .theme-toggle,
.sidebar-footer .power-btn{
  width:100%;
  height:38px;
  justify-content:flex-start;
  border-color:rgba(255,255,255,.18);
  background:rgba(255,255,255,.09);
}
.sidebar-footer .power-btn{ justify-content:center; }

.app-content-shell{
  min-width:0;
  display:flex;
  flex-direction:column;
}

.workspace-topbar{
  position:sticky;
  top:0;
  z-index:25;
  min-height:68px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 22px;
  background:color-mix(in srgb, var(--bg-2) 86%, transparent);
  border-bottom:1px solid var(--border);
  backdrop-filter:blur(16px);
}
.workspace-kicker{
  color:var(--muted);
  font-size:11px;
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.workspace-title{
  color:var(--text);
  font-size:22px;
  font-weight:900;
  line-height:1.15;
}
.workspace-actions{ display:flex; align-items:center; gap:8px; }
.quick-sale{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:38px;
  padding:0 13px;
  border-radius:10px;
  color:#fff;
  text-decoration:none;
  font-weight:900;
  background:linear-gradient(135deg, var(--brand), var(--brand-3));
  box-shadow:0 10px 22px rgba(0,80,130,.22);
}
.quick-sale:visited{ color:#fff; }
.quick-sale span{
  display:inline-grid;
  place-items:center;
  height:22px;
  min-width:28px;
  padding:0 6px;
  border-radius:7px;
  background:rgba(255,255,255,.18);
  font-size:11px;
}

.app-main{
  width:100%;
  max-width:none;
  margin:0;
  padding:18px 22px 30px;
}

.card{
  border-radius:10px;
  padding:15px;
  box-shadow:0 1px 0 rgba(255,255,255,.45) inset, var(--shadow-soft);
}
.card:hover{ transform:none; }

table{
  border:1px solid var(--border);
  border-radius:10px;
}
th{
  font-size:11px;
  letter-spacing:.02em;
  color:var(--muted);
}
td{ font-size:13px; }
th, td{ padding:8px 10px; }

button,
.btn-primary,
.btn-secondary,
a.btn-secondary{
  border-radius:8px;
}

.home-hero{
  grid-template-columns:minmax(280px, 420px) minmax(0, 1fr);
  min-height:300px;
  background:
    linear-gradient(135deg, rgba(0,80,130,.12), rgba(14,165,183,.08)),
    linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface-2) 55%, var(--surface)));
}
.home-logo-panel{
  min-height:245px;
  border-radius:16px;
  transform:rotate(-1deg);
}
.home-logo-panel img{ transform:rotate(1deg); }
.home-title{ font-size:40px; max-width:720px; }
.module-card{
  position:relative;
  overflow:hidden;
  min-height:176px;
}
.module-card::before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  width:4px;
  background:linear-gradient(180deg, var(--brand), var(--brand-3));
  opacity:.88;
}
.module-card > *{ position:relative; }
.module-kicker{
  color:var(--muted);
  letter-spacing:.08em;
}

@media (max-width:1050px){
  .app-shell{ grid-template-columns:1fr; }
  .app-sidebar{
    position:relative;
    height:auto;
    padding:10px;
  }
  .sidebar-brand{ padding:8px 8px 10px; margin-bottom:8px; }
  .side-nav{
    display:grid;
    grid-template-columns:repeat(auto-fit, minmax(130px, 1fr));
  }
  .side-nav-group{ display:none; }
  .sidebar-footer{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
  }
  .sidebar-footer .theme-toggle,
  .sidebar-footer .power-btn{ width:auto; }
  .workspace-topbar{ top:0; }
}

@media (max-width:650px){
  .workspace-topbar{
    align-items:flex-start;
    flex-direction:column;
    padding:12px 14px;
  }
  .app-main{ padding:14px; }
  .home-hero{ grid-template-columns:1fr; min-height:0; }
  .home-title{ font-size:30px; }
}

/* ===== v6.3: polimento clean, icones e correcoes de sobreposicao ===== */
:root{
  --button-shadow:0 1px 2px rgba(15,23,42,.08);
  --button-shadow-hover:0 8px 18px rgba(0,80,130,.14);
  --z-float:12000;
  --z-modal:14000;
}

body{
  background:
    linear-gradient(115deg, rgba(0,80,130,.10), transparent 36%),
    linear-gradient(245deg, rgba(14,165,183,.08), transparent 34%),
    linear-gradient(135deg, #f7fafc, var(--bg));
}

html[data-theme="dark"] body{
  background:
    linear-gradient(115deg, rgba(14,165,183,.12), transparent 38%),
    linear-gradient(245deg, rgba(246,195,67,.06), transparent 34%),
    linear-gradient(135deg, #07131d, #0a1722);
}

.app-shell{ grid-template-columns:236px minmax(0, 1fr); }

.app-sidebar{
  color:var(--text);
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(246,250,252,.88)),
    linear-gradient(135deg, rgba(0,80,130,.06), transparent 55%);
  border-right:1px solid var(--border);
  box-shadow:8px 0 28px rgba(0,42,74,.08);
}

html[data-theme="dark"] .app-sidebar{
  color:var(--text);
  background:
    linear-gradient(180deg, rgba(14,31,45,.96), rgba(11,27,40,.94)),
    linear-gradient(135deg, rgba(14,165,183,.08), transparent 55%);
  border-right-color:var(--border);
}

.sidebar-brand{
  color:var(--text);
  border-bottom-color:var(--border);
}
.sidebar-brand:visited{ color:var(--text); }
.sidebar-brand-mark{
  background:linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color:rgba(255,255,255,.22);
}
.sidebar-brand-title{ font-weight:750; }
.sidebar-brand-subtitle{ color:var(--muted); font-weight:600; }

.side-nav-group{
  color:var(--muted);
  font-size:10px;
  font-weight:700;
}

.side-nav a{
  color:var(--muted);
  font-weight:620;
  padding:8px 9px;
  border:1px solid transparent;
}
.side-nav a:visited{ color:var(--muted); }
.side-nav a:hover{
  color:var(--text);
  background:var(--surface);
  border-color:var(--border);
  transform:translateX(1px);
  box-shadow:var(--button-shadow);
}
.side-nav a.active{
  color:var(--brand);
  background:color-mix(in srgb, var(--brand) 9%, var(--surface));
  border-color:color-mix(in srgb, var(--brand) 18%, var(--border));
  box-shadow:none;
}

.nav-icon{
  width:28px;
  height:28px;
  display:grid;
  place-items:center;
  border-radius:8px;
  background:var(--surface-2);
  color:var(--muted);
  flex:0 0 auto;
  transition:background .15s ease, color .15s ease;
}
.nav-icon::before{
  content:attr(data-fallback);
  font-size:11px;
  font-weight:750;
  line-height:1;
}
.nav-icon:has(svg)::before{ display:none; }
.nav-icon svg,
.module-icon svg,
.inline-icon,
.quick-sale svg,
.power-btn svg,
.theme-dot svg{ width:16px; height:16px; display:block; }
.inline-icon{
  display:inline-block;
  vertical-align:-3px;
  flex:0 0 auto;
}
.nav-sales{ color:#0891b2; background:rgba(8,145,178,.10); }
.nav-stock{ color:#0f766e; background:rgba(15,118,110,.11); }
.nav-products{ color:#7c3aed; background:rgba(124,58,237,.10); }
.nav-catalog{ color:#0891b2; background:rgba(8,145,178,.10); }
.nav-users{ color:#2563eb; background:rgba(37,99,235,.10); }
.nav-purchases{ color:#b77905; background:rgba(202,138,4,.12); }
.nav-closing{ color:#2563eb; background:rgba(37,99,235,.10); }
.nav-balance{ color:#16a34a; background:rgba(22,163,74,.10); }
.nav-investors{ color:#db2777; background:rgba(219,39,119,.10); }
.nav-movements{ color:#0d9488; background:rgba(13,148,136,.12); }
.nav-settlements{ color:#dc2626; background:rgba(220,38,38,.10); }
.side-nav a.active .nav-icon{ color:#fff; }
.side-nav a:hover .nav-icon{ filter:saturate(1.1); }
.side-nav a.active:hover .nav-icon{ color:#fff; }
.side-nav a.active .nav-sales{ background:#0891b2; }
.side-nav a.active .nav-stock{ background:#0f766e; }
.side-nav a.active .nav-products{ background:#7c3aed; }
.side-nav a.active .nav-catalog{ background:#0891b2; }
.side-nav a.active .nav-users{ background:#2563eb; }
.side-nav a.active .nav-purchases{ background:#ca8a04; }
.side-nav a.active .nav-closing{ background:#2563eb; }
.side-nav a.active .nav-balance{ background:#16a34a; }
.side-nav a.active .nav-investors{ background:#db2777; }
.side-nav a.active .nav-movements{ background:#0d9488; }
.side-nav a.active .nav-settlements{ background:#dc2626; }

.sidebar-footer .theme-toggle,
.sidebar-footer .power-btn{
  color:var(--text);
  border-color:var(--border);
  background:var(--surface);
  font-weight:620;
  box-shadow:var(--button-shadow);
}
.sidebar-footer .theme-toggle:hover,
.sidebar-footer .power-btn:hover{
  background:var(--surface-2);
  transform:translateY(-1px);
}
.sidebar-footer .power-btn-danger{
  color:#991b1b;
  background:color-mix(in srgb, var(--danger) 8%, var(--surface));
  border-color:color-mix(in srgb, var(--danger) 18%, var(--border));
}
html[data-theme="dark"] .sidebar-footer .power-btn-danger{ color:#fecaca; }

.theme-dot{
  display:grid;
  place-items:center;
  width:22px;
  height:22px;
  background:color-mix(in srgb, var(--accent) 16%, var(--surface));
  color:#b45309;
  box-shadow:none;
}
html[data-theme="dark"] .theme-dot{
  background:color-mix(in srgb, var(--brand-3) 18%, var(--surface));
  color:#7dd3fc;
}

.workspace-topbar{
  min-height:62px;
  background:color-mix(in srgb, var(--bg-2) 82%, transparent);
  z-index:80;
}
.workspace-kicker{ font-weight:650; }
.workspace-title{ font-weight:720; font-size:20px; }

.quick-sale{
  min-height:36px;
  color:#fff;
  font-weight:680;
  border:1px solid color-mix(in srgb, var(--brand-3) 28%, var(--brand));
  background:linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand-2) 76%, var(--brand-3)));
  box-shadow:var(--button-shadow-hover);
}
.quick-sale:hover{
  color:#fff;
  filter:brightness(1.04);
  transform:translateY(-1px);
}
.keycap{
  min-width:24px;
  height:20px;
  padding:0 6px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:6px;
  font-size:11px;
  font-weight:700;
  color:color-mix(in srgb, var(--brand) 78%, #001827);
  background:rgba(255,255,255,.74);
}
.quick-sale .keycap{
  min-width:24px;
  height:20px;
  border-radius:6px;
  background:rgba(255,255,255,.74);
  color:color-mix(in srgb, var(--brand) 78%, #001827);
  font-weight:700;
}

h1,h2,h3,h4{ font-weight:720; }
.home-title{ font-weight:720; }
.module-card h3{ margin:0; font-weight:700; }
.module-head{
  display:flex;
  align-items:center;
  gap:11px;
}
.module-icon{
  width:38px;
  height:38px;
  display:grid;
  place-items:center;
  flex:0 0 auto;
  border-radius:10px;
  color:var(--brand);
  background:color-mix(in srgb, var(--brand-3) 12%, var(--surface));
  border:1px solid color-mix(in srgb, var(--brand-3) 18%, var(--border));
}
.module-card:hover .module-icon{ transform:translateY(-1px); }
.module-icon.module-sales{ color:#0891b2; background:rgba(8,145,178,.10); border-color:rgba(8,145,178,.18); }
.module-icon.module-stock{ color:#0f766e; background:rgba(15,118,110,.10); border-color:rgba(15,118,110,.18); }
.module-icon.module-purchases{ color:#b77905; background:rgba(202,138,4,.12); border-color:rgba(202,138,4,.20); }
.module-icon.module-investors{ color:#db2777; background:rgba(219,39,119,.10); border-color:rgba(219,39,119,.18); }
.module-icon.module-catalog{ color:#0891b2; background:rgba(8,145,178,.10); border-color:rgba(8,145,178,.18); }
.module-icon svg{ color:currentColor; }

.pending-repass-alert{
  border-color:rgba(202,138,4,.36);
  background:color-mix(in srgb, #f6c343 8%, var(--surface));
}
.pending-repass-head{
  display:flex;
  align-items:flex-start;
  gap:10px;
}
.pending-repass-head h3{ margin:0; }
.pending-repass-head p{ margin:4px 0 0; color:var(--muted); }
.pending-repass-list{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:12px;
}
.pending-repass-item{
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:34px;
  padding:7px 10px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--surface);
  text-decoration:none;
}
.pending-repass-item b{ color:var(--danger); }
html[data-theme="dark"] .pending-repass-alert{
  background:rgba(120,75,8,.24);
  border-color:rgba(246,195,67,.28);
}

.investor-home-hero{
  display:block !important;
  grid-template-columns:1fr !important;
  min-height:0 !important;
  max-width:580px;
  padding:20px !important;
}
.investor-home-hero .home-title{
  max-width:420px;
  font-size:30px;
}
.investor-home-hero .home-subtitle{ max-width:460px; }
.investor-home-grid{
  grid-template-columns:minmax(0, 760px);
  align-items:start;
}
.investor-contact-card,
.investor-kpi-card{
  min-height:0 !important;
}
.investor-contact-card p{ flex:0; }
.investor-kpi-grid{
  grid-template-columns:repeat(auto-fit, minmax(210px, 1fr));
}

button,
.btn-primary{
  min-height:34px;
  padding:8px 11px;
  border-radius:8px;
  font-weight:650;
  box-shadow:var(--button-shadow);
}
button:hover,
.btn-primary:hover{
  box-shadow:var(--button-shadow-hover);
}

.btn-primary,
button[type="submit"]:not(.btn-secondary):not(.btn-danger){
  color:#fff !important;
  border-color:color-mix(in srgb, var(--brand-2) 72%, var(--brand)) !important;
  background:linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand-2) 76%, var(--brand-3))) !important;
  font-weight:650 !important;
}

button[type="button"]:not(.btn-primary):not(.btn-secondary):not(.btn-danger):not(.payment-option):not(#paymentConfirm):not(.clear-btn){
  color:var(--text) !important;
  background:var(--surface) !important;
  border-color:var(--border) !important;
  font-weight:620 !important;
}

#paymentConfirm{
  color:#fff !important;
  border:1px solid color-mix(in srgb, var(--brand-2) 72%, var(--brand)) !important;
  background:linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand-2) 76%, var(--brand-3))) !important;
  font-weight:650 !important;
}
.btn-success-soft{
  color:#047857 !important;
  background:color-mix(in srgb, var(--success) 10%, var(--surface)) !important;
  border:1px solid color-mix(in srgb, var(--success) 28%, var(--border)) !important;
  font-weight:620 !important;
}
.btn-success-soft:hover{
  background:color-mix(in srgb, var(--success) 16%, var(--surface)) !important;
  box-shadow:0 6px 14px rgba(16,185,129,.14) !important;
}

.btn-secondary,
a.btn-secondary{
  min-height:34px;
  padding:8px 10px;
  border-radius:8px;
  font-weight:620;
  color:var(--text) !important;
  background:var(--surface) !important;
  border-color:var(--border) !important;
  box-shadow:var(--button-shadow);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
}
.btn-secondary:hover,
a.btn-secondary:hover{
  background:color-mix(in srgb, var(--brand-3) 7%, var(--surface)) !important;
  border-color:color-mix(in srgb, var(--brand-3) 24%, var(--border)) !important;
  color:var(--text) !important;
  box-shadow:0 6px 14px rgba(15,23,42,.08);
}

.btn-danger{
  font-weight:620;
  border-radius:8px;
  box-shadow:var(--button-shadow);
}

.card{
  border-radius:10px;
  box-shadow:0 1px 2px rgba(15,23,42,.04), 0 10px 26px rgba(0,42,74,.06);
}
.card:hover{ box-shadow:0 1px 2px rgba(15,23,42,.04), 0 12px 28px rgba(0,42,74,.08); }

tbody tr:hover td{
  background:color-mix(in srgb, var(--brand-3) 5%, transparent);
}

input:hover, select:hover, textarea:hover{
  border-color:color-mix(in srgb, var(--brand-3) 20%, var(--border));
}

.badge{ font-weight:620; }

.home-logo-panel{ transform:none; }
.home-logo-panel img{ transform:none; }
.module-card::before{ width:3px; opacity:.75; }
.module-kicker{ font-weight:680; }

.modal-backdrop{ z-index:var(--z-modal); }
.suggest-box,
.suggestions{
  z-index:var(--z-float) !important;
  position:absolute;
}
.product-cell{ z-index:300; }
.product-input-wrap .suggestions{ z-index:var(--z-float) !important; }
.items-table-wrap,
.items-inner,
.table,
table,
tbody,
tr,
td{ overflow:visible; }

.stock-action-details[open]{ z-index:var(--z-float); }
.stock-action-details > summary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  border-radius:8px !important;
  font-weight:620 !important;
}
.stock-action-panel{
  z-index:var(--z-float) !important;
  background:var(--surface) !important;
  border-color:var(--border) !important;
  box-shadow:0 18px 40px rgba(15,23,42,.22) !important;
  max-height:min(78vh, 430px);
  overflow:auto;
}

.stock-top-filters{
  display:flex;
  gap:10px;
  margin:0;
  flex-wrap:wrap;
  align-items:flex-start;
}
.stock-top-filters > label,
.stock-filter-chip{
  background:var(--surface) !important;
  border-color:var(--border) !important;
  box-shadow:var(--button-shadow) !important;
}
.stock-top-filters .small{
  color:var(--text) !important;
  font-weight:620 !important;
}
.stock-top-filters .inline-icon{ color:var(--brand-2); }
.stock-top-filters select{
  color:var(--text) !important;
  background:var(--surface-2) !important;
  border-color:var(--border) !important;
}
.stock-top-filters select:hover{
  border-color:color-mix(in srgb, var(--brand-3) 38%, var(--border)) !important;
}
.report-modal-card{
  width:320px !important;
  border-radius:12px !important;
}
.report-check{
  padding:4px 2px;
  color:var(--text);
}
.report-check:hover{ color:var(--brand); }

.payment-option{
  color:var(--text) !important;
  background:var(--surface) !important;
  border-color:var(--border) !important;
  font-weight:620 !important;
}
.payment-option:hover{
  background:var(--surface-2) !important;
  border-color:color-mix(in srgb, var(--brand-3) 24%, var(--border)) !important;
}
.payment-option.active{
  color:var(--brand) !important;
  background:color-mix(in srgb, var(--brand-3) 9%, var(--surface)) !important;
  border-color:var(--brand-3) !important;
  box-shadow:0 0 0 2px color-mix(in srgb, var(--brand-3) 18%, transparent) !important;
}

html[data-theme="dark"] [style*="#f8fafc"],
html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"]{
  background:var(--surface-2) !important;
}
html[data-theme="dark"] [style*="#e2e8f0"],
html[data-theme="dark"] [style*="#cbd5e1"]{
  border-color:var(--border) !important;
}
html[data-theme="dark"] [style*="#334155"],
html[data-theme="dark"] [style*="#64748b"]{
  color:var(--text) !important;
}
html[data-theme="dark"] [style*="#fff5f5"],
html[data-theme="dark"] [style*="#fff7ed"]{
  background:color-mix(in srgb, var(--danger) 10%, var(--surface)) !important;
}

@media (max-width:1050px){
  .app-sidebar{ box-shadow:0 8px 24px rgba(0,42,74,.10); }
  .side-nav a{ background:color-mix(in srgb, var(--surface) 70%, transparent); }
}

/* ===== v6.5: correcao de popups e overflow horizontal ===== */
html,
body{
  max-width:100%;
  overflow-x:hidden;
}

.app-shell,
.app-content-shell,
.app-main,
.card{
  min-width:0;
}

.app-content-shell{
  overflow-x:hidden;
}

.card{
  max-width:100%;
}

#itemsTable{
  min-width:0 !important;
}
#itemsTable th:nth-child(1),
#itemsTable td:nth-child(1){ min-width:260px; }
#itemsTable th:nth-child(2),
#itemsTable td:nth-child(2){ width:64px !important; }
#itemsTable th:nth-child(3),
#itemsTable td:nth-child(3){ width:124px !important; }
#itemsTable th:nth-child(4),
#itemsTable td:nth-child(4){ width:116px !important; }
#itemsTable th:nth-child(5),
#itemsTable td:nth-child(5){ width:92px !important; }
#itemsTable th:nth-child(6),
#itemsTable td:nth-child(6){ width:112px !important; }
#itemsTable th:nth-child(7),
#itemsTable td:nth-child(7){ width:86px !important; }
#itemsTable th:nth-child(8),
#itemsTable td:nth-child(8){ width:106px !important; }
#itemsTable th:nth-child(9),
#itemsTable td:nth-child(9){ width:48px !important; }

.items-table-wrap,
.items-inner{
  overflow:visible !important;
  max-width:100%;
}

.product-input-wrap{
  position:relative;
  isolation:isolate;
}
.product-input-wrap .suggestions{
  top:calc(100% + 6px) !important;
  left:0 !important;
  right:0 !important;
  width:auto !important;
  min-width:260px;
  max-width:min(720px, calc(100vw - 48px));
  max-height:320px !important;
}
.suggest-item{
  color:var(--text);
}
.suggest-item:hover,
.suggest-item.active{
  color:var(--text) !important;
  background:color-mix(in srgb, var(--brand-3) 13%, var(--surface)) !important;
}
.suggest-item .small{
  color:var(--muted) !important;
}

.stock-table-scroll{
  width:100%;
  max-width:100%;
  overflow-x:auto !important;
  overflow-y:visible;
  scrollbar-width:thin;
  position:relative;
  border-radius:10px;
}
.stock-table-scroll #stockTable{
  min-width:1180px;
  table-layout:fixed;
  margin:0 !important;
}
.stock-table-scroll .dataTables_wrapper{
  min-width:1180px;
}
.stock-table-scroll #stockTable .col-media{ width:52px; }
.stock-table-scroll #stockTable .col-product{ width:30%; }
.stock-table-scroll #stockTable .col-category{ width:88px; }
.stock-table-scroll #stockTable .col-qty{ width:48px; text-align:center; }
.stock-table-scroll #stockTable .col-locations{ width:16%; }
.stock-table-scroll #stockTable .col-cost{ width:86px; }
.stock-table-scroll #stockTable .col-price{ width:150px; }
.stock-table-scroll #stockTable .col-partner-price{ width:144px; }
.stock-table-scroll #stockTable .col-partner-margin{ width:118px; }
.stock-table-scroll #stockTable .col-profit{ width:64px; text-align:center; }
.stock-table-scroll #stockTable .col-actions{ width:246px; }

/* Mantem a navegacao lateral em telas de notebook/janela dividida.
   O layout empilhado agora fica reservado para telas realmente pequenas. */
@media (min-width:601px) and (max-width:1050px){
  .app-shell{
    grid-template-columns:236px minmax(0, 1fr) !important;
  }
  .app-sidebar{
    position:sticky !important;
    top:0 !important;
    height:100vh !important;
    padding:16px 12px !important;
    box-shadow:8px 0 28px rgba(0,42,74,.08) !important;
  }
  .side-nav{
    display:flex !important;
    grid-template-columns:none !important;
    flex-direction:column !important;
  }
  .side-nav-group{
    display:block !important;
  }
  .side-nav a:not(.active){
    background:transparent !important;
  }
  .sidebar-footer{
    display:grid !important;
    margin-top:auto !important;
  }
  .sidebar-footer .theme-toggle,
  .sidebar-footer .power-btn{
    width:100% !important;
  }
  .workspace-topbar{
    top:0 !important;
  }
}

/* ===== v6.12: menu lateral recolhivel ===== */
.app-shell{
  transition:grid-template-columns .18s ease;
}

.sidebar-top{
  display:flex;
  align-items:center;
  gap:8px;
  padding:0 4px 12px;
  margin-bottom:12px;
  border-bottom:1px solid var(--border);
}

.sidebar-top .sidebar-brand{
  flex:1 1 auto;
  min-width:0;
  margin:0;
  padding:6px;
  border-bottom:0;
}

.sidebar-brand-text,
.nav-label,
.theme-label,
.power-label{
  white-space:nowrap;
  overflow:hidden;
  transition:opacity .14s ease, width .18s ease;
}

.sidebar-toggle{
  width:34px;
  height:34px;
  min-height:34px;
  padding:0 !important;
  flex:0 0 34px;
  display:inline-grid !important;
  place-items:center;
  color:var(--muted) !important;
  background:var(--surface) !important;
  border:1px solid var(--border) !important;
  border-radius:9px !important;
  box-shadow:var(--button-shadow) !important;
}

.sidebar-toggle:hover{
  color:var(--brand) !important;
  background:var(--surface-2) !important;
  border-color:color-mix(in srgb, var(--brand-3) 26%, var(--border)) !important;
}

.sidebar-toggle svg{
  width:17px;
  height:17px;
}

.sidebar-toggle-closed{
  display:none !important;
}

.side-nav a{
  position:relative;
}

@media (min-width:0px){
  html[data-sidebar="collapsed"] .app-shell{
    grid-template-columns:72px minmax(0, 1fr) !important;
  }

  html[data-sidebar="collapsed"] .app-sidebar{
    padding:14px 8px !important;
    overflow:visible;
  }

  html[data-sidebar="collapsed"] .sidebar-top{
    flex-direction:column;
    gap:8px;
    padding:0 0 12px;
  }

  html[data-sidebar="collapsed"] .sidebar-top .sidebar-brand{
    flex:0 0 auto;
    justify-content:center;
    gap:0;
    padding:0;
  }

  html[data-sidebar="collapsed"] .sidebar-brand-text,
  html[data-sidebar="collapsed"] .nav-label,
  html[data-sidebar="collapsed"] .theme-label,
  html[data-sidebar="collapsed"] .power-label{
    width:0;
    opacity:0;
    visibility:hidden;
  }

  html[data-sidebar="collapsed"] .sidebar-brand-mark{
    width:42px;
    height:42px;
    flex:0 0 42px;
  }

  html[data-sidebar="collapsed"] .sidebar-toggle-open{
    display:none !important;
  }

  html[data-sidebar="collapsed"] .sidebar-toggle-closed{
    display:block !important;
  }

  html[data-sidebar="collapsed"] .side-nav{
    padding:2px 0;
    align-items:center;
  }

  html[data-sidebar="collapsed"] .side-nav-group{
    width:32px;
    height:1px;
    margin:12px 0 5px;
    padding:0;
    color:transparent;
    background:var(--border);
    overflow:hidden;
  }

  html[data-sidebar="collapsed"] .side-nav a{
    width:44px;
    height:42px;
    justify-content:center;
    gap:0;
    padding:0;
    border-radius:12px;
  }

  html[data-sidebar="collapsed"] .side-nav a:hover{
    transform:none;
  }

  html[data-sidebar="collapsed"] .side-nav a::after{
    content:attr(aria-label);
    position:absolute;
    left:calc(100% + 10px);
    top:50%;
    transform:translateY(-50%) translateX(-4px);
    z-index:var(--z-float);
    max-width:220px;
    padding:7px 9px;
    border-radius:8px;
    color:var(--text);
    background:var(--surface);
    border:1px solid var(--border);
    box-shadow:0 12px 28px rgba(15,23,42,.18);
    font-size:12px;
    font-weight:650;
    line-height:1;
    white-space:nowrap;
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity .12s ease, transform .12s ease, visibility .12s ease;
  }

  html[data-sidebar="collapsed"] .side-nav a:hover::after,
  html[data-sidebar="collapsed"] .side-nav a:focus-visible::after{
    opacity:1;
    visibility:visible;
    transform:translateY(-50%) translateX(0);
  }

  html[data-sidebar="collapsed"] .sidebar-footer{
    align-items:center;
    padding:12px 0 2px;
  }

  html[data-sidebar="collapsed"] .sidebar-footer .theme-toggle,
  html[data-sidebar="collapsed"] .sidebar-footer .power-btn{
    width:44px !important;
    height:42px;
    padding:0 !important;
    justify-content:center !important;
    gap:0;
    border-radius:12px;
  }

  html[data-sidebar="collapsed"] .power-form{
    display:flex;
    justify-content:center;
    margin:0;
  }
}

/* ===== v6.13 final overrides ===== */
.sidebar-brand-mark{
  background:transparent !important;
  border:0 !important;
  box-shadow:none !important;
  overflow:hidden;
}
.sidebar-brand-mark img{
  width:42px !important;
  height:42px !important;
  border-radius:12px;
  object-fit:cover;
}
.user-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:36px;
  padding:0 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background:var(--surface);
  color:var(--text);
  box-shadow:var(--button-shadow);
  font-weight:700;
}
.user-chip svg{ width:16px; height:16px; color:var(--brand-2); }
.user-chip small{
  padding:3px 6px;
  border-radius:999px;
  color:var(--muted);
  background:var(--surface-2);
  font-size:10px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.03em;
}
.home-user-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-top:10px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:999px;
  background:var(--surface-2);
  color:var(--text);
  font-size:12px;
  font-weight:650;
}
.home-user-chip span{
  padding:3px 7px;
  border-radius:999px;
  background:color-mix(in srgb, var(--brand-3) 14%, var(--surface));
  color:var(--brand-2);
  font-size:10px;
  font-weight:850;
  text-transform:uppercase;
}
.workspace-actions{ gap:10px; }
.quick-sale{
  gap:10px !important;
  line-height:1;
  white-space:nowrap;
}
.quick-sale svg{
  width:17px;
  height:17px;
  flex:0 0 auto;
}
.quick-sale .keycap,
.btn-primary .keycap{ margin-left:4px; }

@media (max-width:720px){
  .workspace-actions{
    width:100%;
    justify-content:space-between;
  }
  .user-chip{
    max-width:calc(100vw - 170px);
    overflow:hidden;
  }
  .user-chip span{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
}

/* ===== v6.14 home partner polish ===== */
.home-meta-row{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.home-meta-row .home-eyebrow,
.home-meta-row .home-user-chip{
  min-height:34px;
  margin:0;
  padding:0 10px;
  border-radius:999px;
}
.home-user-chip{
  white-space:nowrap;
}
.home-user-chip b{
  font-weight:850;
}
.home-user-label{
  color:var(--muted);
  font-weight:750;
}
.home-actions{
  align-items:center;
  gap:10px;
}
.home-actions .btn-primary,
.home-actions .btn-secondary{
  min-height:42px;
  padding:0 14px !important;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  line-height:1;
  white-space:nowrap;
}
.home-actions .inline-icon{
  width:18px;
  height:18px;
  display:block;
  margin:0;
  vertical-align:0;
}
.home-actions .keycap{
  margin-left:2px !important;
  transform:translateY(0);
}
.home-default-location{
  margin-top:12px;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.home-default-location label{
  margin:0;
  font-size:12px;
  font-weight:850;
  color:var(--muted);
}
.home-default-location select{
  width:auto;
  min-width:190px;
  height:36px;
  padding:0 10px;
}
.home-default-location button{
  min-height:36px;
  padding:0 12px !important;
}
.module-actions .btn-secondary{
  gap:8px;
  min-height:48px;
  padding:0 14px !important;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
}
.module-actions .inline-icon{
  display:block;
  width:18px;
  height:18px;
  margin:0;
  vertical-align:0;
}
.purchase-module-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  align-items:center;
}
.purchase-module-actions .btn-secondary{
  width:100%;
}
.purchase-module-actions .products-shortcut{
  width:100%;
  min-width:0;
}

/* ===== v6.17 quick UI fixes ===== */
.product-status-badges{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:8px;
  line-height:1;
}
.product-status-badges .badge{
  margin:0 !important;
  display:inline-flex;
  align-items:center;
  min-height:24px;
}
.product-store-badge{
  background:#fff4e6;
  color:#8a3b0e;
  border:1px solid #f6b36d;
}
html[data-theme="dark"] .product-store-badge{
  background:rgba(251,146,60,.20);
  color:#ffd2a8;
  border-color:rgba(251,146,60,.62);
}

/* ===== v6.15 dark form safety net ===== */
html[data-theme="dark"]{
  color-scheme:dark;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] option,
html[data-theme="dark"] .form-grid input:not([type="checkbox"]):not([type="file"]),
html[data-theme="dark"] .form-grid select,
html[data-theme="dark"] .dataTables_wrapper input,
html[data-theme="dark"] .dataTables_wrapper select{
  background:var(--surface) !important;
  color:var(--text) !important;
  border-color:var(--border) !important;
}

html[data-theme="dark"] input[readonly],
html[data-theme="dark"] input:disabled,
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled,
html[data-theme="dark"] .locked,
html[data-theme="dark"] .locked-display,
html[data-theme="dark"] .auto-calc{
  background:var(--surface-2) !important;
  color:var(--muted) !important;
  border-color:var(--border) !important;
  opacity:1;
}

html[data-theme="dark"] .suggest-box,
html[data-theme="dark"] .suggestions,
html[data-theme="dark"] .suggest-item,
html[data-theme="dark"] .dataTables_wrapper .dataTables_filter input,
html[data-theme="dark"] .dataTables_wrapper .dataTables_length select{
  background:var(--surface) !important;
  color:var(--text) !important;
  border-color:var(--border) !important;
}

html[data-theme="dark"] .suggest-box a,
html[data-theme="dark"] .suggestions a,
html[data-theme="dark"] .suggest-item{
  color:var(--text) !important;
}

html[data-theme="dark"] .suggest-box a:hover,
html[data-theme="dark"] .suggest-item:hover,
html[data-theme="dark"] .suggest-item.active{
  background:var(--surface-2) !important;
  color:var(--text) !important;
}

html[data-theme="dark"] .suggest-thumb,
html[data-theme="dark"] [style*="background:#e2e8f0"],
html[data-theme="dark"] [style*="background: #e2e8f0"],
html[data-theme="dark"] [style*="background-color: rgb(226, 232, 240)"]{
  background:var(--surface-3) !important;
  border-color:var(--border) !important;
}

html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"],
html[data-theme="dark"] [style*="background-color:#fff"],
html[data-theme="dark"] [style*="background-color: #fff"],
html[data-theme="dark"] [style*="background-color: rgb(255, 255, 255)"],
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background-color:#f8fafc"],
html[data-theme="dark"] [style*="background-color: #f8fafc"],
html[data-theme="dark"] [style*="background-color: rgb(248, 250, 252)"],
html[data-theme="dark"] [style*="background:#f1f5f9"],
html[data-theme="dark"] [style*="background: #f1f5f9"],
html[data-theme="dark"] [style*="background-color: rgb(241, 245, 249)"]{
  background:var(--surface-2) !important;
}

html[data-theme="dark"] [style*="color:#334155"],
html[data-theme="dark"] [style*="color: #334155"],
html[data-theme="dark"] [style*="color:#475569"],
html[data-theme="dark"] [style*="color: #475569"],
html[data-theme="dark"] [style*="color:#64748b"],
html[data-theme="dark"] [style*="color: #64748b"],
html[data-theme="dark"] [style*="color: rgb(51, 65, 85)"],
html[data-theme="dark"] [style*="color: rgb(71, 85, 105)"],
html[data-theme="dark"] [style*="color: rgb(100, 116, 139)"],
html[data-theme="dark"] .form-grid label{
  color:var(--text) !important;
}

html[data-theme="dark"] .drop,
html[data-theme="dark"] #drop{
  background:var(--surface-2) !important;
  color:var(--muted) !important;
  border-color:var(--border) !important;
}

html[data-theme="dark"] .is-invalid,
html[data-theme="dark"] .qty-over{
  background:color-mix(in srgb, var(--danger) 14%, var(--surface)) !important;
  color:#fecaca !important;
  border-color:color-mix(in srgb, var(--danger) 60%, var(--border)) !important;
}

html[data-theme="dark"] [style*="#fffbfa"],
html[data-theme="dark"] [style*="#fff1f2"],
html[data-theme="dark"] [style*="background:#fffbfa"],
html[data-theme="dark"] [style*="background:#fff1f2"],
html[data-theme="dark"] [style*="background: #fffbfa"],
html[data-theme="dark"] [style*="background: #fff1f2"]{
  background:color-mix(in srgb, var(--danger) 14%, var(--surface)) !important;
  color:#fecaca !important;
  border-color:color-mix(in srgb, var(--danger) 60%, var(--border)) !important;
}

html[data-theme="dark"] .below-cost-row td,
html[data-theme="dark"] #belowCostWarn,
html[data-theme="dark"] [style*="#fff7ed"],
html[data-theme="dark"] [style*="background:#fff7ed"],
html[data-theme="dark"] [style*="background: #fff7ed"]{
  background:color-mix(in srgb, #f97316 16%, var(--surface)) !important;
}

html[data-theme="dark"] .payment-option{
  background:var(--surface) !important;
  color:var(--text) !important;
  border-color:var(--border) !important;
}

html[data-theme="dark"] .payment-option.active{
  background:color-mix(in srgb, var(--brand-3) 18%, var(--surface)) !important;
  color:#a5f3fc !important;
  border-color:var(--brand-3) !important;
}

html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] textarea:-webkit-autofill,
html[data-theme="dark"] select:-webkit-autofill{
  -webkit-text-fill-color:var(--text) !important;
  box-shadow:0 0 0 1000px var(--surface) inset !important;
  caret-color:var(--text) !important;
}

/* ===== v6.19 account and login polish ===== */
.account-btn{
  width:100%;
  height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  padding:0 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface);
  color:var(--text);
  text-decoration:none;
  font-weight:620;
  box-shadow:var(--button-shadow);
  box-sizing:border-box;
}
.account-btn:hover{
  color:var(--text);
  background:var(--surface-2);
  transform:translateY(-1px);
}
.account-btn.active{
  color:#fff;
  border-color:color-mix(in srgb, var(--brand-2) 60%, var(--border));
  background:linear-gradient(135deg, var(--brand), var(--brand-2));
}
.account-btn.active svg{ color:#fff; }
.account-btn svg{ width:16px; height:16px; color:var(--brand-2); }
.module-icon.module-users{ color:#2563eb; background:rgba(37,99,235,.10); border-color:rgba(37,99,235,.18); }
.user-chip{ text-decoration:none; }
.user-chip:hover{
  color:var(--text);
  background:var(--surface-2);
  transform:translateY(-1px);
}
.account-card{
  display:flex;
  flex-direction:column;
  gap:18px;
}
.account-grid{ align-items:start; }
.account-grid .account-card{ align-self:start; }
.account-grid .account-card:first-child{ gap:12px; padding-bottom:18px; }
.account-summary{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}
.account-summary div{
  padding:12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--surface-2);
}
.account-summary span,
.account-form span{
  display:block;
  margin-bottom:6px;
  color:var(--muted);
  font-size:12px;
  font-weight:850;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.account-summary strong{
  display:block;
  color:var(--text);
}
.account-form{
  display:grid;
  gap:14px;
}
.account-form label{ margin:0; }
.account-form button{
  justify-content:center;
  min-height:42px;
}
@media (max-width:640px){
  .account-summary{ grid-template-columns:1fr; }
}
@media (min-width:901px){
  html[data-sidebar="collapsed"] .account-btn{
    width:44px !important;
    height:42px;
    padding:0 !important;
    justify-content:center !important;
    border-radius:12px;
  }
  html[data-sidebar="collapsed"] .account-label{ display:none; }
}

/* ===== v6.24 mobile ergonomics ===== */
@media (max-width:760px){
  html,
  body{
    max-width:100%;
    overflow-x:hidden;
  }

  .app-shell,
  html[data-sidebar="collapsed"] .app-shell{
    display:block !important;
    grid-template-columns:1fr !important;
  }

  .app-sidebar,
  html[data-sidebar="collapsed"] .app-sidebar{
    position:relative !important;
    top:auto !important;
    height:auto !important;
    width:100% !important;
    min-height:0 !important;
    padding:10px !important;
    overflow:visible !important;
    border-right:0 !important;
    border-bottom:1px solid var(--border);
  }

  .sidebar-top,
  html[data-sidebar="collapsed"] .sidebar-top{
    flex-direction:row !important;
    align-items:center !important;
    gap:8px !important;
    margin-bottom:8px !important;
    padding:0 0 8px !important;
  }

  .sidebar-toggle{
    display:none !important;
  }

  .sidebar-brand,
  .sidebar-top .sidebar-brand,
  html[data-sidebar="collapsed"] .sidebar-top .sidebar-brand{
    flex:1 1 auto !important;
    justify-content:flex-start !important;
    gap:9px !important;
    padding:4px !important;
  }

  .sidebar-brand-mark{
    width:40px !important;
    height:40px !important;
    flex:0 0 40px !important;
    overflow:visible !important;
  }

  .sidebar-brand-mark img{
    width:40px !important;
    height:40px !important;
    object-fit:contain !important;
    border-radius:10px !important;
  }

  .sidebar-brand-text,
  .nav-label,
  .theme-label,
  .power-label,
  .account-label,
  html[data-sidebar="collapsed"] .sidebar-brand-text,
  html[data-sidebar="collapsed"] .nav-label,
  html[data-sidebar="collapsed"] .theme-label,
  html[data-sidebar="collapsed"] .power-label,
  html[data-sidebar="collapsed"] .account-label{
    display:inline !important;
    width:auto !important;
    height:auto !important;
    opacity:1 !important;
    visibility:visible !important;
    clip:auto !important;
    overflow:hidden !important;
    white-space:nowrap !important;
  }

  .side-nav,
  html[data-sidebar="collapsed"] .side-nav{
    display:flex !important;
    flex-direction:row !important;
    gap:8px !important;
    overflow-x:auto !important;
    padding:2px 0 8px !important;
    scroll-snap-type:x proximity;
  }

  .side-nav-group,
  html[data-sidebar="collapsed"] .side-nav-group{
    display:none !important;
  }

  .side-nav a,
  html[data-sidebar="collapsed"] .side-nav a{
    flex:0 0 auto !important;
    width:auto !important;
    min-width:max-content !important;
    min-height:44px !important;
    padding:8px 10px !important;
    justify-content:center !important;
    gap:8px !important;
    scroll-snap-align:start;
    border-radius:10px !important;
  }

  .nav-icon,
  html[data-sidebar="collapsed"] .nav-icon{
    margin:0 !important;
  }

  .sidebar-footer,
  html[data-sidebar="collapsed"] .sidebar-footer{
    display:flex !important;
    flex-direction:row !important;
    align-items:center !important;
    gap:8px !important;
    margin-top:8px !important;
    overflow-x:auto;
  }

  .sidebar-footer .theme-toggle,
  .sidebar-footer .power-btn,
  .account-btn,
  html[data-sidebar="collapsed"] .sidebar-footer .theme-toggle,
  html[data-sidebar="collapsed"] .sidebar-footer .power-btn,
  html[data-sidebar="collapsed"] .account-btn{
    width:auto !important;
    min-height:42px !important;
    flex:0 0 auto;
    padding:0 12px !important;
  }

  .app-content-shell,
  .app-main,
  .card{
    min-width:0 !important;
    max-width:100% !important;
  }

  .workspace-topbar{
    position:relative !important;
    top:auto !important;
    min-height:0 !important;
    padding:10px 12px !important;
    gap:10px !important;
  }

  .workspace-kicker{
    display:none;
  }

  .workspace-title{
    font-size:18px;
    line-height:1.2;
  }

  .workspace-actions{
    width:100%;
    display:grid;
    grid-template-columns:minmax(0, 1fr) auto;
    align-items:center;
    gap:8px;
  }

  .user-chip{
    max-width:none !important;
    min-width:0;
  }

  .quick-sale{
    min-height:42px;
    padding:0 12px !important;
  }

  .app-main{
    padding:10px !important;
  }

  .card{
    padding:14px !important;
    margin-bottom:12px;
    border-radius:8px;
  }

  h1{ font-size:25px; line-height:1.15; }
  h2{ font-size:22px; line-height:1.18; }
  h3{ font-size:17px; line-height:1.25; }

  input,
  select,
  textarea,
  button,
  .btn-primary,
  .btn-secondary,
  a.btn-secondary{
    min-height:42px;
    font-size:16px;
  }

  .grid{
    grid-template-columns:1fr !important;
    gap:12px;
  }

  .module-card{
    padding:14px !important;
  }

  .module-card p{
    line-height:1.38;
  }

  .module-actions,
  .purchase-module-actions{
    display:grid !important;
    grid-template-columns:1fr !important;
    width:100%;
    gap:8px;
  }

  .module-actions .btn-secondary,
  .purchase-module-actions .btn-secondary,
  .purchase-module-actions .products-shortcut{
    width:100% !important;
    min-width:0 !important;
  }

  .form-grid,
  .move-grid,
  .adjust-grid{
    grid-template-columns:1fr !important;
  }

  .home-actions,
  .home-default-location,
  .stock-top-filters,
  .sales-filter-card form,
  #filterForm{
    display:grid !important;
    grid-template-columns:1fr !important;
    align-items:stretch !important;
    gap:8px !important;
  }

  .home-default-location select,
  .stock-top-filters select,
  .stock-filter-chip,
  .sales-product-filter,
  #filterForm label,
  #filterForm input{
    width:100% !important;
    min-width:0 !important;
  }

  .stock-filter-chip{
    height:auto;
    min-height:42px;
  }

  .dataTables_wrapper{
    width:100%;
    max-width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }

  .dataTables_wrapper table.dataTable{
    min-width:760px;
  }

  .dataTables_wrapper .dt-bottom{
    justify-content:center;
    gap:8px;
  }

  .dataTables_wrapper .dt-bottom .dataTables_info{
    width:100%;
    margin-right:0 !important;
    text-align:center;
  }

  .dataTables_wrapper .dataTables_paginate{
    display:flex;
    justify-content:center;
    flex-wrap:wrap;
    gap:4px;
  }

  table.dataTable thead tr.filters input{
    min-height:36px;
    font-size:14px;
  }

  .product-input-wrap .suggestions,
  .suggest-box,
  .suggestions{
    max-width:calc(100vw - 24px) !important;
    max-height:52vh !important;
  }

  .sales-suggest-list,
  #filter_product_suggest,
  #filter_location_suggest{
    width:100% !important;
    left:0 !important;
    right:auto !important;
  }

  .items-table-wrap,
  .stock-table-scroll{
    margin-left:-2px;
    margin-right:-2px;
    padding-bottom:6px;
    overflow-x:auto !important;
    -webkit-overflow-scrolling:touch;
  }

  #itemsTable{
    min-width:920px;
  }

  .stock-actions{
    flex-wrap:wrap !important;
    justify-content:flex-end;
    white-space:normal;
  }

  .stock-action-panel{
    position:fixed !important;
    left:10px !important;
    right:10px !important;
    top:auto !important;
    bottom:10px !important;
    width:auto !important;
    max-width:none !important;
    max-height:calc(100vh - 24px) !important;
    border-radius:12px !important;
    overflow-y:auto !important;
    z-index:22000 !important;
  }
}

@media (max-width:420px){
  .workspace-actions{
    grid-template-columns:1fr;
  }

  .quick-sale,
  .user-chip{
    width:100%;
    justify-content:center;
  }

  .side-nav a,
  html[data-sidebar="collapsed"] .side-nav a{
    padding:8px 9px !important;
  }
}

/* ===== v6.26 mobile table/card pass ===== */
@media (max-width:760px){
  .sales-list-card{
    width:100%;
  }

  .sales-filter-card .small,
  .home-subtitle,
  .module-card p{
    font-size:13px;
  }

  .module-head{
    align-items:flex-start;
  }

  .module-icon{
    width:36px;
    height:36px;
  }

  .workspace-topbar{
    border-bottom:1px solid var(--border);
  }

  .dataTables_wrapper{
    overflow-x:visible;
  }

  .dataTables_wrapper table.dataTable{
    min-width:0;
  }

  #itemsTable{
    min-width:920px !important;
  }

  .stock-table-scroll #stockTable{
    min-width:1180px !important;
  }
}

@media (max-width:640px){
  .card{
    padding:12px !important;
  }

  .mobile-card-table,
  .dataTables_wrapper table.mobile-card-table.dataTable{
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    border:0 !important;
    background:transparent !important;
    border-radius:0 !important;
  }

  .mobile-card-table colgroup,
  .mobile-card-table thead{
    display:none !important;
  }

  .mobile-card-table tbody{
    display:grid !important;
    gap:10px;
  }

  .mobile-card-table tbody tr{
    display:block !important;
    padding:10px 12px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:8px;
    box-shadow:0 4px 12px rgba(0,42,74,.05);
  }

  .mobile-card-table tbody tr:hover td{
    background:transparent !important;
  }

  .mobile-card-table tbody tr.month-sep{
    padding:0;
    background:transparent;
    border:0;
    box-shadow:none;
  }

  .mobile-card-table tbody tr.month-sep td{
    display:block !important;
    padding:4px 0 0 !important;
    border:0 !important;
    background:transparent !important;
    color:var(--muted);
    font-weight:900;
  }

  .mobile-card-table tbody tr.month-sep td::before{
    content:none !important;
  }

  .mobile-card-table tbody td{
    display:grid !important;
    grid-template-columns:112px minmax(0, 1fr);
    gap:10px;
    align-items:center;
    min-height:30px;
    padding:6px 0 !important;
    border:0 !important;
    background:transparent !important;
    white-space:normal !important;
  }

  .mobile-card-table tbody td:empty{
    display:none !important;
  }

  .mobile-card-table tbody td::before{
    content:attr(data-label);
    color:var(--muted);
    font-size:11px;
    font-weight:900;
    text-transform:uppercase;
  }

  .mobile-card-table tbody td[data-label="Itens"],
  .mobile-card-table tbody td[data-label="Produto"]{
    grid-template-columns:1fr;
    gap:4px;
  }

  .mobile-card-table tbody td[data-label="Itens"]::before,
  .mobile-card-table tbody td[data-label="Produto"]::before{
    display:none;
  }

  .mobile-card-table .sale-items-single,
  .mobile-card-table .sale-items-details,
  .mobile-card-table .sale-items-details summary{
    max-width:100%;
    width:100%;
  }

  .mobile-card-table .sale-items-popover{
    position:static;
    max-width:none;
    margin-top:8px;
  }

  .dataTables_wrapper .dt-bottom{
    border-top:0;
    margin-top:8px;
    padding-top:0;
  }

  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate{
    font-size:12px;
  }

  .stock-table-scroll{
    overflow-x:auto !important;
  }

  .stock-table-scroll .dataTables_wrapper{
    min-width:1180px;
    overflow-x:visible;
  }

  .stock-table-scroll #stockTable{
    display:table !important;
  }

  .stock-table-scroll #stockTable thead{
    display:table-header-group !important;
  }

  .stock-table-scroll #stockTable tbody{
    display:table-row-group !important;
  }

  .stock-table-scroll #stockTable tr{
    display:table-row !important;
    padding:0;
    border:0;
    box-shadow:none;
  }

  .stock-table-scroll #stockTable td,
  .stock-table-scroll #stockTable th{
    display:table-cell !important;
    padding:8px !important;
    border-bottom:1px solid var(--border) !important;
  }

  .stock-table-scroll #stockTable td::before{
    content:none !important;
  }
}
