:root{
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 30px rgba(0,0,0,.35);
  --shadow-soft: 0 8px 22px rgba(0,0,0,.18);
}

/* =========================
   TEMA ESCURO
========================= */
body.theme-dark,
body:not(.theme-light){
  --bg:#0b1020;
  --bg-solid:#0b1020;
  --panel:rgba(17,24,50,.72);
  --card:rgba(15,22,48,.72);
  --surface-soft:rgba(255,255,255,.04);
  --surface-strong:rgba(0,0,0,.18);

  --text:#e8ecff;
  --muted:#aab3d6;
  --placeholder:#9fb0d9;

  --border:rgba(255,255,255,.10);
  --border-strong:rgba(110,231,255,.25);

  --brand:#6ee7ff;
  --brand2:#8b5cf6;
  --brand3:#45f29a;
  --danger:#ff5a7a;
  --ok:#45f29a;

  --input-bg:rgba(0,0,0,.18);
  --input-border:rgba(255,255,255,.10);
  --input-focus:rgba(110,231,255,.60);
  --input-ring:rgba(110,231,255,.12);

  --btn-bg1:rgba(110,231,255,.22);
  --btn-bg2:rgba(139,92,246,.18);
  --btn-border:rgba(110,231,255,.25);
  --btn-text:#e8ecff;

  --dropdown-bg:rgba(10,14,28,.98);
  --dropdown-border:rgba(255,255,255,.10);
  --dropdown-hover:rgba(255,255,255,.06);
  --dropdown-selected:rgba(110,231,255,.12);

  --result-bg:rgba(0,0,0,.18);
  --notice-bg:rgba(255,255,255,.04);
  --notice-ok:rgba(69,242,154,.35);
  --notice-err:rgba(255,90,122,.35);

  --arrow:#cfd6f6;
  --password-icon:#dfe7fb;
}

/* =========================
   TEMA CLARO FOTOGRÁFICO
========================= */
body.theme-light{
  --bg:#edf3fb;
  --bg-solid:#edf3fb;
  --panel:rgba(255,255,255,.58);
  --card:rgba(255,255,255,.64);
  --surface-soft:rgba(255,255,255,.42);
  --surface-strong:rgba(255,255,255,.52);

  --text:#1f2940;
  --muted:#667491;
  --placeholder:#8291ad;

  --border:rgba(92,112,156,.18);
  --border-strong:rgba(83,121,214,.26);

  --brand:#4a7dff;
  --brand2:#9a6dff;
  --brand3:#33bfae;
  --danger:#e25a78;
  --ok:#25b97d;

  --input-bg:rgba(255,255,255,.72);
  --input-border:rgba(92,112,156,.18);
  --input-focus:rgba(74,125,255,.45);
  --input-ring:rgba(74,125,255,.12);

  --btn-bg1:rgba(74,125,255,.16);
  --btn-bg2:rgba(154,109,255,.12);
  --btn-border:rgba(74,125,255,.20);
  --btn-text:#20304f;

  --dropdown-bg:rgba(255,255,255,.94);
  --dropdown-border:rgba(92,112,156,.16);
  --dropdown-hover:rgba(74,125,255,.06);
  --dropdown-selected:rgba(74,125,255,.10);

  --result-bg:rgba(255,255,255,.46);
  --notice-bg:rgba(255,255,255,.50);
  --notice-ok:rgba(37,185,125,.28);
  --notice-err:rgba(226,90,120,.24);

  --arrow:#61708f;
  --password-icon:#667491;

  --shadow: 0 20px 45px rgba(58,76,120,.14);
  --shadow-soft: 0 10px 24px rgba(58,76,120,.10);
}

*{box-sizing:border-box}
html,body{
  height:100%;
}
html, body{
  overflow-x:hidden;
}

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 8% 10%, rgba(78,157,255,.17), transparent 58%),
    radial-gradient(900px 560px at 92% 14%, rgba(155,109,255,.15), transparent 56%),
    radial-gradient(1000px 600px at 30% 92%, rgba(51,191,174,.13), transparent 58%),
    linear-gradient(135deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 35%),
    var(--bg-solid);
  background-attachment: fixed;
}

a{
  color:var(--brand);
  text-decoration:none;
}
a:hover{
  text-decoration:underline;
}

.container{
  max-width:1600px;
  width:calc(100% - 48px);
  margin:28px auto;
  padding:0;
  overflow:visible;
}

.topbar{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  box-shadow:var(--shadow);
  backdrop-filter:blur(14px) saturate(140%);
  -webkit-backdrop-filter:blur(14px) saturate(140%);
}

.title{
  font-size:20px;
  font-weight:800;
  letter-spacing:.2px;
  margin:0;
}

.badge{
  font-size:12px;
  color:var(--muted);
}

.grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  margin-top:16px;
  align-items:start;
  position:relative;
  z-index:1;
}

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

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:16px;
  backdrop-filter:blur(16px) saturate(140%);
  -webkit-backdrop-filter:blur(16px) saturate(140%);
}

.card h3{
  margin:0 0 12px 0;
  font-size:16px;
}

.muted{
  color:var(--muted);
  font-size:12px;
}

.row{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.row-search{
  align-items:flex-start;
}

.input{
  width:100%;
  padding:11px 12px;
  border-radius:12px;
  border:1px solid var(--input-border);
  background:var(--input-bg);
  color:var(--text);
  outline:none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.input::placeholder{
  color:var(--placeholder);
}

.input:focus{
  border-color:var(--input-focus);
  box-shadow:
    0 0 0 4px var(--input-ring),
    inset 0 1px 0 rgba(255,255,255,.18);
}

textarea.input{
  resize:vertical;
}

.btn{
  padding:8px 12px;
  border-radius:10px;
  border:1px solid var(--btn-border);
  background:
    linear-gradient(135deg, var(--btn-bg1), var(--btn-bg2)),
    rgba(255,255,255,.16);
  color:var(--btn-text);
  font-weight:600;
  font-size:14px;
  line-height:1.2;
  cursor:pointer;
  transition:transform .06s ease, filter .12s ease, border-color .12s ease;
  white-space:nowrap;
  text-decoration:none;
  box-shadow:var(--shadow-soft);
}

.btn:hover{
  filter:brightness(1.06);
  text-decoration:none;
}

.btn:active{
  transform:translateY(1px);
}

.btn[disabled],
button.btn:disabled{
  opacity:.55;
  cursor:not-allowed;
  filter:none;
}

.btn-ghost{
  background:var(--surface-soft);
  border:1px solid var(--border);
  color:var(--text);
  box-shadow:none;
}

.btn-sm{
  padding:6px 10px;
  border-radius:9px;
  font-size:13px;
  font-weight:600;
}

.notice{
  margin-top:12px;
  padding:12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:var(--notice-bg);
  backdrop-filter:blur(12px) saturate(140%);
  -webkit-backdrop-filter:blur(12px) saturate(140%);
}

.notice.ok{
  border-color:var(--notice-ok);
}
.notice.err{
  border-color:var(--notice-err);
}

.result{
  margin-top:12px;
  padding:14px;
  border-radius:14px;
  border:1px solid var(--border);
  background:var(--result-bg);
  backdrop-filter:blur(12px) saturate(135%);
  -webkit-backdrop-filter:blur(12px) saturate(135%);
}

.result b{
  font-size:15px;
}

/* Pesquisa por nome */
.search-card{
  position:relative;
  overflow:visible;
  z-index:50;
}

.search-wrap{
  position:relative;
}

/* Dropdown da pesquisa por nome */
.dropdown{
  display:none;
  position:absolute;
  top:56px;
  left:0;
  right:0;
  z-index:99999;
  max-height:420px;
  overflow-y:auto;
  overflow-x:hidden;
  border-radius:14px;
  border:1px solid var(--dropdown-border);
  background:var(--dropdown-bg);
  box-shadow:0 18px 38px rgba(31,41,64,.18);
  backdrop-filter:blur(18px) saturate(150%);
  -webkit-backdrop-filter:blur(18px) saturate(150%);
}

.dropdown-item{
  padding:14px 16px;
  border-bottom:1px solid var(--border);
  cursor:pointer;
  transition:background .12s ease;
}

.dropdown-item:last-child{
  border-bottom:none;
}

.dropdown-item:hover{
  background:var(--dropdown-hover);
}

.dropdown-item .t{
  font-weight:800;
  color:var(--text);
}

.dropdown-item .s{
  color:var(--muted);
  font-size:13px;
  margin-top:4px;
}

/* Dropdown custom */
.custom-select{
  position:relative;
  width:100%;
}

.custom-select select.custom-select-native{
  position:absolute !important;
  opacity:0 !important;
  pointer-events:none !important;
  width:1px !important;
  height:1px !important;
  overflow:hidden !important;
}

.custom-select-trigger{
  -webkit-appearance:none;
  appearance:none;
  font:inherit;
  width:100%;
  padding:11px 42px 11px 12px;
  border-radius:12px;
  border:1px solid var(--input-border);
  background:var(--input-bg);
  color:var(--text);
  cursor:pointer;
  outline:none;
  min-height:46px;
  display:flex;
  align-items:center;
  position:relative;
  text-align:left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
  transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.custom-select-trigger:hover{
  border-color:var(--border-strong);
}

.custom-select-trigger:focus{
  border-color:var(--input-focus);
  box-shadow:
    0 0 0 4px var(--input-ring),
    inset 0 1px 0 rgba(255,255,255,.18);
}

.custom-select-trigger::after{
  content:'';
  position:absolute;
  right:14px;
  top:50%;
  width:8px;
  height:8px;
  border-right:2px solid var(--arrow);
  border-bottom:2px solid var(--arrow);
  transform:translateY(-60%) rotate(45deg);
  transition:transform .15s ease;
}

.custom-select.open .custom-select-trigger::after{
  transform:translateY(-20%) rotate(-135deg);
}

.custom-select-menu{
  display:none;
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  right:0;
  z-index:9999;
  max-height:260px;
  overflow:auto;
  border-radius:14px;
  border:1px solid var(--dropdown-border);
  background:var(--dropdown-bg);
  box-shadow:0 18px 38px rgba(31,41,64,.18);
  backdrop-filter:blur(18px) saturate(150%);
  -webkit-backdrop-filter:blur(18px) saturate(150%);
}

.custom-select.open .custom-select-menu{
  display:block;
}

.custom-select-option{
  padding:11px 12px;
  color:var(--text);
  cursor:pointer;
  border-bottom:1px solid var(--border);
  transition:background .12s ease;
}

.custom-select-option:last-child{
  border-bottom:none;
}

.custom-select-option:hover,
.custom-select-option.active{
  background:var(--dropdown-hover);
}

.custom-select-option.selected{
  background:var(--dropdown-selected);
  color:var(--text);
  font-weight:700;
}

.password-wrap{
  position:relative;
  width:100%;
}

.password-wrap .input{
  width:100%;
  padding-right:56px;
}

.password-toggle{
  position:absolute;
  top:50%;
  right:10px;
  transform:translateY(-50%);
  width:38px;
  height:38px;
  border:0;
  padding:0;
  margin:0;
  border-radius:10px;
  background:transparent;
  color:var(--password-icon);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  opacity:.9;
  appearance:none;
  -webkit-appearance:none;
  box-shadow:none;
  z-index:2;
}

.password-toggle:hover{
  background:var(--dropdown-hover);
}

.password-toggle:focus-visible{
  outline:2px solid var(--input-focus);
  outline-offset:2px;
}

.password-toggle svg{
  width:22px;
  height:22px;
  display:block;
  pointer-events:none;
}

/* LOGIN */
.login-shell{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

.login-container{
  max-width:520px;
  margin:28px auto 0;
}

.login-footer{
  margin-top:auto;
  text-align:center;
  color:var(--muted);
  font-weight:600;
  font-size:13px;
  padding:18px 12px 12px;
}

/* Switch de tema */
.theme-switch-form{
  margin:0;
}

.theme-switch{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:0;
  width:78px;
  height:40px;
  padding:4px;
  border-radius:999px;
  border:1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.03)),
    var(--surface-soft);
  box-shadow: var(--shadow-soft);
  cursor:pointer;
  appearance:none;
  -webkit-appearance:none;
}

.theme-switch:hover{
  filter:brightness(1.04);
}

.theme-switch:focus-visible{
  outline:2px solid var(--input-focus);
  outline-offset:2px;
}

.theme-switch-track{
  position:absolute;
  inset:4px;
  border-radius:999px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.02));
}

.theme-switch-thumb{
  position:absolute;
  top:4px;
  left:4px;
  width:30px;
  height:30px;
  border-radius:50%;
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.70));
  box-shadow:
    0 6px 14px rgba(0,0,0,.18),
    inset 0 1px 0 rgba(255,255,255,.9);
  transition:left .18s ease, transform .18s ease, background .18s ease;
  z-index:1;
}

.theme-switch.is-light .theme-switch-thumb{
  left:44px;
}

.theme-switch-icon{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  width:18px;
  height:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--text);
  opacity:.90;
  z-index:2;
  pointer-events:none;
}

.theme-switch-icon.sun{
  left:11px;
}

.theme-switch-icon.moon{
  right:11px;
}

.theme-switch-icon svg{
  width:18px;
  height:18px;
  display:block;
}

/* Pequeno ajuste para a topbar */
.topbar .row{
  align-items:center;
}

.app-footer-fixed{
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  text-align: center;
  color: rgba(232, 236, 255, 0.72);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.1px;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}

.btn-soft-danger{
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 90, 122, 0.28);
  background: linear-gradient(
    135deg,
    rgba(255, 90, 122, 0.22),
    rgba(139, 92, 246, 0.18)
  );
  color: var(--btn-text);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  transition: transform .06s ease, filter .12s ease, border-color .12s ease;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}

.btn-soft-danger:hover{
  filter: brightness(1.05);
  text-decoration: none;
}

.order-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}