*{box-sizing:border-box}
:root{
  --bg:#0f172a;
  --panel:#111827;
  --panel-2:#1f2937;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:#374151;
  --accent:#2563eb;
  --accent-hover:#1d4ed8;
  --danger:#b91c1c;
  --danger-hover:#991b1b;
  --success:#15803d;
  --warning:#b45309;
  --shadow:0 18px 45px rgba(0,0,0,.25);
}

html,body{
  margin:0;
  padding:0;
  font-family:Arial,Helvetica,sans-serif;
  background:#f3f4f6;
  color:#111827;
}

body.auth-body{
  min-height:100vh;
  background:linear-gradient(135deg,#0f172a,#1e3a8a);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.auth-card{
  width:min(100%,470px);
  background:rgba(255,255,255,.97);
  border-radius:18px;
  padding:28px;
  box-shadow:var(--shadow);
}

.auth-card h1,.auth-card h2{margin-top:0}

label{
  display:block;
  font-weight:700;
  margin:0 0 6px;
}

input[type=text],
input[type=password],
input[type=email],
input[type=url],
input[type=number],
input[type=date],
select,
textarea{
  width:100%;
  padding:12px 14px;
  border:1px solid #d1d5db;
  border-radius:10px;
  font-size:14px;
  background:#fff;
}

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

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

.form-grid .full{grid-column:1/-1}

button,.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  background:var(--accent);
  color:#fff;
  border:none;
  border-radius:10px;
  padding:11px 16px;
  text-decoration:none;
  font-weight:700;
  cursor:pointer;
}

button:hover,.btn:hover{background:var(--accent-hover)}
.btn.secondary{background:#4b5563}
.btn.secondary:hover{background:#374151}
.btn.danger{background:var(--danger)}
.btn.danger:hover{background:var(--danger-hover)}
.btn.success{background:var(--success)}
.btn.warning{background:var(--warning)}

.alert{
  padding:14px 16px;
  border-radius:12px;
  margin:0 0 18px;
}

.alert.error{
  background:#fee2e2;
  color:#991b1b;
  border:1px solid #fecaca;
}

.alert.success{
  background:#dcfce7;
  color:#166534;
  border:1px solid #bbf7d0;
}

.layout{
  min-height:100vh;
  display:grid;
  grid-template-columns:270px 1fr;
}

.sidebar{
  background:var(--bg);
  color:var(--text);
  padding:24px 18px;
  display:flex;
  flex-direction:column;
  gap:14px;
}

.brand{
  font-size:22px;
  font-weight:800;
  margin-bottom:10px;
}

.brand small{
  display:block;
  color:var(--muted);
  font-size:12px;
  font-weight:400;
  margin-top:3px;
}

.nav a{
  display:block;
  color:var(--text);
  text-decoration:none;
  padding:12px 14px;
  border-radius:12px;
  margin-bottom:6px;
  background:transparent;
}

.nav a:hover,.nav a.active{
  background:rgba(255,255,255,.08);
}

.main{
  padding:28px;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:24px;
  gap:18px;
}

.topbar h1{
  margin:0;
  font-size:28px;
}

.topbar .meta{
  color:#4b5563;
  font-size:14px;
}

.card{
  background:#fff;
  border-radius:18px;
  padding:22px;
  box-shadow:0 10px 30px rgba(15,23,42,.06);
  margin-bottom:22px;
}

.card h2,.card h3{margin-top:0}

.card-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:18px;
}

.stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:18px;
  margin-bottom:26px;
}

.stat{
  background:linear-gradient(180deg,#fff,#f8fafc);
  border:1px solid #e5e7eb;
  border-radius:16px;
  padding:18px;
}

.stat strong{
  display:block;
  font-size:28px;
  margin-top:6px;
}

.help{
  color:#6b7280;
  font-size:13px;
}

table{
  width:100%;
  border-collapse:collapse;
}

th,td{
  padding:13px 12px;
  border-bottom:1px solid #e5e7eb;
  text-align:left;
  vertical-align:top;
  font-size:14px;
}

th{
  background:#f9fafb;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:#4b5563;
}

.table-wrap{
  overflow:auto;
}

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

.badge{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
}

.badge.ok{
  background:#dcfce7;
  color:#166534;
}

.badge.off{
  background:#fee2e2;
  color:#991b1b;
}

.badge.neutral{
  background:#e5e7eb;
  color:#374151;
}

.dropzone{
  border:2px dashed #93c5fd;
  background:#eff6ff;
  border-radius:16px;
  padding:28px;
  text-align:center;
  color:#1e40af;
}

.dropzone.dragover{
  background:#dbeafe;
  border-color:#2563eb;
}

.inline-form{
  display:flex;
  gap:10px;
  align-items:end;
  flex-wrap:wrap;
}

.inline-form > div{
  flex:1;
  min-width:190px;
}

ul.clean{
  list-style:none;
  padding:0;
  margin:0;
}

ul.clean li{
  padding:8px 0;
  border-bottom:1px dashed #e5e7eb;
}

.doc-title{
  font-weight:700;
}

.doc-meta{
  color:#6b7280;
  font-size:12px;
  margin-top:4px;
}

.footer-note{
  font-size:12px;
  color:#6b7280;
  margin-top:14px;
}

.portal-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:22px;
  gap:16px;
  background:#fff;
  padding:18px 22px;
  border-radius:18px;
  box-shadow:0 10px 30px rgba(15,23,42,.06);
}

.portal-wrap{
  max-width:1200px;
  margin:0 auto;
  padding:24px;
}

.login-note{
  font-size:13px;
  color:#6b7280;
}

hr.soft{
  border:none;
  height:1px;
  background:#e5e7eb;
  margin:18px 0;
}

.filters-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px;
}

.filters-grid .full{
  grid-column:1/-1;
}

.log-details{
  max-width:420px;
  white-space:pre-wrap;
  word-break:break-word;
  color:#374151;
  font-size:12px;
}

@media print{
  .sidebar,
  .topbar .actions,
  .card .actions,
  form,
  .btn,
  button{
    display:none !important;
  }

  .layout{
    display:block;
  }

  .main{
    padding:0;
  }

  .card{
    box-shadow:none;
    border:1px solid #d1d5db;
    page-break-inside:avoid;
  }

  body{
    background:#fff;
  }

  th,td{
    font-size:12px;
    padding:8px;
  }
}

@media (max-width: 1000px){
  .layout{grid-template-columns:1fr}
  .sidebar{padding-bottom:10px}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .filters-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (max-width: 640px){
  .form-grid,
  .stats,
  .filters-grid{
    grid-template-columns:1fr;
  }

  .topbar,
  .portal-header,
  .card-head{
    flex-direction:column;
    align-items:flex-start;
  }

  .main,
  .portal-wrap{
    padding:16px;
  }

  .card{
    padding:16px;
  }

  th,td{
    font-size:13px;
    padding:10px 8px;
  }
}

.password-tools{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.password-tools-input{
  flex:1 1 340px;
  min-width:260px;
}

.user-actions-stack{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.password-reset-row{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.password-reset-row input[type="text"]{
  flex:1 1 240px;
  min-width:220px;
}

@media (max-width: 640px){
  .password-tools,
  .password-reset-row{
    flex-direction:column;
    align-items:stretch;
  }

  .password-tools-input,
  .password-reset-row input[type="text"]{
    min-width:100%;
  }
}