/* Carlinhos · painel de gestão — tema claro, sóbrio */
@font-face {
  font-family: "Inter";
  src: url(/static/fonts/inter.woff2) format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --sunken: #f7f8fa;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --text: #16202e;
  --text-2: #3b4656;
  --muted: #5b6675;
  --subtle: #8a94a3;
  --ink: #16202e;
  --ink-hover: #263449;
  --accent: #b7791f;
  --accent-soft: #fbf3e2;
  --ok: #1b6b43;
  --ok-bg: #e7f5ec;
  --warn: #85560a;
  --warn-bg: #fff3d6;
  --bad: #a8261c;
  --bad-bg: #fce9e7;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -.012em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ elementos base */
.meta { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.lbl, label.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 16px 0 6px; }
.lbl .meta { font-weight: 400; margin-left: 4px; }

input[type=text], input[type=password], select, textarea {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; font: inherit; font-size: 14.5px;
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #9aa3b0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(183, 121, 31, .16); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%235b6675' stroke-width='1.8'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: var(--radius-sm);
  padding: 9px 16px; font-weight: 600; font-size: 14px; transition: background .12s;
}
.primary:hover { background: var(--ink-hover); }
.primary:disabled { opacity: .55; cursor: default; }
.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 8px 14px; font-weight: 500; font-size: 14px; transition: background .12s, border-color .12s;
}
.ghost:hover { background: var(--sunken); border-color: #b9c0cb; color: var(--text); }
.ghost.small, .primary.small { padding: 5px 10px; font-size: 13px; }

.badge { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eef0f3; color: var(--muted); white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.badge b { font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.chip { display: inline-block; font: 500 12px/1 ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted); background: #eef0f3; border-radius: 6px; padding: 4px 7px; margin-left: 8px; vertical-align: 1px; }
.chip.kind { font-family: var(--font); font-weight: 600; letter-spacing: .02em; margin: 0 10px 0 0; color: var(--text-2); }

.error { margin: 0 0 6px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; color: var(--bad); background: var(--bad-bg); border: 1px solid #f3c6c1; }

/* ------------------------------------------------------------ estrutura (barra lateral) */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.brand img { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: #f1ede4; border: 1px solid var(--line); }
.brand strong { display: block; font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.brand small { display: block; color: var(--subtle); font-size: 12.5px; margin-top: 1px; }
.nav-title { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); padding: 8px 10px 6px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 14.5px; position: relative;
}
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: #f3f4f6; color: var(--text); }
.nav a.active { background: #eff1f4; color: var(--text); }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav a .ext { margin-left: auto; width: 13px; height: 13px; color: var(--subtle); }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 8px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.side-foot .who { min-width: 0; }
.side-foot .who b { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { color: var(--subtle); font-size: 12.5px; }
.side-foot a { color: var(--muted); font-size: 13.5px; font-weight: 500; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.side-foot a:hover { background: var(--sunken); color: var(--text); }

.main { min-width: 0; }
.head { padding: 30px 40px 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head h1 { font-size: 24px; font-weight: 650; }
.head p { margin: 5px 0 0; color: var(--muted); font-size: 14.5px; }
.head .when { color: var(--muted); font-size: 13.5px; text-align: right; }
.head .when b { display: block; color: var(--text); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.content { padding: 24px 40px 64px; max-width: 1140px; }

/* ------------------------------------------------------------ cartões e listas */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-h { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card-h h2 { font-size: 16px; font-weight: 650; }
.card-h .meta { margin-top: 3px; }
.card-b { padding: 4px 20px 22px; }
.card-h + .card-b { border-top: 1px solid var(--line); padding-top: 4px; }
.card-b > p { margin: 14px 0 0; color: var(--muted); font-size: 14px; }

.inst-list { display: block; }
.inst-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); }
.inst-row:first-child { border-top: 0; }
.card-h + .inst-list .inst-row:first-child { border-top: 1px solid var(--line); }
.inst-row .who { min-width: 0; flex: 1 1 260px; }
.inst-row .who b { font-size: 15px; font-weight: 600; }
.inst-row .who > div { color: var(--muted); font-size: 13.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.inst-row .act { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tool-desc { color: var(--muted); font-size: 13.5px; margin-top: 3px; font-weight: 400; }
.inst-list > .meta { padding: 18px 20px; }

.shortcuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 16px; margin-bottom: 20px; }
.shortcut { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s; }
a.shortcut:hover { border-color: var(--line-strong); box-shadow: 0 2px 8px rgba(16, 24, 40, .08); }
.shortcut .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 6px; }
.shortcut .ico svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shortcut h3 { font-size: 15.5px; font-weight: 650; }
.shortcut p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.shortcut .go { margin-top: 8px; color: var(--text); font-size: 14px; font-weight: 600; }
.shortcut .go::after { content: " →"; color: var(--accent); }

.link-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.link-row code, .link-row input { flex: 1; min-width: 0; }
.link-row code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--sunken); border: 1px solid var(--line); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------ separadores e formulários */
.picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 40px; margin-top: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.picker label { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0; }
.picker select { width: auto; min-width: 230px; }
.tabs { display: flex; gap: 2px; padding: 0 40px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 13px 14px 12px; margin-bottom: -1px; color: var(--muted); font-weight: 500; font-size: 14.5px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--ink); font-weight: 600; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btnrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btnrow.center { justify-content: flex-end; margin-top: 18px; }
.card-b .btnrow { margin-top: 20px; }

.switch { display: flex; align-items: center; gap: 12px; color: var(--text); font-size: 14.5px; margin: 16px 0 2px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 38px; height: 22px; border-radius: 999px; background: #c9ced6; position: relative; flex: none; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.digest { white-space: pre-wrap; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; margin: 16px 0 0; font: 13px/1.65 ui-monospace, "SF Mono", Menlo, monospace; color: var(--text-2); max-height: 440px; overflow: auto; }
.results { display: grid; gap: 10px; margin-top: 14px; }
.results:empty { display: none; }
.res { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; line-height: 1.55; color: var(--text-2); }
.res b { display: block; color: var(--text); margin-bottom: 4px; font-size: 13.5px; }
.res small { color: var(--subtle); }

.prow { display: grid; grid-template-columns: 1fr 1.6fr auto auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.prow label { margin: 0; font-size: 13px; display: flex; gap: 6px; align-items: center; color: var(--muted); white-space: nowrap; font-weight: 400; }
.prow input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--ink); }

/* ------------------------------------------------------------ janelas */
.modal { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; padding: 20px; background: rgba(17, 24, 39, .45); }
.modal.open { display: grid; }
.sheet { width: min(440px, 100%); max-height: 92vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; box-shadow: 0 24px 60px rgba(17, 24, 39, .25); }
.sheet h3 { font-size: 18px; font-weight: 650; margin-bottom: 6px; }
.sheet p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.sheet.wide-sheet { width: min(640px, 100%); }
.qrbox { width: 264px; height: 264px; margin: 4px auto 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; padding: 8px; }
.qrbox img { width: 100%; height: 100%; image-rendering: pixelated; }
.qrbox span { color: var(--muted); font-size: 14px; }
.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 3px; font-weight: 700; color: var(--text); }
.success { color: var(--ok); font-weight: 600; font-size: 17px; margin: 14px 0 18px; text-align: center; }
#m-body, #m-ok { text-align: center; }
#modal .sheet > .ghost { display: flex; margin: 8px auto 0; }

/* ------------------------------------------------------------ entrada (login) */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 46%) minmax(0, 1fr); background: var(--surface); }
.auth-art { background: #f3efe6; display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px 0; border-right: 1px solid #e8e2d4; overflow: hidden; }
.auth-art .cap strong { display: block; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.auth-art .cap span { display: block; color: #6b6556; font-size: 14.5px; margin-top: 4px; max-width: 320px; }
.auth-art img { display: block; width: min(430px, 88%); max-height: 70vh; object-fit: contain; margin: 0 auto; align-self: center; filter: drop-shadow(0 18px 24px rgba(60, 48, 20, .16)); }
.auth-form { display: grid; place-items: center; padding: 40px 28px; }
.auth-card { width: min(380px, 100%); }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; font-weight: 650; font-size: 16px; }
.auth-logo img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: #f1ede4; border: 1px solid var(--line); }
.auth-card h1 { font-size: 26px; font-weight: 650; margin-bottom: 6px; }
.auth-card .sub { margin: 0 0 24px; color: var(--muted); font-size: 15px; }
.field { position: relative; }
.toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: transparent; border: 0; color: var(--muted); padding: 6px 9px; border-radius: 6px; font-size: 13px; font-weight: 500; }
.toggle:hover { color: var(--text); background: var(--sunken); }
.row { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 4px; }
.check { display: flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 14px; margin: 0; font-weight: 400; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.auth-card .primary { width: 100%; margin-top: 20px; padding: 11px 16px; font-size: 15px; }
.auth-card .foot { margin: 22px 0 0; color: var(--subtle); font-size: 13px; }

/* ------------------------------------------------------------ ecrãs pequenos */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: 12px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand { padding: 0; flex: none; }
  .brand small, .nav-title { display: none; }
  .nav { display: flex; gap: 2px; flex: none; }
  .nav a.active::before { display: none; }
  .nav a .ext { display: none; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; flex: none; }
  .side-foot .who { display: none; }
  .head, .picker, .tabs { padding-left: 18px; padding-right: 18px; }
  .content { padding: 20px 18px 56px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 22px 24px 0; border-right: 0; border-bottom: 1px solid #e8e2d4; }
  .auth-art .cap span { display: none; }
  .auth-art img { width: 200px; max-height: 210px; }
}
@media (max-width: 560px) {
  .two, .prow { grid-template-columns: 1fr; }
  .head .when { text-align: left; }
}
