/* Private Admin — tema Grafite. Medidas e cores das referencias do design. */
:root {
  --bg: #111113; --sidebar: #0D0D0F; --surface: #161618; --raised: #1D1D20;
  --field: #18181B; --card-head: #141416;
  --border: #27272A; --border-strong: #2E2E33; --border-soft: #1F1F22; --border-active: #3A3A40;
  --text: #EDEDEF; --text-2: #A1A1AA; --text-3: #8B8B94; --placeholder: #7A7A83;
  --primary-bg: #EDEDEF; --primary-fg: #111113;
  --success: #4ADE80; --warning: #F5B84B; --error: #F87171; --info: #7CB4FF; --gray: #6B6B73;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  --sans: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px; }
a { color: #D4D4D8; }
a:hover { color: #FFFFFF; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }
input::placeholder { color: var(--placeholder); }
input:focus { outline: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.hidden { display: none !important; }

/* Layout */
.app { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar { flex: 1 1 208px; padding: 16px 12px; display: flex; flex-direction: column; gap: 20px; background: var(--sidebar); border-right: 1px solid var(--border-soft); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand img { display: block; border-radius: 5px; }
.brand .name { font-size: 14px; font-weight: 600; }
.brand .badge { padding: 1px 6px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 11px; color: var(--text-2); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { height: 36px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: 0; width: 100%; text-align: left; background: transparent; border-radius: 6px; color: var(--text-2); font-size: 13.5px; font-weight: 500; text-decoration: none; cursor: pointer; }
.nav-link:hover { background: var(--field); color: var(--text); }
.nav-link.active { background: var(--raised); color: var(--text); }
.nav-link.foot { margin-top: auto; color: var(--text-3); font-size: 13px; font-weight: 500; }
.main { flex: 999 1 560px; min-width: 0; padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; }

/* Cabecalho de pagina */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-head h1 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 600; }

/* Botoes */
.btn-primary { height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 6px; background: var(--primary-bg); color: var(--primary-fg); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn-primary:disabled { background: var(--raised); color: var(--text-3); cursor: default; }
.btn-outline { height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: transparent; color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; }
.btn-text { height: 32px; padding: 0 9px; border: 0; border-radius: 5px; background: transparent; color: var(--text-3); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.btn-text:hover { background: rgba(255,255,255,0.05); }
.btn-text.strong { color: var(--text); font-weight: 600; }
.btn-danger { height: 36px; padding: 0 4px; border: 0; background: transparent; color: var(--error); font-size: 13px; font-weight: 500; cursor: pointer; }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,0.06); }

/* Toolbar: busca + chips */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.search { height: 36px; flex: 0 1 300px; min-width: 200px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--field); color: var(--text-3); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: transparent; color: var(--text); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { height: 32px; padding: 0 10px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.chip.active { border-color: var(--border-active); background: var(--raised); color: var(--text); }
.chip .count { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.chip .count.warn { color: var(--warning); }

/* Tabela */
.table-card { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.table { min-width: 980px; }
.thead, .trow { display: grid; align-items: center; padding: 0 8px 0 16px; }
.table.licenses .thead, .table.licenses .trow { grid-template-columns: minmax(150px,1.1fr) minmax(190px,1.5fr) 64px 104px 112px 100px 136px 36px; }
.table.apps .thead, .table.apps .trow { grid-template-columns: minmax(220px,1.6fr) 120px minmax(160px,1fr) 130px 130px 36px; }
.thead { height: 40px; background: var(--card-head); color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.trow { height: 48px; border-top: 1px solid var(--border-soft); cursor: pointer; text-decoration: none; color: var(--text); }
.table.apps .trow { height: 64px; }
.trow:hover { background: var(--surface); }
.trow .key { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.trow .email, .trow .exp { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .apps-cell { display: flex; gap: 4px; }
.trow .apps-cell img { display: block; border-radius: 5px; }
.trow .seats { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.trow .last { color: var(--text-3); }
.status { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.dot { width: 6px; height: 6px; flex: none; border-radius: 999px; }
.chevron { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--text-3); }
.table-empty { margin: 0; padding: 28px 16px; border-top: 1px solid var(--border-soft); text-align: center; color: var(--text-3); }
.count-line { margin: 0; font-size: 12.5px; color: var(--text-3); }
.legend { margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.5; }

/* App cell */
.app-cell { display: flex; align-items: center; gap: 12px; }
.app-cell img, .app-cell .ph { width: 32px; height: 32px; flex: none; border-radius: 7px; display: block; }
.app-cell .ph { background: var(--raised); border: 1px solid var(--border-strong); }
.app-cell .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.app-cell .meta .nm { font-weight: 600; }
.app-cell .meta .id { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.archived { opacity: 0.5; }

/* Drawer */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%; display: flex; flex-direction: column; background: #141416; border-left: 1px solid var(--border); box-shadow: -24px 0 48px rgba(0,0,0,0.45); z-index: 50; }
.drawer-head { padding: 18px 16px 16px 24px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border-soft); }
.drawer-head .row1 { display: flex; align-items: center; gap: 10px; }
.drawer-head h2 { margin: 0; font-size: 16px; line-height: 1.2; font-weight: 600; }
.sbadge { height: 22px; padding: 0 8px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 12px; color: var(--text-2); }
.drawer-key { display: flex; align-items: center; gap: 6px; }
.drawer-key .k { font-family: var(--mono); font-size: 15px; letter-spacing: 0.04em; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 22px; }
.drawer-foot { padding: 14px 20px 14px 24px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border-soft); }
.spacer { flex: 1; }

/* Campos de formulario */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.input { height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--field); color: var(--text); font-size: 13px; }
.input.with-icon { display: flex; align-items: center; gap: 8px; color: var(--text-3); }
.input.with-icon input { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: transparent; color: var(--text); font-size: 13px; }
.field-error { font-size: 12px; color: var(--error); }
.hint { font-size: 11.5px; color: var(--text-3); }

/* Alerta (caixa ambar) */
.alert-box { margin: 0; display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px 10px 12px; border: 1px solid rgba(245,184,75,0.3); border-radius: 6px; background: rgba(245,184,75,0.07); font-size: 12.5px; line-height: 1.45; color: #E9D7B4; }
.alert-box strong { font-weight: 600; color: var(--warning); }
.alert-box .dismiss { height: 24px; padding: 0 6px; border: 0; border-radius: 4px; background: transparent; color: var(--warning); font-size: 12.5px; font-weight: 500; cursor: pointer; }

/* Toggle de app */
.app-toggle { height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px 0 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.app-toggle.on { border-color: var(--border-selected, rgba(237,237,239,0.55)); background: rgba(255,255,255,0.045); }
.app-toggle img { width: 26px; height: 26px; flex: none; border-radius: 6px; opacity: 0.55; }
.app-toggle .ph { width: 26px; height: 26px; flex: none; border-radius: 6px; background: var(--raised); border: 1px solid var(--border-strong); }
.app-toggle.on img { opacity: 1; }
.app-toggle .nm { flex: 1; font-size: 14px; font-weight: 600; }
.checkbox { width: 18px; height: 18px; flex: none; border-radius: 4px; border: 1.5px solid var(--border-checkbox, #4B4B52); display: flex; align-items: center; justify-content: center; }
.app-toggle.on .checkbox { background: var(--primary-bg); border-color: var(--primary-bg); }
.col { display: flex; flex-direction: column; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Stepper (- N +) */
.stepper { height: 32px; display: flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; background: var(--field); }
.stepper button { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.stepper .val { min-width: 48px; text-align: center; font-size: 12.5px; color: var(--text); }
.stepper .val .n { font-family: var(--mono); }

/* Computadores */
.computers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.computer { display: flex; align-items: flex-start; gap: 10px; padding: 10px 4px 10px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.comp-icon { width: 26px; height: 26px; flex: none; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--raised); display: flex; align-items: center; justify-content: center; color: var(--text-2); }
.comp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.comp-top { display: flex; align-items: baseline; gap: 8px; }
.comp-name { flex: none; font-size: 13.5px; font-weight: 600; }
.comp-id { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.comp-meta { font-size: 11.5px; color: var(--text-3); }
.comp-meta .warn { color: var(--warning); }

/* Ultimos acessos */
.access { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.access li { height: 30px; display: grid; grid-template-columns: 110px minmax(0,1fr) 104px 28px; align-items: center; gap: 8px; padding: 0 10px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--text-2); }
.access li:first-child { border-top: 0; }
.access .when { color: var(--text-3); }
.access .ip { font-family: var(--mono); font-size: 11px; }
.access .cc { font-family: var(--mono); font-size: 11px; }
.access-empty { padding: 14px 10px; color: var(--text-3); font-size: 12px; text-align: center; }

/* Segmentado */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--field); }
.segmented button { height: 34px; padding: 0 14px; border: 0; border-left: 1px solid var(--border); background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.segmented button:first-child { border-left: 0; }
.segmented button.on { background: var(--raised); color: var(--text); }

/* Switch */
.switch { width: 36px; height: 20px; flex: none; border-radius: 999px; border: 0; background: var(--raised); position: relative; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 999px; background: var(--text-3); transition: transform .12s, background .12s; }
.switch.on { background: var(--success); }
.switch.on::after { transform: translateX(16px); background: #0B2E17; }

/* Icon picker */
.icon-picker { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.icon-preview { width: 64px; height: 64px; border-radius: 12px; background: var(--raised); border: 1px solid var(--border-strong); object-fit: cover; }
.icon-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-opt { width: 44px; height: 44px; border-radius: 9px; border: 2px solid transparent; background: var(--raised); padding: 0; cursor: pointer; overflow: hidden; }
.icon-opt img { width: 100%; height: 100%; display: block; }
.icon-opt.on { border-color: var(--text); }
.icon-upload { width: 44px; height: 44px; border-radius: 9px; border: 1px dashed var(--border-strong); background: transparent; color: var(--text-3); display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* Toast */
.toast-host { position: fixed; left: 0; right: 0; bottom: 24px; display: flex; justify-content: center; pointer-events: none; z-index: 60; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--raised); border: 1px solid var(--border-strong); border-radius: 8px; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.toast .ok { color: var(--success); display: flex; }
.toast .undo { border: 0; background: transparent; color: var(--text); font-weight: 600; font-size: 12.5px; cursor: pointer; }

/* Login */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); z-index: 70; padding: 16px; }
.login-card { width: 340px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; padding: 28px 24px; border: 1px solid var(--border); border-radius: 12px; background: #141416; }
.login-brand { display: flex; align-items: center; gap: 10px; }
.login-brand img { width: 26px; height: 26px; border-radius: 6px; }
.login-brand .name { font-size: 16px; font-weight: 600; }
.login h1 { margin: 0; font-size: 17px; font-weight: 600; }
.login .sub { margin: 0; font-size: 12.5px; color: var(--text-3); }
