:root {
  --bg: #0b1220;
  --bg2: #121b2f;
  --card: #17233a;
  --line: #2a3a58;
  --text: #e8eef9;
  --muted: #93a0bb;
  --accent: #3d9cf0;
  --ok: #3ecf8e;
  --err: #f07178;
  --warn: #e6c07b;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font: 15px/1.45 "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
.side {
  position: fixed; inset: 0 auto 0 0; width: 220px; background: var(--bg2);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 16px;
}
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 28px; width: 100%; }
.brand-logo {
  display: block; width: 100%; max-width: 100%; height: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  box-sizing: border-box;
}
.side .brand { margin-bottom: 24px; }
.side .brand-logo { max-height: 52px; padding: 6px 8px; border-radius: 8px; }
.login-card .brand { justify-content: center; margin-bottom: 18px; }
.login-card .brand-logo { max-height: 88px; padding: 12px 16px; }
.side nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side nav .nav-group-label {
  margin: 12px 12px 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.side nav a { padding: 10px 12px; border-radius: 8px; color: var(--text); }
.side nav a.on, .side nav a:hover { background: #1e2c48; }
.logout { margin-top: auto; }
.logout button, button {
  background: #243352; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: transparent; color: #061018; font-weight: 600; }
button.btn-sm.primary, .btn-sm.primary {
  background: var(--accent); border-color: transparent; color: #061018; font-weight: 600;
}
button.danger, .btn.danger, .btn-sm.danger {
  background: #3d1820; border-color: #6b2a35; color: var(--err);
}
.profile-form label { margin-top: 12px; }
.org-edit .primary { height: 34px; }
.main { margin-left: 220px; padding: 28px 36px 60px; }
.top h1 { margin: 0 0 4px; font-size: 28px; font-weight: 600; }
.top p { margin: 0 0 24px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.cards-4 { grid-template-columns: repeat(4, 1fr); }
.cards-5 { grid-template-columns: repeat(5, 1fr); }
.cards article, .panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.cards strong { font-size: 32px; display: block; margin: 6px 0; }
.cards strong.backup-stamp { font-size: 18px; word-break: break-word; }
.cards small, .hint { color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plain { list-style: none; padding: 0; }
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.plain em { color: var(--muted); font-style: normal; margin-left: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; margin: 0; padding: 8px 14px; border-radius: 8px; background: #243352; color: var(--text); border: 1px solid var(--line); text-decoration: none; font: inherit; line-height: 1.2; cursor: pointer; }
.btn-sm, button.btn-sm, a.btn-sm {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; min-height: 34px; padding: 0 12px; margin: 0;
  border-radius: 8px; font-size: 13px; line-height: 1; box-sizing: border-box;
  white-space: nowrap;
}
a.btn-sm { background: #243352; color: var(--text); border: 1px solid var(--line); text-decoration: none; }
.btn-ghost { visibility: hidden; pointer-events: none; }
table { width: 100%; border-collapse: collapse; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form { display: inline-flex; margin: 0; }
.actions button, .actions .btn { margin: 0; }
.domain-list { margin-top: 12px; }
.domain-row { justify-content: space-between; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.domain-row:last-child { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }
.inline-reset { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-reset input { width: 140px; margin: 0; padding: 6px 8px; }
.access details { margin-bottom: 8px; }
.access summary { cursor: pointer; color: var(--accent); }
.access p { margin: 6px 0; }
.access .btn { margin-top: 6px; margin-right: 6px; padding: 6px 10px; font-size: 13px; }
.access form { margin-top: 6px; }
.access form.inline { margin-top: 8px; }

/* Compute — cartões de VM */
.vm-list { display: flex; flex-direction: column; gap: 12px; }
.vm-card {
  background: #121b2f; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 12px;
}
.vm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.vm-name { font-size: 16px; }
.vm-meta {
  display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--text); font-size: 13px;
}
.vm-meta em { color: var(--muted); font-style: normal; margin-right: 4px; }
.vm-access { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 16px; }
.vm-actions { padding-top: 4px; border-top: 1px solid var(--line); }
.vm-restore {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.vm-restore select {
  width: auto; min-width: 120px; height: 32px; padding: 0 8px; font-size: 12px;
}

.create-vm {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 2fr) auto;
  gap: 12px 16px;
  align-items: end;
}
.create-vm.create-vm-admin {
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 2fr) minmax(160px, 1fr) minmax(140px, 1fr) auto;
}
.create-vm-restore-toggle { grid-column: 1 / -2; align-self: center; }
.create-vm label { margin: 0; }
.create-vm-actions { display: flex; align-items: end; }
.create-vm-actions .primary { height: 40px; padding: 0 18px; white-space: nowrap; }
.pill { padding: 2px 8px; border-radius: 99px; font-size: 12px; background: #2a3a58; }
.pill.running { background: #143d2e; color: var(--ok); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; }
.dot.running { background: var(--ok); }
.banner { padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.banner.ok { background: #143d2e; color: var(--ok); }
.banner.err { background: #3d1820; color: var(--err); }
label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
label.check {
  display: flex; align-items: flex-start; gap: 8px; margin: 12px 0;
  color: var(--text); font-size: 13px; line-height: 1.35; cursor: pointer;
}
label.check input { width: auto; margin: 2px 0 0; flex-shrink: 0; }
input {
  width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #0e1728; color: var(--text);
}
.grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; }
.grid-plan { grid-template-columns: 2fr 3fr auto; }
select {
  width: 100%; margin-top: 4px; padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #0e1728; color: var(--text);
}
.muted { color: var(--muted); font-weight: 400; }
.login-body { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(1200px 500px at 20% -10%, #1a3a6a 0%, var(--bg) 55%); }
.login-card { width: 380px; background: var(--card); padding: 28px; border-radius: 16px; border: 1px solid var(--line); }
.login-card-wide { width: min(640px, 94vw); }
.login-card-wide .hint-top { margin: 0 0 14px; }
.login-card-wide .reg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.login-card-wide .reg-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.login-card-wide .reg-grid input { width: 100%; max-width: none; }
@media (max-width: 560px) {
  .login-card-wide .reg-grid { grid-template-columns: 1fr; }
}
.login-card h1 { font-size: 22px; margin: 8px 0 10px; }
.login-card > button[type="submit"],
.login-card button.primary {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: var(--accent);
  border: 0;
  color: #061018;
  font-weight: 700;
}
.login-card .login-links { margin-top: 16px; text-align: center; }
.login-card .login-links a { color: var(--accent); text-decoration: none; font-size: 14px; }
.login-card .login-links a:hover { text-decoration: underline; }
.login-card select {
  width: 100%; margin-top: 4px; margin-bottom: 10px; padding: 9px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #0e1728; color: var(--text);
}
.login-card .hint { margin-top: 14px; font-size: 12px; line-height: 1.4; }

/* Mostrar / ocultar palavra-passe — ícone dentro do campo */
.pw-field {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 4px;
  margin-bottom: 10px;
}
.pw-field > input[type="password"],
.pw-field > input[type="text"] {
  width: 100%;
  max-width: none;
  padding-right: 44px !important;
  box-sizing: border-box;
  margin: 0 !important;
}
button.pw-toggle {
  position: absolute !important;
  top: 50% !important;
  right: 4px !important;
  left: auto !important;
  transform: translateY(-50%) !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  color: var(--muted, #8aa0b8) !important;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
  font-weight: 400 !important;
  z-index: 2;
}
button.pw-toggle:hover,
button.pw-toggle.is-open {
  color: var(--accent, #3dd6c6) !important;
  background: rgba(255, 255, 255, 0.08) !important;
}
body.surface-light button.pw-toggle {
  color: #5f6368 !important;
}
body.surface-light button.pw-toggle:hover,
body.surface-light button.pw-toggle.is-open {
  color: #1967d2 !important;
  background: #f1f3f4 !important;
}
label:has(> .pw-field) {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-card-wide .reg-grid .pw-field {
  margin: 0;
}
.pw-match-msg {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--err, #f28b82);
  font-weight: 500;
}
.pw-match-msg[hidden] {
  display: none !important;
}
input.pw-mismatch,
.pw-field:has(input.pw-mismatch) > input {
  border-color: var(--err, #f28b82) !important;
  outline-color: var(--err, #f28b82);
}
body.surface-light .pw-match-msg {
  color: #c5221f;
}
.console-wrap { padding: 0; overflow: hidden; }
.console-frame { width: 100%; height: 72vh; border: 0; background: #000; display: block; }
@media (max-width: 960px) {
  .side { position: static; width: auto; }
  .main { margin: 0; padding: 20px 16px 48px; }
  .cards, .split, .grid { grid-template-columns: 1fr; }
  .cards-4, .cards-5 { grid-template-columns: 1fr; }
  .create-vm { grid-template-columns: 1fr; }
  .create-vm-actions .primary { width: 100%; }
  .vm-actions { gap: 8px; }
  .vm-actions .btn-sm, .vm-actions button.btn-sm { flex: 1 1 calc(50% - 8px); justify-content: center; }
}
@media (max-width: 560px) {
  .vm-actions .btn-sm, .vm-actions button.btn-sm, .vm-actions a.btn-sm, .vm-actions .btn-ghost {
    flex: 1 1 100%;
  }
}

/* Superfície clara (Compute / Drive) — sidebar continua escura */
body.surface-light {
  --g-blue: #1a73e8;
  --g-blue-hover: #1765cc;
  --g-bg: #f8f9fa;
  --g-surface: #ffffff;
  --g-border: #dadce0;
  --g-text: #202124;
  --g-muted: #5f6368;
  --g-row-hover: #f1f3f4;
  --g-ok: #137333;
  --g-ok-bg: #e6f4ea;
  --g-err: #c5221f;
  --g-warn: #ea8600;
}
body.surface-light .main {
  background: var(--g-bg);
  color: var(--g-text);
  min-height: 100vh;
}
body.surface-light .main a { color: var(--g-blue); }
body.surface-light .top h1 { color: var(--g-text); }
body.surface-light .top p,
body.surface-light .hint,
body.surface-light .muted { color: var(--g-muted); }
body.surface-light .banner.ok {
  background: var(--g-ok-bg);
  color: var(--g-ok);
  border: 1px solid #ceead6;
}
body.surface-light .banner.err {
  background: #fce8e6;
  color: var(--g-err);
  border: 1px solid #f5c2c0;
}
body.surface-light .panel {
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
  color: var(--g-text);
}
body.surface-light .btn,
body.surface-light button.btn-sm,
body.surface-light a.btn-sm,
body.surface-light button:not(.primary):not(.danger):not(.g-icon-btn):not(.tree-toggle):not(.drive-ctx-item):not(.drive-new-menu button) {
  background: var(--g-surface);
  color: var(--g-text);
  border: 1px solid var(--g-border);
}
body.surface-light button.primary,
body.surface-light .btn.primary,
body.surface-light .btn-sm.primary,
body.surface-light label.btn.primary {
  background: var(--g-blue);
  border-color: var(--g-blue);
  color: #fff;
  font-weight: 600;
}
body.surface-light button.primary:hover,
body.surface-light .btn.primary:hover {
  background: var(--g-blue-hover);
}
body.surface-light button.danger,
body.surface-light .btn.danger,
body.surface-light .btn-sm.danger {
  background: #fff;
  border-color: #f5c2c0;
  color: var(--g-err);
}
body.surface-light input,
body.surface-light select {
  background: #fff;
  color: var(--g-text);
  border: 1px solid var(--g-border);
}
body.surface-light label { color: var(--g-muted); }
body.surface-light label.check { color: var(--g-text); }
body.surface-light table th {
  color: var(--g-muted);
  font-weight: 500;
  font-size: 12px;
  border-bottom: 1px solid var(--g-border);
}
body.surface-light table td {
  border-bottom: 1px solid var(--g-border);
  color: var(--g-text);
}
body.surface-light code,
body.surface-light .mono { color: var(--g-text); }


/* Self-service Drive shell — ecrã completo estilo Google Drive */
body.drive-only-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: #fff;
}
body.drive-only-shell.drive-full {
  height: 100vh;
}
body.drive-only-shell .drive-app-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 8px 16px;
  border-bottom: 1px solid #dadce0;
  background: #fff;
  flex-shrink: 0;
}
body.drive-only-shell .drive-app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #5f6368;
  text-decoration: none;
  font: 400 22px/1 "Google Sans", "Segoe UI", system-ui, sans-serif;
  min-width: 120px;
}
body.drive-only-shell .drive-app-brand-img {
  height: 36px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
body.drive-only-shell .drive-app-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #4285f4 0 25%, #34a853 25% 50%, #fbbc04 50% 75%, #ea4335 75%);
}
body.drive-only-shell .drive-app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  flex: 1;
}
body.drive-only-shell .drive-app-nav a {
  color: #3c4043;
  text-decoration: none;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
}
body.drive-only-shell .drive-app-nav a:hover { background: #f1f3f4; }
body.drive-only-shell .drive-app-nav a.on {
  color: #1967d2;
  background: #e8f0fe;
  font-weight: 500;
}
body.drive-only-shell .drive-app-logout { margin: 0; }
body.drive-only-shell .drive-app-logout button {
  border: 1px solid #dadce0;
  background: #fff;
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #3c4043;
}
body.drive-only-shell .drive-only-main {
  flex: 1;
  max-width: none;
  margin: 0 !important;
  padding: 0 !important;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}
body.drive-only-shell .drive-only-main-flush {
  height: 100vh;
}
body.drive-only-shell .drive-only-main > .banner {
  margin: 8px 16px;
}
body.drive-only-shell .gdrive-page-full,
body.drive-only-shell .gdrive-shell-full {
  height: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #fff;
}
body.drive-only-shell .gdrive-page-full {
  display: flex;
  flex-direction: column;
  height: 100%;
}
body.drive-only-shell .gdrive-shell-full {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
