/* Triune AV Planner — Tela 01 Projetos · Home
   Mobile-first. Tabela vira cards em mobile. Modal full-screen <640px. */

.proj { display: flex; flex-direction: column; gap: 18px; }

/* ============ BARRA SUPERIOR ============ */
.proj-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.proj-bar-spacer { flex: 1; min-width: 8px; }

.proj-tabs {
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--line-3);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
}
.proj-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--txt-3);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  min-height: 36px;
  transition: background 0.15s, color 0.15s;
}
.proj-tab:hover:not([disabled]) { color: var(--txt-2); }
.proj-tab[disabled] { opacity: 0.5; cursor: not-allowed; }
.proj-tab.is-active { background: var(--bg-3); color: var(--txt); }
.proj-tab-count {
  font-size: 11px;
  color: var(--txt-3);
  font-weight: 600;
}
.proj-tab.is-active .proj-tab-count { color: var(--red); }

.proj-search {
  position: relative;
  display: flex; align-items: center;
}
.proj-search-ico {
  position: absolute; left: 10px;
  color: var(--txt-4);
  pointer-events: none;
}
.proj-search input {
  height: 36px;
  width: 220px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 11px 0 32px;
  color: var(--txt-2);
  font-size: 16px;          /* DEV6 */
  outline: none;
}
.proj-search input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

/* ============ TABELA (desktop) ============ */
.proj-table-wrap {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 220px;
}
.proj-table { width: 100%; }

.proj-row {
  display: grid;
  grid-template-columns: 1.7fr 1.4fr 0.85fr 0.55fr 0.55fr 0.95fr 44px;
  gap: 12px;
  padding: 14px 20px;
  align-items: center;
  border-bottom: 1px solid var(--line-2);
  transition: background 0.12s;
  cursor: pointer;
}
.proj-row:last-child { border-bottom: none; }
.proj-row:hover:not(.proj-row-head) { background: var(--bg-3); }

.proj-row-head {
  padding: 11px 20px;
  background: var(--bg-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.7px;
  color: var(--txt-4);
  text-transform: uppercase;
  cursor: default;
}

.proj-cell { min-width: 0; }
.proj-cell.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--txt-2); }
.proj-cell.strong { font-weight: 600; color: var(--txt); }
.ta-right { text-align: right; }

.proj-cell-main { min-width: 0; }
.proj-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--txt);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.proj-subtitle {
  font-size: 11.5px;
  font-weight: 300;
  color: var(--txt-3);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.proj-muted { color: var(--txt-4); }

.proj-actions-btn {
  width: 36px; height: 36px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--txt-3);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.proj-actions-btn:hover {
  background: var(--bg);
  border-color: var(--line);
  color: var(--txt);
}

.proj-menu {
  position: fixed;
  z-index: 50;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  min-width: 180px;
  padding: 4px;
}
.proj-menu button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--txt-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  border-radius: var(--r-sm);
  cursor: pointer;
  min-height: 40px;
}
.proj-menu button:hover { background: var(--bg-3); color: var(--txt); }
.proj-menu button.danger { color: var(--err); }
.proj-menu button.danger:hover { background: var(--red-soft); color: var(--red); }

/* ============ PILLS ============ */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-mute { color: var(--txt-3); background: var(--bg-3); border-color: var(--line); }
.pill-warn { color: var(--warn); background: rgba(243,156,18,0.13); border-color: rgba(243,156,18,0.3); }
.pill-info { color: var(--info); background: rgba(52,152,219,0.13); border-color: rgba(52,152,219,0.3); }
.pill-ok   { color: var(--ok); background: rgba(46,204,113,0.13); border-color: rgba(46,204,113,0.3); }
.pill-live { color: var(--red); background: var(--red-soft); border-color: var(--red-line); }
.pill-live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: pillPulse 1.6s infinite;
}
@keyframes pillPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============ STATS CARDS ============ */
.proj-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  padding: 16px 18px;
}
.stat-card-label {
  font-size: 11px;
  font-weight: 300;
  color: var(--txt-3);
  margin-bottom: 6px;
}
.stat-card-val {
  font-size: 22px;
  font-weight: 600;
  color: var(--txt);
  margin-top: 2px;
  line-height: 1.2;
}
.stat-card-val .mono { font-family: var(--font-mono); font-size: 24px; }
.stat-card-val-mute { color: var(--txt-3); }
.stat-card-strong { color: var(--red); font-weight: 600; }
.stat-card-hint {
  font-size: 11px;
  font-weight: 300;
  color: var(--txt-3);
  margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============ LOADING + EMPTY ============ */
.proj-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 64px 24px;
}
.proj-loading-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--txt-3);
  animation: projDot 1.2s infinite ease-in-out;
}
.proj-loading-dot:nth-child(2) { animation-delay: 0.15s; }
.proj-loading-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes projDot { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

.proj-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  text-align: center;
}
.proj-empty-ico {
  width: 64px; height: 64px;
  border-radius: var(--r-lg);
  background: var(--bg-3);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--red);
}
.proj-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--txt);
}
.proj-empty-desc {
  font-size: 13px;
  font-weight: 300;
  color: var(--txt-3);
  max-width: 360px;
  line-height: 1.55;
}

/* ============ BOTÕES GLOBAIS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 14px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  min-height: 36px;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: #c4241a; }
.btn-ghost { background: var(--bg-3); border-color: var(--line); color: var(--txt-2); }
.btn-ghost:hover { background: var(--bg); border-color: var(--txt-4); color: var(--txt); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: #b8231a; }

/* ============ FORM ============ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form-grid .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-grid .span-2 { grid-column: span 2; }
.field-lbl {
  font-size: 11px;
  font-weight: 500;
  color: var(--txt-3);
  letter-spacing: 0.2px;
}
.form-grid input,
.form-grid select {
  height: 40px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 12px;
  color: var(--txt);
  font-size: 16px;        /* DEV6 */
  font-family: inherit;
  outline: none;
  width: 100%;
  min-width: 0;
}
.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
.form-grid input::placeholder { color: var(--txt-4); }

/* ============ TOAST ============ */
.tui-toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom);
}
.tui-toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 380px;
  padding: 11px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-2);
  color: var(--txt-2);
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  animation: tuiToastIn 0.18s ease-out forwards;
}
.tui-toast-leave { animation: tuiToastOut 0.18s ease-in forwards; }
@keyframes tuiToastIn { to { opacity: 1; transform: translateY(0); } }
@keyframes tuiToastOut { to { opacity: 0; transform: translateY(10px); } }
.tui-toast-ico { flex-shrink: 0; display: inline-flex; }
.tui-toast-success .tui-toast-ico { color: var(--ok); }
.tui-toast-error   .tui-toast-ico { color: var(--err); }
.tui-toast-warn    .tui-toast-ico { color: var(--warn); }
.tui-toast-info    .tui-toast-ico { color: var(--info); }
.tui-toast-msg { flex: 1; line-height: 1.35; word-break: break-word; }
.tui-toast-x {
  background: none; border: none;
  color: var(--txt-4);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  min-height: 32px;
  min-width: 32px;
}
.tui-toast-x:hover { color: var(--txt-2); }

@media (max-width: 480px) {
  .tui-toast-wrap { left: 16px; right: 16px; bottom: 16px; }
  .tui-toast { min-width: 0; max-width: none; width: 100%; }
}

/* ============ MODAL ============ */
.tui-modal-root {
  position: fixed; inset: 0;
  z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  opacity: 0;
  transition: opacity 0.18s ease-out;
}
.tui-modal-enter { opacity: 1; }
.tui-modal-leave { opacity: 0; }
.tui-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.tui-modal {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-3);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 48px);
  width: 100%;
  max-width: 560px;
  transform: translateY(8px);
  transition: transform 0.2s ease-out;
}
.tui-modal-enter .tui-modal { transform: translateY(0); }
.tui-modal-sm { max-width: 420px; }
.tui-modal-md { max-width: 560px; }
.tui-modal-lg { max-width: 760px; }

.tui-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line-2);
}
.tui-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--txt);
  margin: 0;
}
.tui-modal-x {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--txt-3);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.tui-modal-x:hover { background: var(--bg-3); color: var(--txt); }

.tui-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.tui-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line-2);
  flex-wrap: wrap;
}

.tui-confirm-msg {
  font-size: 14px;
  color: var(--txt-2);
  line-height: 1.55;
}

/* Modal full-screen em mobile pequeno */
@media (max-width: 480px) {
  .tui-modal-root { padding: 0; }
  .tui-modal {
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    border: none;
    max-width: none;
  }
  .tui-modal-foot { flex-direction: column-reverse; }
  .tui-modal-foot .btn { width: 100%; justify-content: center; }
}

/* ============ ROUTE LOADING ============ */
.route-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 7px;
  padding: 80px 24px;
}
.route-loading-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--txt-3);
  animation: projDot 1.2s infinite ease-in-out;
}
.route-loading-dot:nth-child(2) { animation-delay: 0.15s; }
.route-loading-dot:nth-child(3) { animation-delay: 0.3s; }

/* ============ MOBILE da TABELA — vira cards ============ */
@media (max-width: 768px) {
  .proj-bar > .proj-tabs { flex-shrink: 0; }
  .proj-bar > .proj-search { order: 99; flex: 1 0 100%; }
  .proj-bar > .proj-search input { width: 100%; }
  .proj-bar > .btn-primary { flex: 1 0 auto; }

  .proj-row-head { display: none; }

  .proj-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "main actions"
      "client client"
      "footrow footrow";
    padding: 14px 16px;
    gap: 8px;
  }
  .proj-cell-main { grid-area: main; }
  .proj-row > .proj-cell:nth-child(2) { grid-area: client; }
  .proj-row > .proj-cell:nth-child(3),
  .proj-row > .proj-cell:nth-child(4),
  .proj-row > .proj-cell:nth-child(5),
  .proj-row > .proj-cell:nth-child(6) {
    grid-area: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .proj-row > .proj-cell:nth-child(7) { grid-area: actions; }

  /* Embrulha data/equip/cabos/status numa única linha "footrow" */
  .proj-row::after { content: none; }

  .proj-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "main actions"
      "client client"
      "data data"
      "stats status";
  }
  .proj-row > .proj-cell:nth-child(3) { grid-area: data; font-size: 11px; }
  .proj-row > .proj-cell:nth-child(4),
  .proj-row > .proj-cell:nth-child(5) { grid-area: stats; display: inline-block; margin-right: 14px; text-align: left; font-size: 12px; }
  .proj-row > .proj-cell:nth-child(4)::before { content: 'Equip '; color: var(--txt-4); font-weight: 400; font-family: inherit; font-size: 10px; }
  .proj-row > .proj-cell:nth-child(5)::before { content: 'Cabos '; color: var(--txt-4); font-weight: 400; font-family: inherit; font-size: 10px; }
  .proj-row > .proj-cell:nth-child(6) { grid-area: status; justify-self: end; }
}
