/* styles.css — Complete UI styling */

:root {
  /* App palette */
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e0e4ea;
  --text: #1a1d23;
  --text-secondary: #5f6672;
  --primary: #1565C0;
  --primary-hover: #0d47a1;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

/* Layout */
.app-header {
  background: var(--primary);
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-header h1 { font-size: 18px; font-weight: 600; }
.app-header .subtitle { font-size: 12px; opacity: 0.8; }
.header-actions { display: flex; gap: 8px; align-items: center; }

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
}
.card-header .badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}
.card-body { padding: 16px; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }
  .app-container { padding: 12px; }
  .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .form-row .btn {
    width: 100%;
    justify-content: center;
  }
  .stats-row { gap: 8px; }
  .stat-item { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }
}

/* Form elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font);
  transition: border-color 0.15s;
  background: white;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
textarea { resize: vertical; min-height: 100px; font-family: var(--mono); font-size: 12px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover:not(:disabled) { background: #b45309; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px; min-width: 32px; justify-content: center; }

/* Status indicators */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.ok { background: var(--success); }
.status-dot.warning { background: var(--warning); }
.status-dot.error { background: var(--danger); }
.status-dot.neutral { background: var(--text-secondary); }

.badge-ok { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-neutral { background: var(--bg); color: var(--text-secondary); }

/* Stats row */
.stats-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg);
  border-radius: 6px;
  min-width: 100px;
}
.stat-value { font-size: 20px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; }

/* Table */
.table-container { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
}
tr:hover { background: #f8fafc; }
td.mono { font-family: var(--mono); font-size: 12px; }

/* Summary panel */
.summary-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.summary-item {
  padding: 12px;
  border-radius: 6px;
  border-left: 4px solid var(--border);
}
.summary-item.ok { border-left-color: var(--success); background: var(--success-light); }
.summary-item.warning { border-left-color: var(--warning); background: var(--warning-light); }
.summary-item.danger { border-left-color: var(--danger); background: var(--danger-light); }
.summary-item .label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; font-weight: 600; }
.summary-item .value { font-size: 16px; font-weight: 700; margin-top: 2px; }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
}
.tab {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-content { display: none; padding: 16px 0; }
.tab-content.active { display: block; }

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-info { background: var(--primary-light); color: var(--primary); }
.alert-success { background: var(--success-light); color: var(--success); }
.alert-warning { background: var(--warning-light); color: #92400e; }
.alert-danger { background: var(--danger-light); color: var(--danger); }

/* File upload */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-secondary);
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-area input[type="file"] { display: none; }
.upload-area .icon { font-size: 24px; margin-bottom: 8px; }
.upload-area .text { font-size: 13px; }
.upload-area .hint { font-size: 11px; margin-top: 4px; opacity: 0.7; }

/* Collapsible */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.collapsible-header::before {
  content: '\25B6';
  font-size: 10px;
  transition: transform 0.2s;
}
.collapsible-header.open::before { transform: rotate(90deg); }
.collapsible-body { display: none; padding-top: 8px; }
.collapsible-body.open { display: block; }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 400px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
.toast.warning { background: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}
.modal-body { padding: 16px; }
.modal-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Section title with toggle */
.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Password toggle */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-group input { padding-right: 36px; }
.input-group .toggle-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  padding: 4px;
}

/* Demo banner */
.demo-banner {
  background: var(--warning-light);
  color: #92400e;
  padding: 8px 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
}

/* Cache banner */
.cache-banner {
  background: var(--success-light);
  color: var(--success);
  padding: 8px 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
}

/* Loader */
.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Hidden */
.hidden { display: none !important; }

/* Audit detail */
.audit-section {
  background: var(--bg);
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
  font-size: 12px;
}
.audit-section dt { font-weight: 600; color: var(--text-secondary); margin-top: 8px; }
.audit-section dd { margin-left: 0; font-family: var(--mono); font-size: 12px; }
.audit-section dd:first-of-type { margin-top: 0; }

/* Scrollable max height */
.scroll-y { max-height: 400px; overflow-y: auto; }

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.w-full { width: 100%; }

/* ═══════════════════════════════════════════════════════════════
   PORTAL — CB Audit branding
   ═══════════════════════════════════════════════════════════════ */

:root {
  --portal-dark:      #0d0d0d;
  --portal-sidebar:   #111111;
  --portal-header:    #161616;
  --portal-border:    #2a2a2a;
  --portal-blue:      #1565C0;
  --portal-blue-hover:#0d47a1;
  --portal-check:     #1e88e5;
  --portal-text:      #ffffff;
  --portal-muted:     #999999;
  --portal-nav-hover: rgba(255,255,255,0.06);
  --portal-nav-active:rgba(21,101,192,0.25);
}

/* ── Login screen ──────────────────────────────────────────────── */

.login-screen {
  min-height: 100vh;
  background: var(--portal-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #1a1a1a;
  border: 1px solid var(--portal-border);
  border-radius: 12px;
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-logo {
  text-align: center;
  margin-bottom: 12px;
  line-height: 1;
}

.login-logo-cb {
  font-size: 52px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -2px;
  line-height: 1;
}

.login-logo-audit {
  font-size: 36px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 2px;
  line-height: 1;
}

.login-logo-check {
  color: var(--portal-check);
  font-size: 32px;
  margin-left: 2px;
}

.login-brand {
  text-align: center;
  color: var(--portal-muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  color: var(--portal-check);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 28px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.login-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--portal-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-field input {
  background: #222222;
  border-color: var(--portal-border);
  color: var(--portal-text);
  padding: 10px 14px;
}

.login-field input:focus {
  border-color: var(--portal-blue);
  box-shadow: 0 0 0 3px rgba(21,101,192,0.2);
  background: #222222;
}

.login-field .input-group input {
  background: #222222;
  color: var(--portal-text);
  border-color: var(--portal-border);
}

.login-field .input-group .toggle-btn {
  color: var(--portal-muted);
}

.login-field .input-group .toggle-btn:hover {
  color: var(--portal-text);
}

.login-error {
  background: rgba(220,38,38,0.15);
  border: 1px solid rgba(220,38,38,0.3);
  color: #f87171;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.btn-login {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  justify-content: center;
  background: var(--portal-blue);
  margin-top: 8px;
}

.btn-login:hover:not(:disabled) {
  background: var(--portal-blue-hover);
}

.login-footer {
  text-align: center;
  color: #555;
  font-size: 11px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--portal-border);
}

/* ── Portal layout ─────────────────────────────────────────────── */

.portal {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Sidebar ───────────────────────────────────────────────────── */

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--portal-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  transition: transform 0.25s ease;
}

.sidebar-logo {
  padding: 24px 20px 12px;
  line-height: 1;
}

.sidebar-logo-cb {
  font-size: 30px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -1px;
  line-height: 1;
}

.sidebar-logo-audit {
  font-size: 20px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 2px;
  line-height: 1.1;
}

.sidebar-logo-check {
  color: var(--portal-check);
  font-size: 18px;
}

.sidebar-brand {
  padding: 0 20px 20px;
  font-size: 11px;
  color: var(--portal-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--portal-border);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 8px;
}

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
  padding: 8px 20px 4px;
}

.nav-item {
  display: block;
  padding: 9px 20px;
  font-size: 13px;
  color: #bbb;
  text-decoration: none;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  line-height: 1.4;
}

.nav-item:hover {
  background: var(--portal-nav-hover);
  color: #fff;
  text-decoration: none;
}

.nav-item.active {
  background: var(--portal-nav-active);
  color: #fff;
  border-left-color: var(--portal-check);
  font-weight: 600;
}

.nav-item-admin {
  color: #888;
}

.nav-item-admin:hover,
.nav-item-admin.active {
  color: #ccc;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}

.sidebar-overlay.visible {
  display: block;
}

/* ── Portal main area ──────────────────────────────────────────── */

.portal-main {
  flex: 1;
  margin-left: 240px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.portal-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.portal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.btn-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  width: 36px;
  height: 36px;
}

.btn-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.portal-content {
  flex: 1;
  padding: 0;
}

.portal-section {
  min-height: calc(100vh - 56px);
}

/* Override app-container inside portal */
.portal-section .app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── User menu / dropdown ──────────────────────────────────────── */

.user-menu-wrap {
  position: relative;
}

.btn-user-dropdown {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  transition: background 0.15s;
}

.btn-user-dropdown:hover {
  background: #eaecef;
}

.user-avatar {
  font-size: 16px;
}

.dropdown-caret {
  font-size: 10px;
  opacity: 0.5;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 180px;
  z-index: 300;
  overflow: hidden;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  transition: background 0.12s;
}

.dropdown-item:hover {
  background: var(--bg);
}

.dropdown-item-danger {
  color: var(--danger);
}

.dropdown-item-danger:hover {
  background: var(--danger-light);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Coming soon placeholder ───────────────────────────────────── */

.section-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  text-align: center;
  color: var(--text-secondary);
  padding: 40px;
}

.coming-soon-icon {
  font-size: 56px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.section-coming-soon h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.section-coming-soon p {
  font-size: 14px;
  max-width: 360px;
}

/* ── Admin panel ───────────────────────────────────────────────── */

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.admin-panel-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 800px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table th {
  background: var(--bg);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  position: sticky;
  top: 0;
}

.admin-table tbody tr:hover {
  background: #f8fafc;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.row-inactive td {
  opacity: 0.5;
}

.perm-col {
  text-align: center !important;
  width: 60px;
}

.actions-col {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Role & status badges */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.role-admin {
  background: rgba(21,101,192,0.12);
  color: var(--portal-blue);
}

.role-user {
  background: #f0f0f0;
  color: #555;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.status-active {
  background: var(--success-light);
  color: var(--success);
}

.status-inactive {
  background: var(--bg);
  color: var(--text-secondary);
}

.badge-self {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(21,101,192,0.1);
  color: var(--portal-blue);
  margin-left: 4px;
  vertical-align: middle;
}

.user-name {
  font-weight: 600;
}

/* Permission toggle switch */
.perm-toggle {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 20px;
  cursor: pointer;
  vertical-align: middle;
}

.perm-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.perm-slider {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 10px;
  transition: background 0.2s;
  cursor: pointer;
}

.perm-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.perm-toggle input:checked + .perm-slider {
  background: var(--portal-blue);
}

.perm-toggle input:checked + .perm-slider::before {
  transform: translateX(14px);
}

.perm-toggle input:disabled + .perm-slider {
  opacity: 0.4;
  cursor: not-allowed;
}

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .portal-main {
    margin-left: 0;
  }

  .btn-menu-toggle {
    display: flex;
  }

  .portal-page-title {
    font-size: 14px;
  }

  .portal-section .app-container {
    padding: 12px;
  }

  .admin-table-wrap {
    font-size: 12px;
  }
}

/* ══════════════════════════════════════════════════════════════════
   Solicitação de Prazo
══════════════════════════════════════════════════════════════════ */

/* Tabs */
.prazo-tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.prazo-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.prazo-tab-btn:hover { color: var(--text); }
.prazo-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.prazo-tab-hidden { display: none !important; }

/* Tabs superiores da Análise de Horas */
.analise-tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
}
.analise-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 12px 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.analise-tab-btn:hover { color: var(--text); }
.analise-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.analise-tab-pane { display: block; }

/* Gestão de cadastros do formulário de prazo (painel admin) */
.prazo-lists-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
@media (max-width: 900px) {
  .prazo-lists-cols { grid-template-columns: 1fr; }
}
.prazo-list-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prazo-list-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.prazo-list-count {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.prazo-list-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px 0;
}
.prazo-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  transition: border-color 0.15s;
}
.prazo-list-item:hover { border-color: var(--primary); }
.prazo-list-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prazo-list-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 3px;
  flex-shrink: 0;
}
.prazo-list-remove:hover { color: var(--danger); background: var(--danger-bg, #fff0f0); }
.prazo-list-add-row {
  display: flex;
  gap: 6px;
}
.prazo-list-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}
.prazo-list-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Formulário: títulos de seção */
.prazo-form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin: 20px 0 12px;
}
.prazo-form-section-title:first-child { margin-top: 0; }

/* Hint inline */
.prazo-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
}

/* Checkboxes de motivos */
.prazo-reasons-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.prazo-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.1s;
}
.prazo-checkbox-label:hover { background: var(--bg); }
.prazo-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Radio group */
.prazo-radio-group {
  display: flex;
  gap: 20px;
  margin-top: 6px;
}
.prazo-radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
}
.prazo-radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Status badges */
.prazo-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.prazo-badge-pendente  { background: #fef3c7; color: #92400e; }
.prazo-badge-analise   { background: #dbeafe; color: #1e40af; }
.prazo-badge-aprovado  { background: #dcfce7; color: #166534; }
.prazo-badge-reprovado { background: #fee2e2; color: #991b1b; }

/* Ordenação */
.prazo-th-sort-asc::after  { content: ' ↑'; color: var(--primary); }
.prazo-th-sort-desc::after { content: ' ↓'; color: var(--primary); }

/* Modal de detalhes */
.prazo-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 640px) {
  .prazo-detail-grid { grid-template-columns: 1fr; }
  .prazo-detail-grid > [style*="grid-column:1/-1"] { grid-column: 1 !important; }
}
.prazo-detail-section {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.prazo-detail-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary);
  margin-bottom: 10px;
}
.prazo-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
}
.prazo-dl dt {
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.prazo-dl dd { margin: 0; color: var(--text); word-break: break-word; }
.prazo-dl-inline { grid-template-columns: repeat(3, auto 1fr); }

/* Tabela hover */
#prazoTable tbody tr:hover { background: #f8fafc; }
#prazoTable td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }

/* ── Modal close button fix ────────────────────────────────────── */

.modal-close {
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
}

/* ══════════════════════════════════════════════════════════════════
   Módulo: Solicitação de Inovação
══════════════════════════════════════════════════════════════════ */

/* Tabs */
.inov-tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.inov-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.inov-tab-btn:hover { color: var(--text); }
.inov-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.inov-tab-hidden { display: none !important; }

/* Checkboxes de auditores */
.inov-auditors-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: var(--surface);
}
.inov-auditor-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  user-select: none;
  white-space: nowrap;
}
.inov-auditor-label:hover { border-color: var(--primary); background: #f0f4ff; }
.inov-auditor-label.inov-auditor-checked {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.inov-auditor-label.inov-auditor-checked span { color: #fff; }
.inov-auditor-cb { display: none; }

/* Status badges */
.inov-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.inov-badge-pendente  { background: #fef3c7; color: #92400e; }
.inov-badge-analise   { background: #dbeafe; color: #1e40af; }
.inov-badge-aprovado  { background: #dcfce7; color: #166534; }
.inov-badge-reprovado { background: #fee2e2; color: #991b1b; }

/* Tabela hover */
#inovTable tbody tr:hover { background: #f8fafc; }
#inovTable td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }

/* Modal de detalhe */
.inov-detail-grid { display: flex; flex-direction: column; gap: 16px; }
.inov-detail-row  { display: flex; gap: 24px; flex-wrap: wrap; }
.inov-detail-col  { flex: 1; min-width: 200px; }
.inov-detail-full { flex-direction: column; }
.inov-detail-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.inov-detail-value { font-size: 14px; color: var(--text); word-break: break-word; }
.inov-detail-desc  { white-space: pre-wrap; font-size: 13px; line-height: 1.6; }
.inov-detail-tag {
  display: inline-block;
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 12px;
  margin: 2px 2px 2px 0;
}

/* ══════════════════════════════════════════════════════════════════
   Solicitação de Adiantamento
══════════════════════════════════════════════════════════════════ */

/* Tabs */
.adiant-tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.adiant-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.adiant-tab-btn:hover { color: var(--text); }
.adiant-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.adiant-tab-hidden { display: none !important; }

/* Caixa de regras */
.adiant-rules-box {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
}
.adiant-rules-title {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 8px;
}
.adiant-rules-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #78350f;
  line-height: 1.7;
}

/* Status badges */
.adiant-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.adiant-badge-pendente  { background: #fef3c7; color: #92400e; }
.adiant-badge-analise   { background: #dbeafe; color: #1e40af; }
.adiant-badge-aprovado  { background: #dcfce7; color: #166534; }
.adiant-badge-reprovado { background: #fee2e2; color: #991b1b; }

/* Tabela hover */
#adiantTable tbody tr:hover { background: #f8fafc; }
#adiantTable td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }

/* Pagination bar */
.pagination-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 4px;
  flex-wrap: wrap;
}
.pagination-bar.hidden { display: none; }
.pag-info { font-size: 13px; color: var(--text-muted); margin-right: auto; }
