/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design Tokens ───────────────────────────────────────────────────────── */
:root {
  --bg:            #f7f6f3;
  --surface:       #ffffff;

  --border:        #e5e2db;
  --border-sub:    #ede9e3;

  --text:          #1a1a2e;
  --text-muted:    #6b6b80;
  --text-sub:      #a3a3b5;

  --accent:        #1a1a2e;
  --accent-hover:  #2d2d4a;

  --danger:        #d93636;
  --danger-light:  #fff5f5;
  --danger-border: #f5c0c0;

  --sidebar-w:     248px;

  --shadow-xs:     0 1px 2px rgba(26,26,46,.04);
  --shadow-sm:     0 1px 3px rgba(26,26,46,.06), 0 1px 2px rgba(26,26,46,.04);
  --shadow-md:     0 4px 16px rgba(26,26,46,.08), 0 2px 4px rgba(26,26,46,.04);
  --shadow-modal:  0 24px 64px rgba(26,26,46,.14), 0 8px 24px rgba(26,26,46,.07);

  --font-sans:     'Inter', -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono:     'SF Mono', 'Fira Code', 'Consolas', monospace;

  --radius:        8px;
  --radius-sm:     6px;
  --radius-lg:     12px;

  --transition:    150ms ease;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Utility ─────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.mono       { font-family: var(--font-mono); font-size: 0.8125rem; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-outline {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover {
  border-color: var(--text-muted);
}

.btn-ghost {
  border-color: transparent;
  color: var(--text-muted);
  background: transparent;
}
.btn-ghost:hover {
  color: var(--text);
  background: rgba(26,26,46,.05);
}

.btn-danger {
  border-color: var(--danger-border);
  color: var(--danger);
  background: var(--danger-light);
}
.btn-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.btn-drive {
  border-color: var(--border);
  color: var(--text-muted);
  background: var(--surface);
  font-size: 0.8125rem;
  box-shadow: var(--shadow-xs);
}
.btn-drive:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.btn-sm   { padding: 0.35rem 0.75rem; font-size: 0.75rem; }
.btn-xs   { padding: 0.2rem 0.55rem;  font-size: 0.725rem; }
.btn-full { width: 100%; justify-content: center; }

.reveal-btn {
  background: transparent;
  border: none;
  color: var(--text-sub);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: color var(--transition);
  flex-shrink: 0;
}
.reveal-btn:hover { color: var(--text); }

/* ── Form Elements ───────────────────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 5px; }

.field-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-muted);
}

.field-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  -webkit-appearance: none;
}
.field-input:focus {
  border-color: rgba(107,107,128,.5);
  box-shadow: 0 0 0 3px rgba(107,107,128,.1);
}
.field-input::placeholder { color: var(--text-sub); }

select.field-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a3b5' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2rem;
}

.field-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.field-input-wrap .field-input  { padding-right: 2.5rem; }
.field-input-wrap .reveal-btn   { position: absolute; right: 8px; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
}
.alert-error {
  background: var(--danger-light);
  border-color: var(--danger-border);
  color: var(--danger);
  margin-top: 0.75rem;
}
.alert.hidden { display: none; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 99px;
  border: 1px solid;
}
.badge-admin {
  border-color: rgba(26,26,46,.18);
  background: rgba(26,26,46,.06);
  color: var(--accent);
}
.badge-employee {
  border-color: var(--border);
  background: var(--bg);
  color: var(--text-muted);
}

/* ── App Layout ──────────────────────────────────────────────────────────── */
.app-body {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 1.375rem 1.25rem 1.125rem;
  border-bottom: 0.5px solid var(--border-sub);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
  background: transparent;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.logo-company {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.logo-product {
  font-size: 0.68rem;
  color: var(--text-sub);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Sidebar Nav ─────────────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 0.875rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-sub);
  padding: 0.75rem 0.75rem 0.375rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
}
.sidebar-link:hover {
  background: var(--bg);
  color: var(--text);
}
.sidebar-link.active {
  background: rgba(26,26,46,.06);
  color: var(--accent);
}
.sidebar-link svg { flex-shrink: 0; }

/* ── Sidebar Footer ──────────────────────────────────────────────────────── */
.sidebar-footer {
  padding: 0.875rem 0.75rem;
  border-top: 0.5px solid var(--border-sub);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 9px;
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(26,26,46,.08);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.sidebar-user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 0.68rem;
  color: var(--text-sub);
}

.sidebar-logout {
  background: transparent;
  border: none;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
  text-decoration: none;
  cursor: pointer;
}
.sidebar-logout:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* ── App Main ────────────────────────────────────────────────────────────── */
.app-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  padding: 0 1.25rem;
  height: 52px;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
}

/* ── Tira de abas fixa no mobile (dashboard) ─────────────────────────────── */
.mobile-tab-strip {
  display: none;
  position: sticky;
  top: 52px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
  z-index: 99;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.mobile-tab-strip::-webkit-scrollbar { display: none; }
.mobile-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.625rem 1.125rem;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -0.5px;
}
.mobile-tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.mobile-tab-btn:hover:not(.active) { color: var(--text); }

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.page-header {
  margin-bottom: 2rem;
}
.page-title {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

/* ── Cards Grid ──────────────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.375rem 1rem;
  border-bottom: 0.5px solid var(--border-sub);
}
.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.card-description {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.card-section {
  padding: 1rem 1.375rem;
  border-bottom: 0.5px solid var(--border-sub);
}
.card-section:last-child { border-bottom: none; }

.sensitive-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: 0.75rem;
}

.sensitive-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-top: 0.5px solid var(--border-sub);
}
.sensitive-row:first-of-type { border-top: none; }

.sensitive-key {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 0;
  flex-shrink: 0;
  margin-right: 1rem;
}
.sensitive-value-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.sensitive-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text);
  word-break: break-all;
}
.sensitive-value.masked {
  color: var(--text-sub);
  letter-spacing: 0.1em;
}

/* ── Sections (dashboard) ────────────────────────────────────────────────── */
.sections-wrap {
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}

.section-group {}

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-sub);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 0.5px;
  background: var(--border-sub);
}

/* ── Sections (admin) ────────────────────────────────────────────────────── */
.sections-admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.section-block {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.section-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.125rem;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border-sub);
}
.section-block-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.section-block-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.section-cards-list {}

.section-no-cards {
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-style: italic;
}

/* ── Empty State ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.empty-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  opacity: 0.25;
}

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-wrap {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
  background: transparent;
}
.login-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.login-logo-company {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.login-logo-product {
  font-size: 0.75rem;
  color: var(--text-sub);
  font-weight: 400;
}

.login-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.login-heading {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.login-form { display: flex; flex-direction: column; gap: 1.125rem; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tab-nav {
  display: flex;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 1.75rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  margin-bottom: -0.5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.tab-btn:hover:not(.active) { color: var(--text); }

.tab-panel         { display: none; }
.tab-panel.active  { display: block; }

/* ── Panel ───────────────────────────────────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.panel-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ── Data Table ──────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: var(--bg);
  color: var(--text-sub);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 0.5px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 0.5px solid var(--border-sub);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td      { border-bottom: none; }
.data-table tbody tr:hover td      { background: rgba(26,26,46,.015); }
.actions-cell {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  white-space: nowrap;
}

/* ── Admin Cards ─────────────────────────────────────────────────────────── */
.cards-admin-wrap  { display: flex; flex-direction: column; gap: 1.5rem; }
.user-selector-wrap { max-width: 360px; }
.cards-panel.hidden { display: none; }

.cards-admin-list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-admin-item {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 0.5px solid var(--border-sub);
  transition: background var(--transition);
}
.card-admin-item:last-child { border-bottom: none; }
.card-admin-item:hover { background: rgba(26,26,46,.015); }
.card-admin-item-info  { flex: 1; min-width: 0; }
.card-admin-title { font-weight: 500; color: var(--text); font-size: 0.875rem; }
.card-admin-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-admin-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,26,46,.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
}
.modal-lg  { max-width: 640px; }
.modal-sm  { max-width: 360px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 0.5px solid var(--border-sub);
}
.modal-title {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-sub);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover {
  color: var(--text);
  background: var(--bg);
}

.modal-body-text {
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  border-top: 0.5px solid var(--border-sub);
}

form .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1.5rem;
}
.span-2 { grid-column: 1 / -1; }

/* ── Sensitive fields (admin form) ───────────────────────────────────────── */
.sensitive-section { padding: 0 1.5rem 1rem; }
.sensitive-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-top: 0.5px solid var(--border-sub);
}

.sensitive-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
}
.sensitive-field-row .remove-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-sub);
  padding: 0.625rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), color var(--transition),
              background var(--transition);
  align-self: flex-end;
}
.sensitive-field-row .remove-btn:hover {
  border-color: var(--danger-border);
  color: var(--danger);
  background: var(--danger-light);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar          { display: none; }
  .app-main         { margin-left: 0; }
  .mobile-topbar    { display: flex; }
  .mobile-tab-strip { display: flex; }
  /* A tira sticky de abas substitui o tab-nav em mobile */
  .tab-nav          { display: none; }
}

@media (max-width: 640px) {
  .main-content  { padding: 1.5rem 1rem 3rem; }
  .cards-grid    { grid-template-columns: 1fr; }
  form .form-grid { grid-template-columns: 1fr; }
  .sensitive-field-row { grid-template-columns: 1fr 1fr auto; }
  .table-wrap    { font-size: 0.8rem; overflow-x: auto; }
  .login-card    { padding: 1.5rem; }
}

@media (max-width: 400px) {
  .sensitive-field-row { grid-template-columns: 1fr; }
  .sensitive-field-row .remove-btn { width: fit-content; }
}

/* ── Manager badge ───────────────────────────────────────────────────────── */
.badge-manager {
  border-color: rgba(37,99,235,.22);
  background:   rgba(37,99,235,.07);
  color: #1d4ed8;
}

/* ── Sidebar nav button (tab-link) ───────────────────────────────────────── */
.sidebar-link[data-tab-link] {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
}

/* ── Tab loading / empty ─────────────────────────────────────────────────── */
.tab-loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-sub);
  font-size: 0.8125rem;
}

.tasks-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* ── Task list (employee view) ───────────────────────────────────────────── */
.task-list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 0.5px solid var(--border-sub);
  transition: background var(--transition);
}
.task-item:last-child { border-bottom: none; }
.task-item:hover { background: rgba(26,26,46,.015); }

.task-check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  padding: 0;
}
.task-check:hover:not(.done) {
  border-color: #16a34a;
  color: rgba(22,163,74,.4);
}
.task-check.done {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.task-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  transition: color var(--transition);
}
.task-title.done {
  color: var(--text-sub);
  text-decoration: line-through;
}
.task-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Frequency badges ────────────────────────────────────────────────────── */
.task-freq-badge {
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid;
}
.task-freq-daily   { border-color: rgba(37,99,235,.25);  background: rgba(37,99,235,.06);  color: #1d4ed8; }
.task-freq-weekly  { border-color: rgba(109,40,217,.25); background: rgba(109,40,217,.06); color: #6d28d9; }
.task-freq-monthly { border-color: rgba(194,65,12,.25);  background: rgba(194,65,12,.06);  color: #c2410c; }

/* ── Team grid (manager equipe tab) ──────────────────────────────────────── */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.team-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.team-card:hover {
  border-color: rgba(26,26,46,.18);
  box-shadow: var(--shadow-md);
}

.team-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(26,26,46,.08);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.team-card-info {
  flex: 1;
  min-width: 0;
}
.team-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-card-role { margin-top: 4px; }

/* ── Manager task management (tarefas tab) ───────────────────────────────── */
.mgr-tasks-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mgr-task-section {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.mgr-task-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.125rem;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border-sub);
}

.mgr-task-section-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex: 1;
  min-width: 0;
}
.mgr-task-section-title > span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mgr-task-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(26,26,46,.1);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

.mgr-task-report-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 1px 8px;
  flex-shrink: 0;
}

.mgr-task-empty {
  padding: 1rem 1.125rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-style: italic;
}

.mgr-task-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.125rem;
  border-bottom: 0.5px solid var(--border-sub);
  transition: background var(--transition);
}
.mgr-task-item:last-child { border-bottom: none; }
.mgr-task-item:hover { background: rgba(26,26,46,.015); }

.mgr-task-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mgr-task-status.done    { background: #16a34a; }
.mgr-task-status.pending { background: var(--border); }

.mgr-task-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mgr-task-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
}
.mgr-task-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mgr-task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ── Responsive extras ───────────────────────────────────────────────────── */

/* ── Toque: alvos maiores em qualquer dispositivo touch ──────────────────── */
@media (hover: none) and (pointer: coarse) {
  .task-check {
    width: 30px;
    height: 30px;
  }
  .btn-xs {
    padding: 0.35rem 0.75rem;
    min-height: 36px;
  }
  .reveal-btn { padding: 8px; }
}

@media (max-width: 768px) {
  /* Touch targets */
  .task-check      { width: 28px; height: 28px; }
  .btn-xs          { padding: 0.3rem 0.7rem; min-height: 34px; }

  /* Readable freq badge */
  .task-freq-badge { font-size: 0.6875rem; padding: 2px 8px; }

  /* Team cards — layout horizontal compacto */
  .team-card {
    padding: 0.875rem 1rem;
    gap: 0.75rem;
    align-items: center;
  }
  .team-card-avatar { flex-shrink: 0; }
  .team-card .btn   { flex-shrink: 0; }

  /* Manager task section header */
  .mgr-task-section-header { padding: 0.75rem 1rem; }
}

@media (max-width: 640px) {
  .team-grid        { grid-template-columns: 1fr; }
  .task-item        { padding: 0.75rem 1rem; gap: 0.75rem; }
  .mgr-task-item    { padding: 0.625rem 1rem; }
  .mgr-task-actions { gap: 4px; }

  /* Team card — pequeno */
  .team-card        { padding: 0.75rem; gap: 0.625rem; }
  .team-card-avatar { width: 34px; height: 34px; font-size: 0.78rem; }
  .team-card-name   { font-size: 0.8125rem; }
  .team-card .btn   { padding: 0.28rem 0.6rem; font-size: 0.75rem; }
}

/* ── Admin Overview ───────────────────────────────────────────────────────── */
.overview-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.overview-stat-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.25rem 1.125rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.overview-stat-card:hover {
  border-color: rgba(26,26,46,.18);
  box-shadow: var(--shadow-md);
}

.overview-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.overview-icon-users   { background: rgba(26,26,46,.06);   color: var(--accent); }
.overview-icon-manager { background: rgba(99,102,241,.10);  color: #4f46e5; }
.overview-icon-employee{ background: rgba(16,185,129,.10);  color: #059669; }
.overview-icon-tasks   { background: rgba(245,158,11,.10);  color: #d97706; }
.overview-icon-done    { background: rgba(16,185,129,.10);  color: #059669; }
.overview-icon-pending { background: rgba(239,68,68,.08);   color: #dc2626; }

.overview-stat-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.overview-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}
.overview-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.overview-recent { margin-top: 0.25rem; }

@media (max-width: 860px) {
  .overview-stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .overview-stat-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .overview-stat-value { font-size: 1.4rem; }
  .overview-stat-card { padding: 1rem; gap: 0.75rem; }
  .overview-stat-icon { width: 34px; height: 34px; }
}

/* ── Very small (320–360px): empilha ações do gestor ─────────────────────── */
@media (max-width: 400px) {
  .mgr-task-item {
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
  }
  .mgr-task-body {
    flex: 1 1 0;
    min-width: 0;
  }
  .task-freq-badge { align-self: center; }
  .mgr-task-actions {
    flex-basis: 100%;
    justify-content: flex-end;
    padding-left: calc(7px + 0.75rem);
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   NOVO MÓDULO DE TAREFAS — tags de urgência, status, ações do funcionário
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tags de urgência (visão funcionário e gestor) ───────────────────────── */
.task-tag {
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid;
  white-space: nowrap;
}
.task-tag-atrasada { border-color: rgba(220,38,38,.3);  background: rgba(220,38,38,.08);  color: #dc2626; }
.task-tag-hoje     { border-color: rgba(234,88,12,.3);  background: rgba(234,88,12,.08);  color: #ea580c; }
.task-tag-semana   { border-color: rgba(37,99,235,.25); background: rgba(37,99,235,.06);  color: #1d4ed8; }
.task-tag-data     { border-color: var(--border);       background: var(--bg);            color: var(--text-muted); }

/* ── Badges de status ────────────────────────────────────────────────────── */
.task-status-badge {
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid;
  white-space: nowrap;
}
.task-status-pendente  { border-color: var(--border);          background: var(--bg);           color: var(--text-muted); }
.task-status-concluida { border-color: rgba(22,163,74,.3);     background: rgba(22,163,74,.07); color: #16a34a; }
.task-status-bloqueada { border-color: rgba(220,38,38,.3);     background: rgba(220,38,38,.07); color: #dc2626; }

/* ── Ponto de status do gestor — novos valores ───────────────────────────── */
.mgr-task-status.concluida { background: #16a34a; }
.mgr-task-status.pendente  { background: var(--border); }
.mgr-task-status.bloqueada { background: #dc2626; }

/* ── Layout do item do funcionário ──────────────────────────────────────── */
.task-item { align-items: flex-start; }

.task-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.task-due-info {
  font-size: 0.7rem;
  color: var(--text-sub);
  margin-top: 3px;
}

.task-obs-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.task-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  padding-top: 1px;
}

.task-resolved { opacity: 0.75; }

/* ── Botões de ação do funcionário ───────────────────────────────────────── */
.btn-success {
  border-color: rgba(22,163,74,.3);
  color: #16a34a;
  background: rgba(22,163,74,.06);
}
.btn-success:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}
.btn-warning {
  border-color: rgba(234,88,12,.3);
  color: #ea580c;
  background: rgba(234,88,12,.06);
}
.btn-warning:hover {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff;
}

/* ── Observação e prazo na visão do gestor ───────────────────────────────── */
.mgr-task-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mgr-task-obs {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
  display: flex;
  gap: 4px;
  align-items: baseline;
  overflow-wrap: anywhere;
}
.mgr-task-obs-label {
  font-weight: 600;
  font-style: normal;
  color: var(--text-sub);
  flex-shrink: 0;
  font-size: 0.7rem;
}

.mgr-task-due {
  font-size: 0.7rem;
  color: var(--text-sub);
  margin-top: 3px;
}
.mgr-task-sender {
  color: var(--text-muted);
  font-style: normal;
}

/* ── Textarea no modal ───────────────────────────────────────────────────── */
textarea.field-input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* ── Mobile: botões de ação em linha ─────────────────────────────────────── */
@media (max-width: 480px) {
  .task-item    { flex-wrap: wrap; gap: 0.625rem; }
  .task-actions { flex-direction: row; flex-basis: 100%; justify-content: flex-end; }
}
