.admin-body { display: block; background: #f5f8fa; }
.admin-main { width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 48px; }
.admin-login { max-width: 440px; margin: 10vh auto 0; }
.admin-header {
  display: flex; justify-content: space-between; gap: 24px; align-items: center;
  margin-bottom: 8px; padding: 20px 28px; background: #fff;
  border-radius: 14px; box-shadow: 0 0 20px rgba(0,0,0,.04);
}
.admin-header h1 { margin: 0 0 2px; font-size: 1.4rem; }
.admin-header p { margin: 0; font-size: .85rem; color: #7e8299; }
.header-actions, .form-actions, .site-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.header-actions button, .header-actions a, .form-actions button, .site-actions button { width: auto; padding: 0 18px; }
.button-link { display: inline-grid; place-items: center; min-height: 42px; border-radius: 8px; padding: 0 18px; text-decoration: none; font-weight: 600; background: #0095ff; color: white; font-size: .85rem; transition: .15s; }
.button-link:hover { background: #007ad6; }
.button-link.secondary { background: #f1f3f5; color: #3f4254; }
.button-link.secondary:hover { background: #e4e6ea; }

.admin-tabs {
  display: flex; flex-wrap: wrap; gap: 4px; margin: 20px 0;
  padding: 6px; background: #fff; border-radius: 12px; box-shadow: 0 0 20px rgba(0,0,0,.04);
}
.admin-tabs button {
  width: auto; margin: 0; padding: 0 22px; white-space: nowrap; min-height: 38px; background: transparent;
  color: #7e8299; font-weight: 600; font-size: .85rem; border-radius: 8px; transition: .15s;
}
.admin-tabs button:hover { background: #f1f3f5; color: #3f4254; }
.admin-tabs button.active { background: #0095ff; color: #fff; }

.admin-grid { display: grid; grid-template-columns: minmax(300px, 440px) 1fr; gap: 20px; align-items: start; }
.admin-grid h2 { margin-top: 0; color: #181c32; font-size: 1.05rem; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.checkbox input { width: 20px; min-height: 20px; margin: 0; }
.map-link { display: inline-block; margin-top: 12px; }
.site-row {
  border: 1px solid #eff2f5; border-radius: 10px; padding: 18px;
  margin-top: 12px; background: #fafbfc; transition: .15s;
}
.site-row:hover { border-color: #d5dae0; }
.site-row h3 { margin: 0 0 6px; font-size: 1rem; }
.site-meta { color: #7e8299; font-size: .85rem; margin-bottom: 10px; }
.site-actions button { margin-top: 0; min-height: 36px; font-size: .82rem; }
.site-actions .danger { background: #f44646; }
.status-passive { color: #f44646; font-weight: 600; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: 12px; padding: 22px 24px;
  box-shadow: 0 0 20px rgba(0,0,0,.04); position: relative; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(0,0,0,.08); }
.stat-card strong { display: block; font-size: 2rem; color: #181c32; line-height: 1.2; }
.stat-card span { color: #7e8299; font-size: .82rem; text-transform: uppercase; letter-spacing: .3px; }
.stat-card .stat-icon {
  position: absolute; right: 16px; top: 16px; font-size: 2rem; line-height: 1; opacity: .12;
}
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.wide-card { grid-column: 1 / -1; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .85rem; }
.data-table thead th {
  padding: 12px 10px; border-bottom: 2px solid #eff2f5;
  color: #7e8299; font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px;
  background: #fafbfc;
}
.data-table thead th:first-child { border-radius: 8px 0 0 0; }
.data-table thead th:last-child { border-radius: 0 8px 0 0; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: #f5f8fa; }
.data-table tbody tr:last-child td:first-child { border-radius: 0 0 0 8px; }
.data-table tbody tr:last-child td:last-child { border-radius: 0 0 8px 0; }
.data-table td { padding: 11px 10px; border-bottom: 1px solid #eff2f5; vertical-align: middle; }
.data-table td small { color: #7e8299; font-size: .78rem; }
.data-table button {
  width: auto; min-height: 30px; margin: 0 3px 0 0; padding: 0 10px;
  font-size: .8rem; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px;
}
.data-table .approve { background: #0bb783; }
.data-table .approve:hover { background: #099e6f; }
.data-table .reject { background: #f44646; }
.data-table .reject:hover { background: #d93636; }
.data-table .danger { background: #f44646; }
.data-table .danger:hover { background: #d93636; }
.mobile-badge { color: #0bb783; font-weight: 600; }
.data-table code {
  font-size: .78rem; background: #f1f3f5; padding: 3px 7px; border-radius: 5px;
  color: #3f4254; font-family: ui-monospace, monospace;
}

.card {
  background: #fff; border-radius: 12px; padding: 22px 24px;
  box-shadow: 0 0 20px rgba(0,0,0,.04);
}
.card h2 { margin-top: 0; margin-bottom: 14px; font-size: 1.05rem; color: #181c32; }
.card p { font-size: .85rem; color: #7e8299; }

input, button, select, textarea {
  width: 100%; min-height: 44px; border-radius: 8px; font: inherit;
}
input, select, textarea { border: 1px solid #d5dae0; padding: 10px 12px; background: #fff; transition: border .15s; }
input:focus, select:focus, textarea:focus { border-color: #0095ff; outline: none; box-shadow: 0 0 0 3px rgba(0,149,255,.12); }
button { margin-top: 16px; border: 0; background: #0095ff; color: #fff; font-weight: 600; transition: .15s; cursor: pointer; }
button:hover { background: #007ad6; }
button.secondary { background: #f1f3f5; color: #3f4254; }
button.secondary:hover { background: #e4e6ea; }
button:disabled { opacity: .5; cursor: default; }
button:disabled:hover { background: inherit; }
label { display: grid; gap: 5px; margin-top: 14px; font-weight: 600; font-size: .85rem; color: #3f4254; }
input[readonly] { background: #f5f8fa; color: #7e8299; cursor: default; }

.door-shortcut {
  display: grid; gap: 4px; text-align: left; margin: 0 0 24px; padding: 20px 24px;
  min-height: 72px; background: linear-gradient(135deg, #1b2d4c, #1e3a5f);
  border-radius: 12px; color: #fff; cursor: pointer; transition: .15s;
}
.door-shortcut:hover { background: linear-gradient(135deg, #1e3a5f, #234b78); }
.door-shortcut strong { font-size: 1.05rem; }
.door-shortcut span { font-weight: 400; opacity: .85; font-size: .85rem; }
.quick-door-button { background: #0bb783; }
.quick-door-button:hover { background: #099e6f; }
.current-database { margin-top: 6px !important; color: #7e8299; font-size: .82rem; }
.public-address { margin-top: 2px !important; color: #7e8299; font-size: .82rem; }
.public-address a { color: #0095ff; font-weight: 600; }
.database-card { max-width: 680px; }
.database-details { margin-top: 12px; padding: 12px 14px; border-radius: 8px; background: #f5f8fa; }
.database-details p { margin: 0; font-size: .85rem; }
.database-ok { color: #0bb783; font-weight: 600; }
.database-error, .database-warning { color: #f44646; font-weight: 600; }
.database-warning { font-size: .82rem; }

output { display: block; min-height: 44px; margin-top: 16px; padding: 12px 14px; text-align: center; border-radius: 8px; }
output.success { color: #096b3e; background: #dff6e9; }
output.error { color: #f44646; background: #fde6e6; }

.card .table-scroll { margin: 0 -24px; overflow-x: auto; }
.card .table-scroll .data-table { min-width: 360px; }
.card .table-scroll .data-table thead th { padding-left: 24px; }
.card .table-scroll .data-table thead th:first-child { border-radius: 0; }
.card .table-scroll .data-table td { padding-left: 24px; }
.card .table-scroll .data-table thead th:last-child { padding-right: 24px; }
.card .table-scroll .data-table tbody td:last-child { padding-right: 24px; }

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .admin-header { align-items: flex-start; flex-direction: column; }
  .admin-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .wide-card { grid-column: auto; }
  .admin-tabs { gap: 2px; padding: 4px; }
  .admin-tabs button { padding: 0 12px; font-size: .8rem; min-height: 34px; }
}

@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; inset: 0; }
}
