/* ==========================================================================
   GuugTask — Identidade visual Guug sobre o padrão de front do sistema-gestao
   ========================================================================== */

:root {
  /* Cores da marca Guug */
  --accent:        #3AB5E6;
  --accent-dark:   #1E97C9;
  --accent-dim:    rgba(58, 181, 230, .13);
  --accent-border: rgba(58, 181, 230, .35);

  --green:      #22C55E;
  --green-dim:  rgba(34, 197, 94, .13);
  --red:        #E5484D;
  --red-dim:    rgba(229, 72, 77, .12);
  --blue:       #3B82F6;
  --blue-dim:   rgba(59, 130, 246, .13);
  --yellow:     #F59E0B;
  --yellow-dim: rgba(245, 158, 11, .13);
  --purple:     #8B5CF6;

  /* Superfícies claras */
  --bg:        #EEF2F8;
  --surface-1: #FFFFFF;
  --surface-2: #F6F9FD;
  --surface-3: #EAF1F9;
  --surface-4: #DCE6F2;
  --border:    rgba(16, 25, 55, .08);
  --border-2:  rgba(16, 25, 55, .15);
  --txt:       #1C2337;
  --txt-muted: #5A6A80;
  --txt-dim:   #93A2B5;

  /* Sidebar escura (identidade Guug) */
  --sb-bg:       #232849;
  --sb-bg-2:     #1C2140;
  --sb-border:   rgba(255, 255, 255, .08);
  --sb-txt:      rgba(255, 255, 255, .62);
  --sb-txt-dim:  rgba(255, 255, 255, .34);
  --sb-hover:    rgba(255, 255, 255, .07);

  --sidebar-w:         262px;
  --sidebar-compact-w: 76px;
  --radius:    10px;
  --radius-lg: 14px;
  --transition: .28s cubic-bezier(.4, 0, .2, 1);

  --shadow-sm: 0 1px 2px rgba(16, 25, 55, .06);
  --shadow-md: 0 8px 22px rgba(16, 25, 55, .09);

  --font-body: 'Segoe UI', Inter, system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--txt);
  line-height: 1.55;
  min-height: 100vh;
  padding-left: var(--sidebar-w);
  transition: padding-left var(--transition);
  overflow-x: clip;
}

body.sidebar-compact { padding-left: var(--sidebar-compact-w); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }

.flex { display: flex; align-items: center; }

svg { flex-shrink: 0; }

/* ==========================================================================
   SIDEBAR (padrão sistema-gestao, cores Guug)
   ========================================================================== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%);
  padding: 16px 12px;
  border-right: 1px solid var(--sb-border);
  transition: all .4s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.sidebar.close { width: var(--sidebar-compact-w); }

.logo_items {
  gap: 8px;
  height: 48px;
  justify-content: space-between;
  flex-shrink: 0;
}

.brand_lockup { gap: 10px; min-width: 0; }

.nav_image {
  display: flex;
  min-width: 52px;
  justify-content: center;
}

.brand-logo {
  height: 30px;
  width: auto;
  object-fit: contain;
  display: block;
}

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

.logo_name {
  font-size: 1.25rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: opacity .3s ease;
}

.logo_name strong { color: var(--accent); font-weight: 700; }

#lock-icon {
  background: none;
  border: 0;
  padding: 9px;
  color: var(--accent);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease, opacity .3s ease;
}

#lock-icon:hover { background: var(--sb-hover); }
#lock-icon svg { width: 19px; height: 19px; }

.sidebar.close .logo_name,
.sidebar.close #lock-icon {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

.menu_container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-top: 18px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.menu_items {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.menu_items::-webkit-scrollbar { display: none; }

.menu_item { list-style: none; }

.menu_title {
  position: relative;
  height: 44px;
  width: 52px;
  display: flex;
  align-items: center;
}

.menu_title .title {
  margin-left: 14px;
  color: var(--sb-txt-dim);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity .3s ease;
}

.menu_title .line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 3px;
  width: 18px;
  border-radius: 25px;
  background: var(--sb-txt-dim);
  opacity: 0;
  transition: opacity .3s ease;
}

.sidebar.close .menu_title .title { opacity: 0; }
.sidebar.close .menu_title .line { opacity: 1; }

.item { list-style: none; }

.link {
  border-radius: var(--radius);
  margin-bottom: 6px;
  color: var(--sb-txt);
  min-height: 46px;
  font-size: .9rem;
  font-weight: 500;
  transition: background .2s ease, color .2s ease;
  overflow: hidden;
  white-space: nowrap;
}

.link:hover { color: #fff; background: var(--sb-hover); }

.link.active {
  color: #0B2635;
  background: var(--accent);
  font-weight: 600;
}

.link .link-icon {
  height: 46px;
  min-width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.link .link-icon svg { width: 20px; height: 20px; }

.link .link-icon { position: relative; }

/* Contador de notificações no menu lateral */
.nav-badge {
  margin-left: auto;
  margin-right: 12px;
  background: var(--red);
  color: #fff;
  font-size: .64rem;
  font-weight: 800;
  border-radius: 99px;
  min-width: 20px;
  padding: 1px 6px;
  text-align: center;
  line-height: 1.6;
  flex-shrink: 0;
}

.link.active .nav-badge { background: #fff; color: var(--red); }

/* Ponto de aviso visível no modo compacto, quando o texto some */
.link-dot {
  position: absolute;
  top: 9px;
  right: 11px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--sb-bg);
  opacity: 0;
  transition: opacity .2s ease;
}

.sidebar.close .link-dot { opacity: 1; }
.sidebar.close .nav-badge { opacity: 0; width: 0; padding: 0; margin: 0; overflow: hidden; }

.link span:not(.link-icon) { transition: opacity .2s ease; }

.sidebar.close .link span:not(.link-icon),
.sidebar.close .data_text {
  opacity: 0;
  pointer-events: none;
}

.sidebar_footer {
  padding-top: 10px;
  margin-top: 12px;
  border-top: 1px solid var(--sb-border);
  overflow: hidden;
  flex-shrink: 0;
}

.logout_form { width: 100%; }

.logout_link {
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  margin-bottom: 4px;
}

.logout_link:hover {
  background: var(--red-dim);
  color: #F87171;
}

.sidebar_profile {
  gap: 0;
  overflow: hidden;
  min-width: 0;
}

.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1.5px solid var(--accent-border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}

.sidebar_profile .data_text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: opacity .2s ease;
}

.sidebar_profile .name {
  font-size: .88rem;
  color: #fff;
  font-weight: 600;
  max-width: 128px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar_profile .role {
  font-size: .72rem;
  color: var(--sb-txt);
  white-space: nowrap;
}


/* ==========================================================================
   ESTRUTURA PRINCIPAL
   ========================================================================== */

.main-wrapper { min-height: 100vh; }

.main-content {
  padding: 22px;
  background: var(--bg);
  width: 100%;
  max-width: 100%;
}

.app-view {
  width: 100%;
  min-height: calc(100vh - 44px);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.app-view > * { max-width: 100%; min-width: 0; }

/* Cabeçalho de página */
.page-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: clamp(1.15rem, 1rem + .5vw, 1.45rem);
  font-weight: 800;
  line-height: 1.25;
}

.page-header p {
  color: var(--txt-muted);
  font-size: .85rem;
  margin-top: 3px;
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header-row > div { min-width: 0; }

.page-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   CARDS, GRIDS E MÉTRICAS
   ========================================================================== */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}

.card-title {
  font-size: .78rem;
  color: var(--txt-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
  margin-bottom: 12px;
}

.section-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--txt);
}

.section-hd small { color: var(--txt-muted); font-size: .78rem; }

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

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 168px), 1fr));
  gap: 12px;
}

.stat {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}

.stat-label {
  font-size: .72rem;
  color: var(--txt-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 700;
  margin-bottom: 4px;
}

.stat-link {
  display: block;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.stat-link:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.bar-link {
  display: block;
  border-radius: 8px;
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background .15s ease;
}

.bar-link:hover { background: var(--accent-dim); }

.stat-value { font-size: 1.45rem; font-weight: 800; color: var(--txt); }
.stat-value.accent { color: var(--accent-dark); }
.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }
.stat-value.yellow { color: var(--yellow); }

/* Lista de barras (dashboard) */
.bar-list { display: flex; flex-direction: column; gap: 12px; }

.bar-row .bar-label {
  display: flex;
  justify-content: space-between;
  font-size: .84rem;
  margin-bottom: 5px;
}

.bar-row .bar-label strong { font-weight: 700; }

.bar-track {
  height: 8px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  min-width: 2px;
  transition: width .4s ease;
}

/* Barra de progresso de tarefa */
.progress-wrap { display: flex; align-items: center; gap: 10px; min-width: 120px; }

.progress-track {
  flex: 1;
  height: 8px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  min-width: 64px;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width .4s ease;
}

.progress-fill.done { background: var(--green); }

.progress-value {
  font-size: .78rem;
  font-weight: 700;
  color: var(--txt-muted);
  min-width: 38px;
  text-align: right;
}

.progress-lg .progress-track { height: 12px; }
.progress-lg .progress-value { font-size: .9rem; color: var(--txt); }

/* ==========================================================================
   BOTÕES
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}

.btn svg { width: 16px; height: 16px; }

.btn-accent {
  background: var(--accent);
  color: #0B2635;
  box-shadow: 0 6px 14px rgba(58, 181, 230, .25);
}

.btn-accent:hover {
  background: var(--accent-dark);
  color: #fff;
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  color: var(--txt-muted);
}

.btn-outline:hover {
  border-color: var(--accent-border);
  color: var(--accent-dark);
  background: var(--accent-dim);
}

.btn-dark {
  background: var(--sb-bg);
  color: #fff;
}

.btn-dark:hover { background: var(--sb-bg-2); }

.btn-red {
  background: var(--red-dim);
  border: 1px solid rgba(229, 72, 77, .25);
  color: var(--red);
}

.btn-red:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .82rem; }

.btn-icon {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
}

.btn-block { width: 100%; }

/* ==========================================================================
   FORMULÁRIOS
   ========================================================================== */

label {
  display: block;
  font-size: .84rem;
  color: var(--txt);
  font-weight: 600;
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  min-height: 44px;
  background: var(--surface-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--txt);
  padding: 10px 13px;
  font-size: .94rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(58, 181, 230, .16);
}

.form-control::placeholder { color: var(--txt-dim); }

textarea.form-control { min-height: 110px; resize: vertical; }

select.form-control option { background: #fff; color: #111; }

.form-hint { font-size: .76rem; color: var(--txt-muted); margin-top: 4px; }

.form-group { margin-bottom: 14px; min-width: 0; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.input-group { position: relative; min-width: 0; }
.input-group .form-control { padding-left: 42px; }

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--txt-dim);
  display: inline-flex;
}

.input-icon svg { width: 17px; height: 17px; }

/* ==========================================================================
   ALERTAS E BADGES
   ========================================================================== */

.alert {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: .86rem;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; }

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  font-size: 1rem;
  opacity: .6;
  line-height: 1;
}

.alert-success { background: var(--green-dim);  border: 1px solid rgba(34,197,94,.3);  color: #14622F; }
.alert-danger  { background: var(--red-dim);    border: 1px solid rgba(229,72,77,.3);  color: #99262A; }
.alert-warning { background: var(--yellow-dim); border: 1px solid rgba(245,158,11,.3); color: #8A5A08; }
.alert-info    { background: var(--blue-dim);   border: 1px solid rgba(59,130,246,.3); color: #1D4FB8; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
}

.badge-soft {
  background: color-mix(in srgb, var(--chip, var(--accent)) 14%, #fff);
  color: color-mix(in srgb, var(--chip, var(--accent)) 82%, #000);
  border: 1px solid color-mix(in srgb, var(--chip, var(--accent)) 32%, #fff);
}

.badge-active   { background: var(--green-dim); color: var(--green); }
.badge-inactive { background: var(--red-dim); color: var(--red); }
.badge-muted    { background: var(--surface-3); color: var(--txt-muted); }

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chip, var(--accent));
  display: inline-block;
  flex-shrink: 0;
}

/* ==========================================================================
   TABELAS
   ========================================================================== */

.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

thead th {
  padding: 12px 14px;
  text-align: center;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--txt-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}

/* Cabeçalhos ordenáveis por clique */
thead th[data-sortable="1"] {
  cursor: pointer;
  user-select: none;
  transition: color .15s ease, background .15s ease;
}

thead th[data-sortable="1"]:hover,
thead th[data-sortable="1"]:focus-visible {
  color: var(--accent-dark);
  background: var(--accent-dim);
  outline: none;
}

thead th[data-sort-direction] { color: var(--accent-dark); }
thead th[data-sort-direction="asc"]::after { content: ' ▲'; font-size: .6rem; }
thead th[data-sort-direction="desc"]::after { content: ' ▼'; font-size: .6rem; }

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
  text-align: center;
}

/* Conteúdo composto também centralizado sob o cabeçalho da coluna */
td .progress-wrap { justify-content: center; margin-inline: auto; }
td .badge { margin-inline: auto; }

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(58, 181, 230, .05); }

td[colspan] { white-space: normal; color: var(--txt-muted); }

.record-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--txt);
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-inline: auto;
  text-align: center;
}

.record-title-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 300px;
  margin-inline: auto;
}

.record-title-line .record-title {
  min-width: 0;
  margin-inline: 0;
}

a.record-title:hover { color: var(--accent-dark); }

.record-subtitle {
  font-size: .76rem;
  color: var(--txt-muted);
  display: block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-inline: auto;
  text-align: center;
}

/* ==========================================================================
   DASHBOARD — lista compacta
   ========================================================================== */

.compact-list { display: flex; flex-direction: column; }

.compact-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.compact-item:last-child { border-bottom: none; }
.compact-item:hover { background: rgba(58, 181, 230, .05); }

.compact-item-main { flex: 1; min-width: 0; }

.compact-item-main strong {
  display: block;
  font-size: .92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-item-main small {
  color: var(--txt-muted);
  font-size: .76rem;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-item .progress-wrap { max-width: 180px; flex: 1; }

/* ==========================================================================
   KANBAN
   ========================================================================== */

.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(264px, 1fr);
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  align-items: start;
}

.kanban-column {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-column > header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.kanban-column > header strong { font-size: .84rem; flex: 1; }

.kanban-column > header em {
  font-style: normal;
  font-size: .72rem;
  font-weight: 700;
  background: var(--surface-4);
  color: var(--txt-muted);
  border-radius: 99px;
  padding: 1px 9px;
}

.kanban-dropzone {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-height: 90px;
  overflow-y: auto;
}

.kanban-dropzone.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
  border-radius: var(--radius);
  background: var(--accent-dim);
}

.kanban-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kanban-card.dragging { opacity: .55; cursor: grabbing; }

.kanban-card a {
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.kanban-card a:hover { color: var(--accent-dark); }

.kanban-card small { color: var(--txt-muted); font-size: .74rem; }

/* ==========================================================================
   DETALHE DA TAREFA
   ========================================================================== */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--txt-muted);
  margin-bottom: 8px;
}

.back-link svg { width: 15px; height: 15px; }
.back-link:hover { color: var(--accent-dark); }

.record-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .42fr);
  gap: 16px;
  align-items: start;
}

.record-main,
.record-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.description-text {
  font-size: .94rem;
  color: var(--txt);
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* Comando e resumo da tarefa */
.task-command-header {
  position: sticky;
  top: 10px;
  z-index: 30;
  padding: 14px 16px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.task-command-header .back-link { margin-bottom: 6px; }

.task-command-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.task-heading {
  flex: 1;
  min-width: 0;
}

.task-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.task-title-row h1 {
  min-width: 0;
  letter-spacing: 0;
}

.task-title-edit {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--txt-muted);
  border-radius: 6px;
}

.task-title-edit:hover,
.task-title-edit:focus-visible {
  color: var(--accent-dark);
  background: var(--accent-dim);
  outline: none;
}

.task-title-edit svg { width: 16px; height: 16px; }

.task-command-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.task-command-actions form { margin: 0; }

.task-action-menu { position: relative; }

.task-menu-toggle {
  width: 40px;
  height: 40px;
}

.task-action-menu-popover {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: 260px;
  padding: 6px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface-1);
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.task-action-menu-popover form { width: 100%; }

.task-action-menu-popover button,
.task-action-menu-popover a {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--txt);
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  font-size: .84rem;
  font-weight: 600;
}

.task-action-menu-popover button:hover,
.task-action-menu-popover button:focus-visible,
.task-action-menu-popover a:hover,
.task-action-menu-popover a:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.task-action-menu-popover button svg,
.task-action-menu-popover a svg {
  width: 17px;
  height: 17px;
  color: var(--txt-muted);
}

.task-action-menu-popover .is-danger { color: var(--red); }
.task-action-menu-popover .is-danger svg { color: var(--red); }
.task-action-menu-popover .is-danger:hover { background: var(--red-dim); }

.task-summary-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.task-summary-item {
  min-height: 29px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--txt-muted);
  font-size: .76rem;
  font-weight: 700;
  white-space: nowrap;
}

.task-summary-item svg { width: 15px; height: 15px; }

.task-summary-item.is-alert {
  color: var(--red);
  border-color: rgba(229, 72, 77, .24);
  background: var(--red-dim);
}

.task-summary-progress {
  min-width: 150px;
  margin-left: auto;
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.task-summary-progress strong {
  min-width: 34px;
  text-align: right;
  font-size: .78rem;
}

.task-unassigned-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  color: var(--txt-muted);
  font-size: .78rem;
}

.task-unassigned-note svg {
  width: 15px;
  height: 15px;
  color: var(--accent-dark);
}

.task-edit-grid {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(0, 1.25fr);
  gap: 14px;
}

.task-edit-grid .form-group { margin-bottom: 0; }
.task-edit-grid textarea.form-control { min-height: 96px; }

.task-action-panel {
  border-left: 3px solid var(--accent);
}

/* Área de trabalho e abas */
.task-workspace {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
}

.task-description { padding: 16px 18px; }
.task-description .section-hd { margin-bottom: 9px; padding-bottom: 8px; }

.task-tabs-shell {
  padding: 0;
  overflow: hidden;
}

.task-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  overflow-x: auto;
}

.task-tab {
  min-width: 132px;
  min-height: 50px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--txt-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.task-tab svg { width: 17px; height: 17px; }

.task-tab small {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--surface-3);
  color: var(--txt-muted);
  font-size: .7rem;
}

.task-tab:hover,
.task-tab:focus-visible {
  color: var(--txt);
  background: rgba(58, 181, 230, .06);
  outline: none;
}

.task-tab.is-active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.task-tab.is-active small {
  background: var(--accent-dim);
  color: var(--accent-dark);
}

.task-tab-panel {
  min-height: 300px;
  padding: 18px;
}

.task-panel-heading {
  min-height: 44px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.task-panel-heading > div:first-child {
  display: flex;
  flex-direction: column;
}

.task-panel-heading strong { font-size: .9rem; }
.task-panel-heading span { color: var(--txt-muted); font-size: .76rem; }

.task-panel-progress {
  min-width: 160px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.task-panel-progress > span {
  min-width: 34px;
  text-align: right;
  color: var(--txt);
  font-weight: 700;
}

/* Atividade unificada */
.activity-composer {
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.activity-composer textarea.form-control {
  min-height: 92px;
  margin-bottom: 10px;
}

.activity-composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.activity-composer-actions .form-control {
  width: auto;
  min-width: 170px;
}

.activity-file {
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--border-2);
  border-radius: 7px;
  color: var(--txt-muted);
  background: var(--surface-1);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 700;
}

.activity-file:hover {
  color: var(--accent-dark);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.activity-file svg { width: 16px; height: 16px; }
.activity-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-entry {
  min-width: 0;
  padding: 14px 2px;
  border-bottom: 1px solid var(--border);
}

.activity-entry:last-child { border-bottom: none; }
.activity-comment { display: flex; gap: 12px; }

.activity-event {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.activity-event-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--txt-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.activity-event-icon svg { width: 15px; height: 15px; }
.activity-event strong { display: block; font-size: .84rem; font-weight: 650; }
.activity-event small { display: block; margin-top: 2px; color: var(--txt-muted); font-size: .72rem; }

/* Inspetor único de detalhes */
.task-inspector {
  position: static;
}

.task-inspector-heading small {
  color: var(--green);
  font-weight: 700;
}

.task-inspector-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inspector-field {
  min-width: 0;
}

.inspector-label-row {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inspector-label-row label,
.inspector-field-static > span {
  color: var(--txt-muted);
  font-size: .75rem;
  font-weight: 700;
}

.inspector-field form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.inspector-field .form-control {
  width: 100%;
  min-height: 40px;
  font-size: .82rem;
}

.inspector-value {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  font-size: .84rem;
  font-weight: 600;
}

.inspector-field-static {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

.inspector-field-static strong { font-size: .82rem; text-align: right; }

.inspector-input-suffix {
  position: relative;
}

.inspector-input-suffix .form-control { padding-right: 42px; }

.inspector-input-suffix > span {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--txt-muted);
  font-size: .72rem;
  font-weight: 700;
  pointer-events: none;
}

.autosave-state {
  min-height: 16px;
  color: var(--txt-muted);
  font-size: .68rem;
  font-weight: 700;
}

.autosave-state.is-saving { color: var(--txt-muted); }
.autosave-state.is-saved { color: var(--green); }
.autosave-state.is-error { color: var(--red); }

form[aria-busy="true"] .form-control {
  opacity: .7;
  cursor: wait;
}

.task-inspector-facts {
  margin-top: 14px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
}

.task-inspector-facts > div { padding: 8px 0; }

.subtask-status-form {
  min-width: 170px;
  align-items: stretch;
}

.subtask-status-form .autosave-state {
  text-align: right;
}

/* Subtarefas */
.subtask-progress-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.subtask-progress-head small { color: var(--txt-muted); font-size: .8rem; }

.subtask-create-form {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.2fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.subtask-list { display: flex; flex-direction: column; gap: 8px; }

.subtask-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.subtask-row.is-complete { opacity: .72; }
.subtask-row.is-complete .subtask-main strong { text-decoration: line-through; }

.subtask-state {
  color: var(--chip, var(--accent));
  display: inline-flex;
  flex-shrink: 0;
}

.subtask-state svg { width: 20px; height: 20px; }

.subtask-main { flex: 1; min-width: 180px; }
.subtask-main strong { display: block; font-size: .9rem; overflow-wrap: anywhere; }
.subtask-main small { color: var(--txt-muted); font-size: .76rem; }

.subtask-status-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.subtask-status-form .form-control { min-height: 38px; padding: 6px 10px; font-size: .82rem; width: auto; }

/* Atualizações / comentários */
.interaction-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

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

.interaction-actions .form-control { width: auto; min-width: 180px; }

.comment-list { display: flex; flex-direction: column; gap: 14px; }

.comment-row { display: flex; gap: 12px; min-width: 0; }

.comment-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1.5px solid var(--accent-border);
  color: var(--accent-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.comment-body { min-width: 0; flex: 1; }

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}

.comment-meta strong { font-size: .88rem; }
.comment-meta span, .comment-meta small { color: var(--txt-muted); font-size: .74rem; }

.comment-body p { font-size: .9rem; overflow-wrap: anywhere; }

/* Fatos e histórico */
.record-facts { display: flex; flex-direction: column; }

.record-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.record-facts > div:last-child { border-bottom: none; }

.record-facts dt { font-size: .78rem; color: var(--txt-muted); font-weight: 600; }
.record-facts dd { font-size: .84rem; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.timeline-list { display: flex; flex-direction: column; }

.timeline-row {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.timeline-row:last-child { border-bottom: none; }

.timeline-row > span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 7px;
  flex-shrink: 0;
}

.timeline-row strong { display: block; font-size: .82rem; font-weight: 600; overflow-wrap: anywhere; }
.timeline-row small { color: var(--txt-muted); font-size: .72rem; }

.panel-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

/* ==========================================================================
   ACEITE/DEVOLUÇÃO, ANEXOS, NOTIFICAÇÕES E SLA
   ========================================================================== */

.claim-banner {
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.claim-banner-text {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  color: var(--txt);
}

.claim-banner-text svg { width: 19px; height: 19px; color: var(--accent-dark); flex-shrink: 0; }

.claim-banner-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.claim-return-form label { margin-top: 4px; }
.claim-return-form .form-actions { margin-top: 10px; }

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

.attachment-form .form-control { flex: 1; min-width: 200px; }

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.attachment-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.attachment-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.attachment-icon svg { width: 17px; height: 17px; }

.attachment-main { flex: 1; min-width: 0; }
.attachment-main strong { display: block; font-size: .88rem; overflow-wrap: anywhere; }
.attachment-main small { color: var(--txt-muted); font-size: .74rem; }

input[type="file"].form-control {
  padding: 8px 10px;
  line-height: 1.6;
}

.notification-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-1);
  flex-wrap: wrap;
}

.notification-row.is-unread {
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

.notification-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notification-row.is-unread .notification-icon { background: #fff; }
.notification-icon svg { width: 18px; height: 18px; }

.notification-body { flex: 1; min-width: 200px; }
.notification-body strong { display: block; font-size: .9rem; }
.notification-body p { font-size: .84rem; color: var(--txt-muted); overflow-wrap: anywhere; }
.notification-body small { color: var(--txt-dim); font-size: .72rem; }

/* Destaque de SLA estourado (sem responsável além do tempo da prioridade) */
tr.sla-row td { background: var(--red-dim) !important; }
tr.sla-row .record-title { color: var(--red); }

.kanban-card.sla-card {
  border-color: rgba(229, 72, 77, .45);
  box-shadow: 0 0 0 1px rgba(229, 72, 77, .25), var(--shadow-sm);
}

.stat-alert {
  border-color: rgba(229, 72, 77, .4);
  background: var(--red-dim);
}

/* ==========================================================================
   CONFIGURAÇÕES — interruptor de e-mail
   ========================================================================== */

.mail-toggle { margin-bottom: 18px; }

.mail-toggle-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.mail-toggle-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mail-toggle-track {
  width: 46px;
  height: 26px;
  border-radius: 99px;
  background: var(--surface-4);
  border: 1px solid var(--border-2);
  position: relative;
  flex-shrink: 0;
  transition: background .2s ease, border-color .2s ease;
  margin-top: 2px;
}

.mail-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s ease;
}

.mail-toggle-label input:checked ~ .mail-toggle-track {
  background: var(--green);
  border-color: var(--green);
}

.mail-toggle-label input:checked ~ .mail-toggle-track .mail-toggle-thumb {
  transform: translateX(20px);
}

.mail-toggle-label input:focus-visible ~ .mail-toggle-track {
  outline: 3px solid rgba(58, 181, 230, .3);
  outline-offset: 2px;
}

.mail-toggle-text strong { display: block; font-size: .92rem; }
.mail-toggle-text small { color: var(--txt-muted); font-size: .78rem; }

/* ==========================================================================
   PAGINAÇÃO
   ========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--txt-muted);
  font-size: .8rem;
}

.pagination-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.pagination-link {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface-1);
  color: var(--txt-muted);
  font-size: .84rem;
  font-weight: 600;
  transition: all .15s ease;
}

a.pagination-link:hover {
  border-color: var(--accent-border);
  color: var(--accent-dark);
  background: var(--accent-dim);
}

.pagination-link.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0B2635;
}

.pagination-link.is-disabled {
  opacity: .4;
  pointer-events: none;
}

.pagination-ellipsis { color: var(--txt-dim); padding: 0 4px; }

@media (max-width: 560px) {
  .pagination { justify-content: center; }
  .pagination-info { width: 100%; text-align: center; }
}

/* ==========================================================================
   SPRINTS
   ========================================================================== */

.sprint-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sprint-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.sprint-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.sprint-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sprint-card-head strong { font-size: .95rem; }

.sprint-card-meta { color: var(--txt-muted); font-size: .76rem; }

.sprint-card-goal {
  color: var(--txt-muted);
  font-size: .8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sprint-goal-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.sprint-goal-banner svg {
  width: 20px;
  height: 20px;
  color: var(--accent-dark);
  flex-shrink: 0;
  margin-top: 2px;
}

.sprint-goal-banner strong { font-size: .82rem; display: block; }
.sprint-goal-banner p { font-size: .88rem; color: var(--txt); }

.sprint-add-form .form-row {
  grid-template-columns: minmax(0, 1fr) minmax(200px, auto);
  align-items: end;
}

.sprint-link { color: var(--accent-dark); font-weight: 700; }
.sprint-link:hover { text-decoration: underline; }

@media (max-width: 800px) {
  .sprint-add-form .form-row { grid-template-columns: 1fr; }
}

/* ==========================================================================
   USUÁRIOS
   ========================================================================== */

.management-layout {
  display: grid;
  grid-template-columns: minmax(300px, .46fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.user-list { display: flex; flex-direction: column; gap: 10px; }

.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.user-row-main { flex: 1; min-width: 160px; }
.user-row-main strong { display: block; font-size: .92rem; }
.user-row-main span { color: var(--txt-muted); font-size: .78rem; overflow-wrap: anywhere; }

.user-row-meta { min-width: 120px; }
.user-row-meta span { display: block; font-size: .82rem; font-weight: 600; }
.user-row-meta small { color: var(--txt-muted); font-size: .74rem; }

.user-row-actions { display: flex; gap: 6px; margin-left: auto; }

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface-1);
  color: var(--txt-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}

.icon-button svg { width: 17px; height: 17px; }

.icon-button:hover {
  border-color: var(--accent-border);
  color: var(--accent-dark);
  background: var(--accent-dim);
}

.icon-button.is-danger {
  color: var(--red);
  border-color: rgba(229, 72, 77, .25);
  background: var(--red-dim);
}

.icon-button.is-danger:hover {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.task-delete-form {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.task-delete-inline .icon-button {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  flex: 0 0 auto;
}

.task-delete-inline .icon-button svg {
  width: 14px;
  height: 14px;
}

.task-actions-column {
  width: 76px;
  min-width: 76px;
  text-align: center;
}

.task-details-form {
  margin-bottom: 0;
}

.password-reset-row {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px dashed var(--border-2);
}

.password-reset-row strong { font-size: .82rem; width: 100%; }
.password-reset-row .form-control { flex: 1; min-width: 170px; }

/* Listas administrativas */
.management-list {
  min-width: 0;
}

.management-table tbody td {
  min-height: 62px;
}

.management-table tbody td:first-child {
  text-align: left;
}

.management-entity {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.management-entity > div {
  min-width: 0;
}

.management-entity strong,
.management-entity-link {
  display: block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--txt);
  font-size: .88rem;
  font-weight: 750;
  white-space: nowrap;
}

.management-entity-link:hover { color: var(--accent-dark); }

.management-entity small {
  display: block;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--txt-muted);
  font-size: .74rem;
  white-space: nowrap;
}

.management-avatar,
.management-entity-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  background: var(--accent-dim);
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 800;
}

.management-entity-icon svg { width: 16px; height: 16px; }
.management-entity-plain { min-width: 180px; }

.management-description {
  max-width: 430px;
  color: var(--txt-muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.management-actions-column {
  width: 142px;
  min-width: 142px;
  text-align: center;
}

.management-table thead .management-actions-column {
  position: sticky;
  right: 0;
  z-index: 4;
  background: var(--surface-2);
  box-shadow: -8px 0 12px -12px rgba(16, 25, 55, .35);
}

.management-table tbody .management-actions-column {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface-1);
  box-shadow: -8px 0 12px -12px rgba(16, 25, 55, .35);
}

.management-table tbody tr:hover .management-actions-column {
  background: #F8FCFF;
}

.management-row-actions {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.management-row-actions form {
  display: inline-flex;
  margin: 0;
}

.management-row-actions .icon-button {
  width: 34px;
  height: 34px;
  border-radius: 7px;
}

.management-row-actions .icon-button:disabled {
  opacity: .38;
  cursor: not-allowed;
  color: var(--txt-dim);
  border-color: var(--border);
  background: var(--surface-2);
}

.management-date-separator {
  margin-inline: 4px;
  color: var(--txt-dim);
}

.management-progress {
  min-width: 145px;
  display: grid;
  grid-template-columns: minmax(90px, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.management-progress > span {
  min-width: 30px;
  color: var(--txt-muted);
  font-size: .74rem;
  font-weight: 700;
  text-align: right;
}

.sprint-management-table {
  width: 100%;
  min-width: 820px;
  table-layout: fixed;
}

.sprint-management-table th,
.sprint-management-table td {
  padding-inline: 10px;
}

.sprint-management-table th:nth-child(1) { width: 29%; }
.sprint-management-table th:nth-child(2) { width: 9%; }
.sprint-management-table th:nth-child(3) { width: 19%; }
.sprint-management-table th:nth-child(4) { width: 15%; }
.sprint-management-table th:nth-child(5) { width: 14%; }

.sprint-management-table .management-actions-column {
  width: 126px;
  min-width: 126px;
}

.sprint-management-table .management-entity {
  min-width: 0;
}

/* Modais administrativos */
body.modal-open { overflow: hidden; }

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(16, 25, 55, .48);
  cursor: default;
}

.app-modal-dialog {
  position: relative;
  width: min(660px, 100%);
  max-height: calc(100vh - 48px);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--surface-1);
  box-shadow: 0 24px 60px rgba(16, 25, 55, .22);
  overflow: hidden;
}

.app-modal-dialog-sm { width: min(480px, 100%); }

.app-modal-dialog > form {
  max-height: inherit;
  display: flex;
  flex-direction: column;
}

.app-modal-header {
  min-height: 76px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-modal-header > div { min-width: 0; }

.app-modal-header h2 {
  font-size: 1.04rem;
  line-height: 1.3;
  letter-spacing: 0;
}

.app-modal-header p {
  margin-top: 3px;
  color: var(--txt-muted);
  font-size: .78rem;
}

.app-modal-header .icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.app-modal-body {
  padding: 20px;
  overflow-y: auto;
}

.app-modal-body .form-group:last-child { margin-bottom: 0; }

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.modal-field-wide { grid-column: 1 / -1; }

.app-modal-footer {
  min-height: 68px;
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   ESTADOS VAZIOS E AVISOS
   ========================================================================== */

.empty-state {
  text-align: center;
  color: var(--txt-muted);
  font-size: .88rem;
  padding: 26px 14px;
}

.empty-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--txt-muted);
  font-size: .85rem;
  padding: 18px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
}

.empty-inline svg { width: 17px; height: 17px; }

.setup-alert {
  background: var(--yellow-dim);
  border: 1px solid rgba(245, 158, 11, .35);
  color: #8A5A08;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: .88rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-wrap: anywhere;
}

/* ==========================================================================
   AUTENTICAÇÃO (login)
   ========================================================================== */

body.auth-shell {
  padding-left: 0;
  background: var(--bg);
}

.auth-grid {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}

.auth-media {
  position: relative;
  background:
    linear-gradient(160deg, rgba(28, 33, 64, .88) 0%, rgba(20, 24, 48, .94) 100%),
    url('../assets/images/Frame-2.jpg') center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.auth-media-content {
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.auth-logo { width: clamp(150px, 20vw, 210px); height: auto; }

.auth-copy span {
  color: var(--accent);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.auth-copy h1 {
  color: #fff;
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 10px 0 12px;
}

.auth-copy p {
  color: rgba(255, 255, 255, .72);
  font-size: .95rem;
  line-height: 1.6;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: var(--surface-1);
}

.login-form {
  width: min(100%, 400px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-heading { display: flex; align-items: center; gap: 12px; }

.login-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-mark svg { width: 22px; height: 22px; }

.login-eyebrow {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.login-heading h2 { font-size: 1.3rem; font-weight: 800; line-height: 1.2; }

.login-intro { color: var(--txt-muted); font-size: .88rem; }

.field-group { min-width: 0; }

.input-with-icon { position: relative; }

.input-with-icon > svg,
.input-with-icon > .input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--txt-dim);
  width: 17px;
  height: 17px;
  pointer-events: none;
}

.input-with-icon .form-control { padding-left: 42px; }

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--txt-dim);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.password-toggle:hover { color: var(--accent-dark); background: var(--accent-dim); }
.password-toggle svg { width: 17px; height: 17px; }

.login-submit { margin-top: 6px; }

.first-access {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  color: var(--txt-muted);
  font-size: .8rem;
  padding: 10px;
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
}

.first-access svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ==========================================================================
   PÁGINAS DE ERRO (layout guest)
   ========================================================================== */

body.guest-shell {
  padding-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 18% 12%, var(--accent-dim) 0%, transparent 55%),
    var(--bg);
  padding: 20px;
}

.guest-panel { width: min(100%, 460px); }

.error-state {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
  padding: 44px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.error-state h1 {
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--accent-dark);
  line-height: 1;
}

.error-state p { color: var(--txt-muted); font-size: .95rem; }

/* ==========================================================================
   UTILITÁRIOS
   ========================================================================== */

.text-muted { color: var(--txt-muted); }
.mb-0 { margin-bottom: 0; }
.w-100 { width: 100%; }

.app-view p,
.app-view small,
.app-view strong,
.app-view h1, .app-view h2, .app-view h3 {
  overflow-wrap: anywhere;
}

/* ==========================================================================
   RESPONSIVIDADE
   ========================================================================== */

@media (max-width: 1180px) {
  .record-workspace { grid-template-columns: 1fr; }
  .task-inspector { position: static; }
  .management-layout { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .auth-grid { grid-template-columns: 1fr; }
  .auth-media { display: none; }
  .auth-panel { min-height: 100vh; }
  .subtask-create-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 800px) {
  body,
  body.sidebar-compact {
    padding-left: var(--sidebar-compact-w);
  }

  body:not(.sidebar-compact) .main-content,
  body.sidebar-compact .main-content {
    padding: 10px;
  }

  .sidebar,
  .sidebar.close {
    left: 0;
    width: var(--sidebar-compact-w);
    padding: 12px 8px;
  }

  .logo_items,
  .brand_lockup {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

  .nav_image {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }

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

  .brand-logo-compact {
    width: 36px;
    height: 36px;
    border-radius: 7px;
    object-fit: cover;
    display: block;
  }

  .logo_name,
  #lock-icon,
  .menu_title .title,
  .link span:not(.link-icon),
  .data_text {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
  }

  .menu_container { margin-top: 12px; }

  .menu_title {
    width: 100%;
    height: 26px;
    justify-content: center;
  }

  .menu_title .line { opacity: 1; }

  .link {
    width: 100%;
    padding: 0;
    justify-content: center;
    min-height: 44px;
  }

  .link .link-icon {
    width: 100%;
    min-width: 0;
    height: 44px;
    margin: 0;
    justify-content: center;
  }

  .sidebar_footer {
    padding-top: 8px;
    margin-top: 8px;
  }

  .sidebar_profile {
    width: 100%;
    justify-content: center;
  }

  .logout_link { justify-content: center; margin-bottom: 6px; }

  .app-view {
    padding: 12px;
    gap: 12px;
    min-height: calc(100vh - 20px);
  }

  .page-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .task-command-header {
    position: static;
    padding: 13px;
    backdrop-filter: none;
  }

  .task-command-row {
    flex-direction: column;
    align-items: stretch;
  }

  .task-command-actions {
    justify-content: stretch;
  }

  .task-command-actions > form {
    flex: 1;
  }

  .task-command-actions > form .btn {
    width: 100%;
  }

  .task-summary-progress {
    width: 100%;
    margin-left: 0;
  }

  .task-edit-grid { grid-template-columns: 1fr; }

  .task-tabs { padding-inline: 6px; }
  .task-tab { min-width: 124px; }
  .task-tab-panel { padding: 14px; }

  .activity-composer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .activity-composer-actions .form-control,
  .activity-composer-actions .btn,
  .activity-file {
    width: 100%;
  }

  .page-header-actions,
  .page-header-actions .btn,
  .page-header-row form,
  .page-header-row .btn { width: 100%; }

  .card { padding: 14px; }

  .form-row,
  .subtask-create-form { grid-template-columns: 1fr !important; }

  .interaction-actions { flex-direction: column; align-items: stretch; }
  .interaction-actions .form-control,
  .interaction-actions .btn { width: 100%; }

  .subtask-status-form { width: 100%; margin-left: 0; }
  .subtask-status-form .form-control { flex: 1; width: auto; }

  .user-row-actions { margin-left: 0; width: 100%; justify-content: flex-end; }

  .btn:not(.btn-icon):not(.icon-button) {
    white-space: normal;
    text-align: center;
  }

  .kanban-board { grid-auto-columns: minmax(240px, 82vw); }

  thead th, tbody td { padding: 10px 12px; }
}

@media (max-width: 560px) {
  html { font-size: 15.5px; }

  body:not(.sidebar-compact) .main-content,
  body.sidebar-compact .main-content { padding: 8px; }

  .app-view { padding: 10px; border-radius: var(--radius); }

  .card { padding: 12px; }

  .management-list { padding: 12px; }

  .app-modal {
    padding: 0;
    align-items: flex-end;
  }

  .app-modal-dialog,
  .app-modal-dialog-sm {
    width: 100%;
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .app-modal-header,
  .app-modal-body,
  .app-modal-footer {
    padding-inline: 14px;
  }

  .modal-form-grid { grid-template-columns: 1fr; }
  .modal-field-wide { grid-column: auto; }

  .app-modal-footer .btn { flex: 1; }

  .task-tabs-shell { padding: 0; }

  .task-command-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .task-command-actions > form { min-width: 0; }

  .task-action-menu-popover {
    width: min(260px, calc(100vw - 112px));
  }

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

  .task-summary-item {
    min-width: 0;
    white-space: normal;
  }

  .task-summary-progress { grid-column: 1 / -1; }

  .task-panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .task-panel-progress { width: 100%; }

  .subtask-status-form {
    width: 100%;
    min-width: 0;
  }

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

  .compact-item { flex-wrap: wrap; }
  .compact-item .progress-wrap { max-width: 100%; width: 100%; }

  .auth-panel { padding: 24px 14px; }
}

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

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

/* Acessibilidade: foco visível */
.form-control:focus-visible,
.btn:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(58, 181, 230, .3);
  outline-offset: 2px;
}
