@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #edf1f4;
  --sidebar: #071827;
  --sidebar-hover: #1d3245;
  --card: #fff;
  --text: #0a2035;
  --muted: #6d7d8d;
  --line: #dce3e9;
  --primary: #102a43;
  --primary-hover: #1a3a56;
  --success: #287a50;
  --warning: #b9780b;
  --danger: #bd4545;
  --info: #285bd4;
  --focus: #4a8fe7;
  --sidebar-width: 270px;
  --sidebar-collapsed-width: 80px;
  --radius: 18px;
  --shadow: 0 12px 30px rgba(12, 34, 54, .07);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg,
video {
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  overflow: auto;
  padding: 22px 15px;
  background: var(--sidebar);
  color: #fff;
  transition: width .2s ease, padding .2s ease, transform .2s ease;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .22) transparent;
}

.brand {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.brand-logo {
  display: flex;
  width: 190px;
  height: 52px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 15px;
  background: transparent;
  cursor: pointer;
  transition: transform .18s ease;
}

.brand-logo:hover {
  transform: translateY(-1px);
}

.brand-logo img {
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.brand-logo-full {
  display: block;
  width: 188px;
}

.brand-logo-mini {
  display: none;
  width: 44px;
  height: 44px;
}

.menu {
  display: grid;
  gap: 15px;
}

.menu-section {
  display: grid;
  gap: 5px;
}

.menu-title {
  display: flex;
  width: 100%;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 9px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #91a6ba;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-align: left;
  text-transform: uppercase;
}

.menu-title:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.menu-title-left {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.submenu-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 10px;
  background: rgba(255, 255, 255, .07);
  color: #f3f7fb;
  font-size: 13px;
  line-height: 1;
}

.menu-section.is-active > .menu-title .submenu-icon,
.menu-title:hover .submenu-icon {
  border-color: rgba(255, 255, 255, .28);
  background: #fff;
  color: var(--sidebar);
}

.menu-chevron {
  flex: 0 0 auto;
  font-size: 14px;
  transition: transform .18s ease;
}

.submenu {
  display: grid;
  max-height: 520px;
  gap: 5px;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: max-height .2s ease, opacity .18s ease, visibility .18s ease;
}

.menu-section.is-collapsed .submenu {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.menu-section.is-collapsed .menu-chevron {
  transform: rotate(-90deg);
}

.menu a,
.menu-link {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #edf4fa;
  cursor: pointer;
  font-weight: 500;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}

.menu a:hover,
.menu a.active,
.menu-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.menu-icon {
  display: inline-flex;
  width: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.menu-form,
.inline-form,
.auth-links form {
  display: inline;
  margin: 0;
}

.sidebar-user {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding: 18px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, .09);
  color: #fff;
}

.sidebar-user strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user span {
  color: #9db0c1;
  font-size: 11px;
}

.sidebar-backdrop {
  display: none;
}

.content {
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: 24px clamp(18px, 2.3vw, 34px) 46px;
  transition: width .2s ease, margin-left .2s ease;
}

.topbar {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.user-pill {
  display: flex;
  min-width: 210px;
  min-height: 66px;
  align-items: center;
  gap: 11px;
  padding: 7px 18px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
}

.user-pill-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
}

.user-pill-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-pill strong,
.user-pill small {
  display: block;
}

.user-pill strong {
  max-width: 180px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.page-head {
  display: flex;
  min-height: 58px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 22px;
}

.page-head h1 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: clamp(25px, 2.1vw, 32px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.1;
}

.page-head p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card,
.dashboard-card,
.stat {
  border: 1px solid var(--line);
  background: var(--card);
}

.card,
.dashboard-card {
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  margin-bottom: 18px;
}

.card > :first-child,
.dashboard-card > :first-child {
  margin-top: 0;
}

.card > :last-child,
.dashboard-card > :last-child {
  margin-bottom: 0;
}

.card h2,
.card h3,
.dashboard-card h2 {
  margin: 0 0 15px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.015em;
}

.card h3 {
  margin-top: 22px;
}

.card p {
  overflow-wrap: anywhere;
}

.stat {
  min-height: 112px;
  padding: 18px 19px;
  border-radius: 16px;
}

.stat small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.stat strong,
.stat .stat-value {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.stat .helper {
  display: block;
  color: #82909e;
  font-size: 11px;
  line-height: 1.4;
}

.actions,
.panel-head,
.split {
  display: flex;
  align-items: center;
  gap: 8px;
}

.actions {
  flex-wrap: wrap;
}

.panel-head,
.split {
  justify-content: space-between;
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  transition: background .15s ease, transform .15s ease, opacity .15s ease;
}

.btn:hover {
  background: var(--primary-hover);
}

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

.btn:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.btn-light {
  background: #e9eef2;
  color: var(--text);
}

.btn-light:hover {
  background: #dce4ea;
}

.btn-danger {
  background: var(--danger);
}

.btn-success {
  background: var(--success);
}

.btn-warning {
  background: var(--warning);
}

.form {
  display: grid;
  gap: 16px;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 7px;
  color: #163049;
  font-size: 13px;
  font-weight: 600;
}

.field input:not([type='checkbox']):not([type='radio']),
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid #d2dce4;
  border-radius: 11px;
  outline: 0;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field input:not([type='checkbox']):not([type='radio']):focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(74, 143, 231, .13);
}

.field input[type='checkbox'],
.field input[type='radio'] {
  width: 18px;
  height: 18px;
  margin: 0 7px 0 0;
  accent-color: var(--primary);
  vertical-align: -3px;
}

.field label > label,
.field > label:has(input[type='checkbox']) {
  min-height: 44px;
  margin: 0;
  padding: 10px 0;
}

.help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

pre,
code {
  font-family: Consolas, 'Courier New', monospace;
}

pre {
  max-width: 100%;
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  background: #f3f6f8;
  color: #20364b;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.doc-lookup-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.doc-lookup-row input {
  min-width: 0;
  flex: 1;
}

.btn-doc-lookup {
  flex: 0 0 auto;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border-radius: 12px;
  background: #fff;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.table-wrap:focus-visible {
  outline-offset: 3px;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e3e9ee;
  color: #173047;
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f5f7f9;
  color: #486074;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

td.actions {
  min-width: 160px;
}

td a:not(.btn) {
  color: #174e88;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.badge {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.badge-primary {
  background: #dfe9ff;
  color: #204dbf;
}

.badge-info {
  background: #e3f2fd;
  color: #075985;
}

.badge-warning {
  background: #fff0d1;
  color: #855500;
}

.badge-danger {
  background: #fbe0e0;
  color: #932f2f;
}

.badge-success {
  background: #dcefe4;
  color: #185b3a;
}

.badge-soft {
  background: #e9eef2;
  color: #506477;
}

.alert {
  padding: 13px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.alert-success {
  border-color: #badfc9;
  background: #e3f3e9;
  color: #185b3a;
}

.alert-danger {
  border-color: #efc4c4;
  background: #fbe6e6;
  color: #8c3030;
}

.muted {
  color: var(--muted);
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.dashboard-page {
  display: grid;
  gap: 18px;
}

.dashboard-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.dashboard-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.chart-panel {
  min-height: 330px;
}

.month-chart {
  display: grid;
  height: 260px;
  grid-template-columns: repeat(6, minmax(42px, 1fr));
  align-items: end;
  gap: clamp(8px, 1.4vw, 18px);
  padding-top: 12px;
}

.month-chart-item {
  display: grid;
  height: 100%;
  min-width: 0;
  grid-template-rows: 22px 1fr 24px;
  align-items: end;
  gap: 5px;
  text-align: center;
}

.month-chart-item strong {
  color: #3e566b;
  font-size: 12px;
}

.month-chart-track {
  display: flex;
  width: min(42px, 100%);
  height: 100%;
  align-items: flex-end;
  justify-self: center;
  overflow: hidden;
  border-radius: 10px 10px 4px 4px;
  background: #e6ebef;
}

.month-chart-track span {
  display: block;
  width: 100%;
  min-height: 6px;
  border-radius: inherit;
  background: linear-gradient(180deg, #244d70, #102a43);
}

.month-chart-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-list,
.bar-list {
  display: grid;
  gap: 13px;
}

.finance-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.bar-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
}

.bar-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.bar-value {
  color: #3d5367;
  font-size: 12px;
}

.bar-track {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe6eb;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(7, minmax(248px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}

.kanban-col {
  min-height: 460px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #f3f6f8;
  scroll-snap-align: start;
  transition: border-color .18s ease, background .18s ease;
}

.kanban-col h3 {
  margin: 3px 3px 12px;
  font-size: 14px;
}

.kanban-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  margin-bottom: 11px;
  background: #fff;
  cursor: grab;
  transition: opacity .18s ease, transform .18s ease, box-shadow .18s ease;
}

.kanban-card p {
  margin: 7px 0;
  overflow-wrap: anywhere;
}

.kanban-card.is-dragging {
  opacity: .55;
  transform: scale(.985);
  box-shadow: 0 18px 38px rgba(8, 25, 44, .16);
}

.kanban-card.is-saving {
  opacity: .72;
  pointer-events: none;
}

.kanban-col.is-drag-over {
  border-color: #51728e;
  background: #e5edf3;
}

.kanban-col::after {
  display: none;
  padding: 12px;
  border: 1px dashed #8da2b4;
  border-radius: 12px;
  margin-top: 8px;
  color: #52687d;
  content: 'Solte aqui';
  text-align: center;
}

.kanban-col.is-drag-over::after {
  display: block;
}

.kanban-actions {
  align-items: stretch;
}

.kanban-actions .btn {
  min-height: 32px;
  padding: 7px 9px;
  font-size: 10px;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  min-width: 0;
  padding-left: 14px;
  border-left: 3px solid #d5e0e8;
}

.timeline-item p {
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tab-pill {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e7edf1;
  color: #516577;
  font-weight: 600;
}

.tab-pill.active {
  background: var(--primary);
  color: #fff;
}

.fab-wrap {
  position: fixed;
  right: 24px;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 950;
  display: grid;
  justify-items: end;
  gap: 10px;
}

.fab-main {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 14px 34px rgba(7, 30, 52, .23);
  color: #fff;
  cursor: pointer;
  font-size: 29px;
}

.fab-menu {
  min-width: 160px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(7, 30, 52, .14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}

.fab-wrap.is-open .fab-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.fab-menu a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 700;
}

.fab-menu a:hover {
  background: #edf2f5;
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
  align-items: center;
  padding: 18px 12px;
  overflow: hidden;
}

body.sidebar-collapsed .content {
  width: calc(100% - var(--sidebar-collapsed-width));
  margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand {
  width: 100%;
  margin-bottom: 18px;
}

body.sidebar-collapsed .brand-logo {
  width: 46px;
  height: 46px;
}

body.sidebar-collapsed .brand-logo-full,
body.sidebar-collapsed .submenu-name,
body.sidebar-collapsed .menu-chevron,
body.sidebar-collapsed .submenu,
body.sidebar-collapsed .sidebar-user {
  display: none;
}

body.sidebar-collapsed .brand-logo-mini {
  display: block;
}

body.sidebar-collapsed .menu,
body.sidebar-collapsed .menu-section {
  width: 100%;
}

body.sidebar-collapsed .menu-title {
  width: 48px;
  height: 48px;
  min-height: 48px;
  justify-content: center;
  padding: 0;
  margin: 0 auto;
}

body.sidebar-collapsed .menu-title-left {
  justify-content: center;
}

body.sidebar-collapsed .submenu-icon {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-radius: 12px;
}

/* Login, portal, instalador e diagnóstico */
.auth-page,
.install-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: #03162a;
}

.auth-page {
  display: grid;
  place-items: center;
  position: relative;
  overflow: auto;
}

.auth-bg-video,
.auth-overlay {
  position: fixed;
  inset: 0;
}

.auth-bg-video {
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.63) saturate(1.05);
  transform: scale(1.025);
}

.auth-overlay {
  z-index: 1;
  background:
    radial-gradient(circle at center bottom, rgba(32, 127, 171, .22), transparent 30%),
    linear-gradient(180deg, rgba(1, 13, 29, .33), rgba(1, 13, 29, .72));
}

.auth-card,
.install-card {
  width: min(430px, 100%);
  border: 1px solid rgba(145, 175, 211, .32);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(27, 52, 98, .93), rgba(28, 69, 118, .87));
  box-shadow: 0 24px 80px rgba(0, 0, 0, .32);
  color: #fff;
}

.auth-card {
  position: relative;
  z-index: 2;
  padding: 32px;
  backdrop-filter: blur(8px);
  text-align: center;
}

.auth-badge {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  overflow: hidden;
  margin: 0 auto 14px;
  border-radius: 18px;
}

.auth-badge img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-title,
.install-card h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
}

.auth-subtitle {
  margin: 7px 0 24px;
  color: rgba(255, 255, 255, .8);
  font-size: 13px;
}

.auth-form {
  gap: 14px;
  text-align: left;
}

.auth-field label {
  color: #f6f8fb;
}

.auth-field input:not([type='checkbox']):not([type='radio']) {
  height: 50px;
  border-color: rgba(180, 201, 226, .35);
  border-radius: 15px;
  background: rgba(108, 138, 184, .27);
  color: #fff;
}

.auth-field input::placeholder {
  color: rgba(241, 245, 249, .68);
}

.auth-submit {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: #0d2441;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
  color: rgba(255, 255, 255, .82);
  font-size: 12px;
}

.auth-links a,
.auth-links button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.auth-card .alert {
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .13);
  color: #fff;
  text-align: left;
}

.install-page {
  display: grid;
  place-items: center;
  overflow: auto;
}

.install-card {
  padding: 30px;
}

.install-card > p {
  color: rgba(255, 255, 255, .78);
}

.install-card h2 {
  margin: 24px 0 12px;
  font-size: 15px;
}

.install-card .help {
  color: rgba(255, 255, 255, .72);
}

.install-card .btn-light {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.diagnostic-card {
  width: min(720px, 100%);
}

.credential-box,
.check-list {
  display: grid;
  gap: 9px;
}

.credential-box {
  margin: 16px 0;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 13px;
  background: rgba(255, 255, 255, .1);
}

.credential-box span,
.credential-box small {
  color: rgba(255, 255, 255, .72);
  font-size: 11px;
}

.credential-box strong {
  overflow-wrap: anywhere;
}

.check-ok,
.check-fail {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
}

.check-ok {
  background: rgba(61, 173, 112, .19);
}

.check-fail {
  background: rgba(209, 76, 76, .2);
}

.check-ok > span,
.check-fail > span {
  grid-row: 1 / span 2;
  font-size: 17px;
  font-weight: 800;
}

.check-ok small,
.check-fail small {
  grid-column: 2;
  color: rgba(255, 255, 255, .72);
}

.table-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.sidebar-search {
  display: none;
}

.topbar {
  gap: 18px;
  justify-content: space-between;
}

.global-search {
  display: flex;
  width: min(620px, 100%);
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 8px 22px rgba(12, 34, 54, .04);
  color: #64788a;
}

.global-search input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.global-search kbd {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #d6dee5;
  border-bottom-width: 2px;
  border-radius: 7px;
  background: #f4f7f9;
  color: #748696;
  font: 600 12px/1 'Poppins', sans-serif;
}

.global-search-large {
  width: 100%;
}

.global-search-large .btn {
  flex: 0 0 auto;
}

.stat-link {
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.stat-link:hover,
.stat-link:focus-visible {
  border-color: #b8c8d6;
  box-shadow: 0 14px 32px rgba(12, 34, 54, .1);
  transform: translateY(-2px);
}

.template-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 15px;
  border: 1px solid #d8e3eb;
  border-radius: 14px;
  background: #f6f9fb;
}

.template-picker .btn {
  margin-bottom: 1px;
}

.form-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.form-tab {
  min-height: 40px;
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: #e9eef2;
  color: #52687b;
  cursor: pointer;
  font-weight: 700;
}

.form-tab.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.form-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 5px 0;
}

.form-panel[hidden] {
  display: none;
}

.panel-intro {
  display: grid;
  gap: 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e7edf1;
}

.panel-intro strong {
  font-size: 15px;
}

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

.portal-toggle {
  padding: 13px 15px;
  border: 1px solid #d9e3ea;
  border-radius: 12px;
  background: #f6f9fb;
}

.form-footer {
  position: sticky;
  z-index: 5;
  bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 30px rgba(7, 30, 52, .1);
  backdrop-filter: blur(8px);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 13px;
}

.filter-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.active-filter-note {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
  color: #4a6175;
  font-size: 12px;
}

.active-filter-note a {
  color: #174e88;
  font-weight: 700;
  text-decoration: underline;
}

.list-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 13px;
  color: #53697b;
  font-size: 12px;
}

.list-summary > strong {
  margin-right: -7px;
  color: var(--text);
  font-size: 15px;
}

.list-summary span {
  margin-left: auto;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  padding-top: 18px;
}

.page-link {
  display: inline-grid;
  min-width: 38px;
  min-height: 38px;
  place-items: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #40596e;
  font-weight: 700;
}

.page-link:hover,
.page-link.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.page-link.disabled {
  pointer-events: none;
  opacity: .42;
}

.search-page-card {
  padding: 12px;
}

.search-summary {
  margin: 0 0 14px;
  color: #53697b;
}

.search-results {
  display: grid;
  gap: 6px;
}

.search-result {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: border-color .15s ease, background .15s ease;
}

.search-result:hover,
.search-result:focus-visible {
  border-color: #d8e2e9;
  background: #f4f7f9;
}

.search-result-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: #e5edf3;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result small {
  margin-top: 3px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.kanban-move-form {
  display: none;
  gap: 6px;
  margin-top: 12px;
}

.kanban-move-form label {
  color: #52687b;
  font-size: 11px;
  font-weight: 700;
}

.kanban-move-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.kanban-move-form select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #d2dce4;
  border-radius: 10px;
  background: #fff;
}

.fab-menu {
  min-width: 205px;
}

@media (max-width: 1200px) {
  .grid-4,
  .dashboard-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-main {
    grid-template-columns: 1fr;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    padding-top: 0;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  .sidebar,
  body.sidebar-collapsed .sidebar {
    inset: 0 0 auto 0;
    width: 100%;
    height: 100dvh;
    align-items: stretch;
    padding: max(14px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
    overflow: auto;
  }

  body.sidebar-collapsed .sidebar {
    height: calc(76px + env(safe-area-inset-top));
    padding: max(14px, env(safe-area-inset-top)) 16px 14px;
    overflow: hidden;
  }

  .brand,
  body.sidebar-collapsed .brand {
    width: 100%;
    min-height: 48px;
    justify-content: flex-start;
    margin: 0 0 18px;
  }

  body.sidebar-collapsed .brand {
    margin: 0;
  }

  .brand-logo {
    width: 188px;
    height: 48px;
    justify-content: flex-start;
  }

  body.sidebar-collapsed .brand-logo {
    width: 48px;
    height: 48px;
    justify-content: flex-start;
  }

  .brand-logo-full {
    display: block;
    width: 188px;
    max-width: none;
  }

  .brand-logo-mini {
    display: none;
  }

  body.sidebar-collapsed .brand-logo-full {
    display: none;
  }

  body.sidebar-collapsed .brand-logo-mini {
    display: block;
    width: 48px;
    height: 48px;
  }

  body.sidebar-collapsed .menu,
  body.sidebar-collapsed .sidebar-user,
  body.sidebar-collapsed .sidebar-search {
    display: none;
  }

  .sidebar-search {
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    padding: 4px 5px 4px 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
  }

  .sidebar-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
  }

  .sidebar-search input::placeholder {
    color: rgba(255, 255, 255, .62);
  }

  .sidebar-search button {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 0;
    border-radius: 10px;
    background: #fff;
    color: var(--sidebar);
    cursor: pointer;
  }

  .menu {
    width: 100%;
  }

  .menu-title,
  body.sidebar-collapsed .menu-title {
    width: 100%;
    min-height: 44px;
    justify-content: space-between;
    margin: 0;
    padding: 6px 8px;
  }

  .menu-title-left {
    justify-content: flex-start;
  }

  .submenu-name,
  .menu-chevron {
    display: inline;
  }

  .sidebar-user {
    padding-bottom: 8px;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: block;
    border: 0;
    background: rgba(1, 11, 22, .52);
    opacity: 1;
  }

  body.sidebar-collapsed .sidebar-backdrop {
    display: none;
  }

  .content,
  body.sidebar-collapsed .content {
    width: 100%;
    margin-left: 0;
    padding: calc(96px + env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  }

  .topbar {
    display: none;
  }

  .page-head {
    min-height: 0;
    margin-bottom: 18px;
  }

  .kanban {
    grid-template-columns: repeat(7, minmax(82vw, 1fr));
  }

  .kanban-actions {
    display: none;
  }

  .kanban-move-form {
    display: grid;
  }

  .fab-wrap {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
  }

  .fab-main {
    width: 54px;
    height: 54px;
  }
}

@media (max-width: 700px) {
  .grid-2,
  .grid-3,
  .grid-4,
  .dashboard-row,
  .dashboard-main,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .page-head,
  .split,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .page-head .actions,
  .split .actions {
    width: 100%;
  }

  .page-head .actions .btn {
    flex: 1 1 auto;
  }

  .card,
  .dashboard-card {
    padding: 17px;
    border-radius: 15px;
  }

  .stat {
    min-height: 98px;
  }

  .stat strong,
  .stat .stat-value {
    font-size: 24px;
  }

  .doc-lookup-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn-doc-lookup {
    width: 100%;
  }

  .month-chart {
    gap: 7px;
  }

  .month-chart-item small {
    font-size: 9px;
  }

  .auth-page,
  .install-page {
    align-items: start;
    padding: 16px;
  }

  .auth-card,
  .install-card {
    margin: auto 0;
    padding: 25px 20px;
    border-radius: 21px;
  }

  .table-status-grid {
    grid-template-columns: 1fr;
  }

  .template-picker {
    grid-template-columns: 1fr;
  }

  .template-picker .btn,
  .filter-actions .btn {
    width: 100%;
  }

  .filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .global-search-large {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .global-search-large .btn {
    grid-column: 1 / -1;
    width: 100%;
  }
}

@media (max-width: 430px) {
  .content,
  body.sidebar-collapsed .content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .page-head h1 {
    font-size: 24px;
  }

  .actions > .btn,
  .actions > .inline-form,
  .actions > .inline-form .btn {
    flex: 1 1 auto;
  }

  td .actions {
    flex-wrap: nowrap;
  }

  .month-chart {
    height: 220px;
  }

  .kanban {
    grid-template-columns: repeat(7, minmax(88vw, 1fr));
  }

  .filter-actions {
    grid-template-columns: 1fr;
  }

  .list-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .list-summary span {
    margin-left: 0;
  }

  .search-result {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    padding: 8px;
  }

  .search-result-icon {
    width: 38px;
    height: 38px;
  }
}

@media (max-height: 640px) {
  .auth-page {
    place-items: start center;
  }

  .auth-card {
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }

  .auth-bg-video {
    display: none;
  }
}
