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

:root {
  --bg-dark: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-header: #1e293b;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --pink: #ec4899;
  --purple: #8b5cf6;
  --cyan: #0ea5e9;

  --badge-em-dia: #10b981;
  --badge-venc-2d: #059669;
  --badge-venc-1d: #ec4899;
  --badge-atraso-1d: #eab308;
  --badge-atraso-2d: #f97316;
  --badge-atraso-3d: #d946ef;
  --badge-bloqueado: #ef4444;
  --badge-sem-carne: #64748b;
  
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  scrollbar-width: thin;
  scrollbar-color: #334155 #0f172a;
}

/* Global Custom Scrollbar (Sleek Dark UX) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #0f172a;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
  border: 2px solid #0f172a;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

::-webkit-scrollbar-thumb:active {
  background: #38bdf8;
}

::-webkit-scrollbar-corner {
  background: #0f172a;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* App Container */
#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: white;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

.logo-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-menu {
  padding: 16px 8px;
  flex: 1;
  overflow-y: auto;
}

.nav-group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 12px 6px 12px;
  letter-spacing: 0.5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 4px;
}

.nav-item:hover, .nav-item.active {
  background-color: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.nav-item.active {
  font-weight: 600;
  border-left: 3px solid var(--primary);
}

.nav-item svg {
  width: 18px;
  height: 18px;
}

/* Main Content Layout */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top Action Header */
.top-header {
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
  outline: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(1px) scale(0.98) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
  filter: brightness(0.9) !important;
}

.btn:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* Primary Button (Blue) */
.btn-primary {
  background-color: #2563eb !important;
  color: #ffffff !important;
  border-color: #3b82f6 !important;
  font-weight: 600;
}
.btn-primary:hover {
  background-color: #1d4ed8 !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45) !important;
}

/* Secondary Button (Dark Slate) */
.btn-secondary {
  background-color: #334155 !important;
  color: #f1f5f9 !important;
  border-color: #475569 !important;
}
.btn-secondary:hover {
  background-color: #475569 !important;
  border-color: #64748b !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* Success Button (Vibrant Emerald / Green) */
.btn-success {
  background-color: #16a34a !important;
  color: #ffffff !important;
  border-color: #22c55e !important;
  font-weight: 700 !important;
  letter-spacing: 0.2px;
}
.btn-success:hover {
  background-color: #15803d !important;
  border-color: #4ade80 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.45) !important;
}
.btn-success:active {
  background-color: #14532d !important;
  border-color: #15803d !important;
  color: #ffffff !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5) !important;
  transform: translateY(1px) scale(0.97) !important;
  filter: brightness(0.85) !important;
}

/* Primary Button (Blue) */
.btn-primary {
  background-color: #2563eb !important;
  color: #ffffff !important;
  border-color: #3b82f6 !important;
  font-weight: 700 !important;
}
.btn-primary:hover {
  background-color: #1d4ed8 !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45) !important;
}
.btn-primary:active {
  background-color: #1e40af !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5) !important;
  transform: translateY(1px) scale(0.97) !important;
}

/* Secondary Button (Dark Slate) */
.btn-secondary {
  background-color: #334155 !important;
  color: #f1f5f9 !important;
  border-color: #475569 !important;
}
.btn-secondary:hover {
  background-color: #475569 !important;
  border-color: #64748b !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}
.btn-secondary:active {
  background-color: #1e293b !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5) !important;
  transform: translateY(1px) scale(0.97) !important;
}

/* Danger Button (Red) */
.btn-danger {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
  font-weight: 700 !important;
}
.btn-danger:hover {
  background-color: #b91c1c !important;
  border-color: #f87171 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45) !important;
}
.btn-danger:active {
  background-color: #991b1b !important;
  border-color: #b91c1c !important;
  color: #ffffff !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5) !important;
  transform: translateY(1px) scale(0.97) !important;
}

/* Outline / Soft variant for badges or subtle actions */
.btn-outline-success {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}
.btn-outline-success:hover {
  background-color: #16a34a !important;
  color: #ffffff !important;
  border-color: #22c55e !important;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.4) !important;
}

.header-search {
  display: flex;
  align-items: center;
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  width: 320px;
}

.header-search input {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  font-size: 13px;
  width: 100%;
  margin-left: 8px;
}

/* Page Container */
.content-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: var(--bg-dark);
}

/* View Section Toggle */
.view-section {
  display: none;
}
.view-section.active {
  display: block;
}

/* Section Header */
.section-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title-bar h2 {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Kanban Board Layout */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  height: calc(100vh - 140px);
}

.kanban-col {
  min-width: 290px;
  max-width: 290px;
  background-color: #162032;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.kanban-col-header {
  padding: 12px 14px;
  border-top-left-radius: 7px;
  border-top-right-radius: 7px;
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.col-count {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
}

.kanban-cards-container {
  padding: 10px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Kanban Card */
.kanban-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.kanban-card:hover {
  transform: translateY(-2px);
  border-color: #475569;
  background-color: var(--bg-card-hover);
}

.card-company {
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 2px;
}

.card-fantasia {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.card-field {
  font-size: 11px;
  color: #cbd5e1;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.card-field span.val {
  font-weight: 600;
  color: #60a5fa;
}

.card-serial {
  font-family: monospace;
  background-color: #0f172a;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  color: #f59e0b;
  margin-top: 6px;
  display: inline-block;
  word-break: break-all;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #334155;
}

.icon-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.icon-btn.zap:hover {
  background: #22c55e;
}

/* Form Control Styles */
.form-control {
  background-color: #0f172a !important;
  border: 1px solid #334155 !important;
  border-radius: 6px !important;
  padding: 8px 12px !important;
  color: #f8fafc !important;
  font-size: 13px !important;
  outline: none !important;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  color-scheme: dark;
}

.form-control:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2) !important;
}

.form-control option {
  background-color: #0f172a;
  color: #f8fafc;
}

/* Data Tables & Table Container */
.table-container, .table-responsive {
  width: 100%;
  overflow-x: auto;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.table, .data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.table th, .data-table th {
  background-color: #0f172a;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table td, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.table tr:nth-child(even), .data-table tr:nth-child(even) {
  background-color: rgba(15, 23, 42, 0.35);
}

.table tr:hover, .data-table tr:hover {
  background-color: rgba(51, 65, 85, 0.5);
}

.table tr.row-selected, .data-table tr.row-selected {
  background-color: rgba(14, 116, 194, 0.45) !important;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-ativo { background-color: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge-vencendo { background-color: rgba(245, 158, 11, 0.25); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-atraso { background-color: rgba(249, 115, 22, 0.2); color: #fdba74; }
.badge-bloqueado { background-color: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.badge-aguardando { background-color: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-inativo { background-color: rgba(100, 116, 139, 0.2); color: #cbd5e1; }
.badge-cortesia { background-color: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.badge-pre { background-color: rgba(245, 158, 11, 0.2); color: #fde047; }
.badge-renovacao-confirmada { background-color: rgba(234, 179, 8, 0.25); color: #fde047; border: 1px solid rgba(234, 179, 8, 0.4); }

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 850px;
  height: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #0f172a;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}
.modal-close:hover { color: white; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#form-client {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: #0f172a;
}

/* Tabs inside Modal */
.modal-tabs {
  display: flex;
  gap: 16px;
  background: transparent;
  border-bottom: 1px solid #334155;
  margin-bottom: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE and Edge */
  padding: 0;
  width: 100%;
}

.modal-tabs::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.tab-btn {
  padding: 10px 4px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 600; /* Consistent font-weight prevents any pixel shift on click */
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  outline: none;
}

.tab-btn:hover {
  color: #e2e8f0;
  background: transparent;
}

.tab-btn.active {
  color: #3b82f6;
  border-bottom: 2px solid #3b82f6;
  font-weight: 600; /* Identical weight prevents layout shift */
  background: transparent;
  box-shadow: none;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
}

.serial-highlight-box {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 70, 239, 0.1));
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spin-animation {
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* Modal Client Enlarged & Enhanced */
.modal-client-content {
  width: 96vw !important;
  max-width: 1440px !important;
  height: 90vh !important;
  max-height: 94vh !important;
}

@media (max-width: 1024px) {
  .modal-client-content {
    width: 98vw !important;
    max-width: 98vw !important;
    height: 94vh !important;
    max-height: 96vh !important;
  }
}

/* ==========================================================================
   UNIFI OS STYLE LOGIN PORTAL (Ubiquiti Appliance Aesthetic)
   ========================================================================== */

#modal-login.unifi-login-portal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  background-color: #07090e;
  background-image: 
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(37, 99, 235, 0.22), transparent 70%),
    radial-gradient(ellipse 50% 35% at 50% 105%, rgba(15, 23, 42, 0.8), transparent),
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 36px 20px 24px 20px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
  overflow-y: auto;
}

/* Instant visibility for unauthenticated users */
html.not-authenticated #modal-login.unifi-login-portal,
#modal-login.unifi-login-portal.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

#modal-login.unifi-login-portal.closing {
  opacity: 0;
  transform: scale(1.02);
  pointer-events: none;
}

/* Ambient Top Accent Bar */
.unifi-portal-top-accent {
  width: 100%;
  max-width: 480px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
  margin-bottom: auto;
  opacity: 0.6;
}

/* Central UniFi Card */
.unifi-login-card {
  width: 100%;
  max-width: 410px;
  margin: auto;
  background: rgba(13, 19, 33, 0.85);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  box-shadow: 
    0 25px 60px -15px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 45px -10px rgba(37, 99, 235, 0.18);
  padding: 36px 32px 32px 32px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.unifi-login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.8), transparent);
}

/* Brand & Device Identity */
.unifi-brand-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 26px;
}

.unifi-brand-icon-wrap {
  position: relative;
  width: 58px;
  height: 58px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unifi-brand-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
}

.unifi-brand-glow {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 174, 155, 0.3) 0%, rgba(37, 99, 235, 0.2) 50%, transparent 75%);
  z-index: 1;
  filter: blur(5px);
}

.unifi-brand-title {
  font-size: 21px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
  font-family: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.unifi-brand-subtitle {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 400;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.unifi-device-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.22);
  color: #34d399;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.unifi-status-led {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: unifi-led-pulse 2.2s infinite ease-in-out;
}

@keyframes unifi-led-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px #10b981; }
  50% { opacity: 0.45; transform: scale(0.9); box-shadow: 0 0 3px #10b981; }
}

/* Form Styles */
.unifi-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.unifi-field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.unifi-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.unifi-field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: #cbd5e1;
  letter-spacing: 0.01em;
}

.unifi-field-label svg {
  color: #64748b;
}

.unifi-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.unifi-input-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color 0.2s ease;
}

.unifi-input {
  width: 100%;
  height: 48px;
  background: rgba(3, 7, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 12px 44px 12px 42px;
  color: #f8fafc;
  font-size: 14.5px;
  outline: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  font-family: inherit;
}

.unifi-input::placeholder {
  color: #475569;
  font-size: 13.5px;
}

.unifi-input:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(3, 7, 18, 0.85);
}

.unifi-input:focus {
  border-color: #3b82f6;
  background: rgba(3, 7, 18, 0.95);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.unifi-input:focus ~ .unifi-input-icon {
  color: #3b82f6;
}

.unifi-input-action-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #64748b;
  padding: 6px;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.unifi-input-action-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.06);
}

/* Caps lock warning */
.unifi-caps-warning {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #f59e0b;
  font-weight: 500;
  margin-top: 2px;
  animation: unifi-fade-in 0.2s ease;
}

/* Options row */
.unifi-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.unifi-checkbox-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.unifi-checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.unifi-checkbox-custom {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.unifi-checkbox-container input:checked ~ .unifi-checkbox-custom {
  background: #2563eb;
  border-color: #3b82f6;
}

.unifi-checkbox-container input:checked ~ .unifi-checkbox-custom::after {
  content: '';
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.unifi-checkbox-text {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 400;
}

.unifi-ssl-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: #64748b;
}

.unifi-ssl-tag svg {
  color: #0284c7;
}

/* Error Banner */
.unifi-error-banner {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fca5a5;
  font-size: 12.5px;
  font-weight: 500;
  animation: unifi-fade-in 0.25s ease;
}

.unifi-error-banner svg {
  flex-shrink: 0;
  color: #ef4444;
}

/* Submit Button */
.unifi-btn-submit {
  width: 100%;
  height: 48px;
  margin-top: 6px;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border: 1px solid #3b82f6;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 4px 14px rgba(37, 99, 235, 0.38);
}

.unifi-btn-submit:hover:not(:disabled) {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 6px 20px rgba(37, 99, 235, 0.52);
  transform: translateY(-1px);
}

.unifi-btn-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.unifi-btn-submit:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.unifi-btn-arrow {
  transition: transform 0.2s ease;
}

.unifi-btn-submit:hover:not(:disabled) .unifi-btn-arrow {
  transform: translateX(3px);
}

/* Spinner */
.unifi-spinner {
  animation: unifi-spin 0.8s linear infinite;
}

@keyframes unifi-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes unifi-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Shake animation for errors */
@keyframes unifi-shake {
  0%, 100% { transform: translateX(0); }
  15%, 55%, 85% { transform: translateX(-8px); }
  35%, 70% { transform: translateX(8px); }
}

.unifi-login-card.shake {
  animation: unifi-shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Footer */
.unifi-portal-footer {
  margin-top: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 0 6px 0;
}

.unifi-footer-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.unifi-footer-dot {
  color: #334155;
}

.unifi-footer-security {
  font-size: 11px;
  color: #475569;
}

@media (max-width: 480px) {
  #modal-login.unifi-login-portal {
    padding: 20px 14px;
  }
  .unifi-login-card {
    padding: 28px 20px 24px 20px;
    border-radius: 16px;
  }
  .unifi-brand-title {
    font-size: 19px;
  }
  .unifi-brand-subtitle {
    font-size: 12px;
  }
  .unifi-input {
    font-size: 16px !important; /* Prevents unwanted auto-zoom on iOS */
  }
}

