*, *::before, *::after { box-sizing:border-box; margin:0; padding:0; }
a { text-decoration:none; color:inherit; }
button { cursor:pointer; font-family:inherit; }
img { display:block; max-width:100%; }
ul, ol { list-style:none; }
input, select, textarea { font-family:inherit; }

:root {
  --bg: #f5f5f7;
  --bg-card: #ffffff;
  --bg-sidebar: #1a1a1a;
  --bg-sidebar-hover: #2a2a2a;
  --text: #1a1a1a;
  --text-muted: #595959;
  --text-light: rgba(255,255,255,.65);
  --border: #e5e5e5;
  --border-soft: #f0f0f0;
  --primary: #1a1a1a;
  --primary-hover: #000;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #22c55e;
  --success-bg: #dcfce7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --transition: .2s ease;
}

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

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  font-size: 1.3rem;
  font-weight: 400;
  margin-bottom: 4px;
}
.login-logo strong { font-weight: 800; }
.login-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.login-error {
  color: var(--danger);
  font-size: .8rem;
  margin-top: 12px;
  min-height: 1.2em;
}

.form-field {
  margin-bottom: 16px;
}
.form-field label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 5px;
}
.form-field input.is-invalid,
.form-field select.is-invalid,
.form-field textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--text);
  background: #fff;
  transition: border-color var(--transition);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,26,26,.06);
}
.form-field textarea {
  resize: vertical;
  min-height: 80px;
}
.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.form-field .hint {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.form-row .col-full { grid-column: 1 / -1; }
.form-row .col-2 { grid-column: span 2; }

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  cursor: pointer;
  padding: 4px 0;
}
.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  transition: background var(--transition);
  margin-top: 4px;
}
.btn-login:hover { background: var(--primary-hover); }

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
}
.sidebar-header {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
  font-size: 1rem;
  font-weight: 400;
  color: #fff;
}
.sidebar-logo strong { font-weight: 800; }
.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 22px;
  padding: 0;
  margin: -6px -10px -6px 0;
  cursor: pointer;
}
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all var(--transition);
}
.sidebar-link:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}
.sidebar-link.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 600;
}
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: .85rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.btn-logout:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  flex: 1;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-user {
  font-size: .82rem;
  color: var(--text-muted);
}
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  padding: 4px;
  color: var(--text);
}

.page-content {
  padding: 28px;
  max-width: 1200px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  margin: 0;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
}
.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-card.accent .stat-number { color: var(--accent); }
.stat-card.success .stat-number { color: var(--success); }
.stat-card.warning .stat-number { color: var(--warning); }

.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  font-size: .85rem;
}
.data-table tr:hover td { background: var(--bg); }
.tbl-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity var(--transition);
}
.tbl-thumb:hover { opacity: .8; }
.tbl-title { font-weight: 600; }
.tbl-sub { font-size: .75rem; color: var(--text-muted); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.badge-sale { background: var(--primary); color: #fff; }
.badge-rent { background: #555; color: #fff; }
.badge-active { background: var(--success-bg); color: #15803d; }
.badge-inactive { background: var(--danger-bg); color: #b91c1c; }
.badge-featured { background: var(--warning-bg); color: #b45309; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); }
.btn-danger-outline {
  background: transparent;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.btn-danger-outline:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .75rem; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(37,99,235,.03);
}
.upload-zone-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}
.upload-zone-text {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.upload-zone-hint {
  font-size: .75rem;
  color: var(--text-muted);
  opacity: .7;
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-progress {
  margin-top: 12px;
  display: none;
}
.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width .3s;
  width: 0;
}

.images-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.preview-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-soft);
  aspect-ratio: 4/3;
}
.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}
.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.7);
  color: #fff;
  border: none;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition);
}
.preview-item:hover .preview-remove { opacity: 1; }
.preview-main-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: var(--accent);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 50px;
  text-transform: uppercase;
}

.preview-container {
  max-width: 800px;
}
.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}
.preview-card-photo {
  height: 300px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.preview-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--primary);
  color: #fff;
}
.preview-card-body {
  padding: 24px;
}
.preview-price {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.preview-price-sub {
  font-weight: 400;
  font-size: .85rem;
  color: var(--text-muted);
}
.preview-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}
.preview-meta-item {
  font-size: .85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.preview-desc {
  color: #555;
  line-height: 1.7;
  font-size: .9rem;
}
.preview-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.preview-gallery img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity var(--transition);
}
.preview-gallery img:hover { opacity: .85; }

.preview-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  margin-top: 16px;
}
.preview-detail {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: .85rem;
}
.preview-detail-label { color: var(--text-muted); }
.preview-detail-value { font-weight: 600; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
}
.modal-large { max-width: 900px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-header h2 { font-size: 1rem; font-weight: 700; }
.modal-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  padding: 4px;
}
.modal-close-btn:hover { color: var(--text); }
.modal-body {
  padding: 24px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.lightbox.open {
  opacity: 1;
  pointer-events: all;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition);
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state svg { margin: 0 auto 12px; opacity: .3; }
.empty-state h3 { font-size: 1rem; color: var(--text); margin-bottom: 4px; }
.empty-state p { font-size: .85rem; }

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: .85rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn .3s ease;
  max-width: 360px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity:0; transform:translateX(20px); }
  to { opacity:1; transform:translateX(0); }
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
}
.search-input:focus { outline: none; border-color: var(--primary); }
.filter-select {
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .85rem;
  appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 8px center;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 0;
}
.page-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: .82rem;
  background: #fff;
  color: var(--text);
  transition: all var(--transition);
}
.page-btn:hover { border-color: var(--primary); }
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: 50px;
  font-size: .75rem;
}
.tag-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.tag-remove:hover { color: var(--danger); }

.settings-section {
  margin-bottom: 24px;
}
.settings-section h3 {
  font-size: .9rem;
  font-weight: 700;
  margin-bottom: 12px;
}

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: repeat(2, 1fr); }
  .preview-details-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .main-content { margin-left: 0; }
  .hamburger-btn { display: block; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-row .col-2,
  .form-row .col-full { grid-column: 1; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .modal-body { padding: 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .images-preview { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .preview-gallery { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: all;
}
@media (min-width: 769px) {
  .sidebar-backdrop { display: none; }
}

body.no-scroll { overflow: hidden; }

.preview-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}
.preview-item:hover .preview-actions,
.preview-item:focus-within .preview-actions {
  opacity: 1;
}
.preview-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,.7);
  color: #fff;
  border: none;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.preview-btn:hover { background: rgba(0,0,0,.85); }
.preview-remove {
  position: static;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(239,68,68,.9);
  color: #fff;
  border: none;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 1;
}
.preview-remove:hover { background: var(--danger); }

@media (hover: none) {
  .preview-actions { opacity: 1; }
  .tbl-thumb { width: 64px; height: 48px; }
}

@media (pointer: coarse) {
  .form-field input,
  .form-field select,
  .form-field textarea,
  .search-input,
  .filter-select { font-size: 16px; }
  .btn-sm { min-height: 32px; }
  .data-table .btn-group .btn { min-height: 34px; }
}

@media (max-width: 768px) {
  .form-field input,
  .form-field select,
  .form-field textarea,
  .search-input,
  .filter-select {
    font-size: 16px;
    padding: 12px;
  }
  .btn { padding: 10px 16px; min-height: 40px; }
  .btn-sm { padding: 8px 12px; min-height: 36px; font-size: .8rem; }
  .btn-group { gap: 8px; }
  .data-table .btn-group .btn { flex: 1 1 calc(50% - 4px); }
  .upload-zone { padding: 28px 16px; }
  .toolbar .btn { width: 100%; }
  .topbar { padding: 0 16px; }
  .card { padding: 18px; }
  .preview-card-photo { height: 220px; }
  .preview-details-grid { grid-template-columns: 1fr; }
  .images-preview { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

@media (max-width: 480px) {
  .btn-group { flex-direction: column; align-items: stretch; }
  .data-table .btn-group .btn { flex: 1 1 100%; }
  .modal-body { max-height: calc(100vh - 120px); }
  .lightbox-close { top: 12px; right: 12px; }
}

:root {
  --accent: #2a5cff;
  --accent-hover: #1e48d9;
  --bg: #f3f4f8;
  --ring: rgba(42,92,255,.32);
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.05);
  --shadow-md: 0 6px 22px rgba(16,24,40,.07);
  --shadow-lg: 0 18px 44px rgba(16,24,40,.16);
  --radius: 9px;
  --radius-lg: 14px;
}

body {
  background:
    radial-gradient(1100px 560px at 100% -12%, #e9edf8 0%, rgba(233,237,248,0) 55%),
    var(--bg);
}

.form-field label {
  text-transform: none;
  letter-spacing: 0;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.card-title {
  text-transform: none;
  letter-spacing: -.01em;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}
.data-table th {
  text-transform: none;
  letter-spacing: 0;
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.stat-label { text-transform: none; }
.topbar-title { letter-spacing: -.01em; }

.card, .stat-card, .preview-card {
  border: 1px solid rgba(16,24,40,.06);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
}
.card { padding: 26px; }

.stats-grid { gap: 18px; }
.stat-card {
  text-align: left;
  padding: 22px 22px 20px 26px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
}
.stat-card.accent::before { background: var(--accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-number { font-size: 2.1rem; letter-spacing: -.02em; }

.sidebar { box-shadow: 2px 0 26px rgba(16,24,40,.08); }
.sidebar-header { padding: 20px; }
.sidebar-link.active { background: rgba(42,92,255,.18); }
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.sidebar-link { position: relative; }

.topbar { box-shadow: 0 1px 0 rgba(16,24,40,.05); }

.btn { border-radius: var(--radius); }
.btn-primary { box-shadow: 0 1px 2px rgba(16,24,40,.16); }
.btn-primary:hover { box-shadow: 0 5px 16px rgba(16,24,40,.2); }
.btn-accent { box-shadow: 0 2px 10px rgba(42,92,255,.26); }

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.search-input:focus,
.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

.badge { letter-spacing: .04em; }
.badge-rent { background: #eef1f8; color: #33415c; }

.data-table tr:hover td { background: #f7f8fb; }

.upload-zone { background: #fbfbfd; }
.upload-zone-icon { font-size: 0; line-height: 0; margin-bottom: 12px; }
.upload-zone-icon svg { width: 40px; height: 40px; stroke: var(--text-muted); display: inline-block; }

.status-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  background: var(--text-muted);
  vertical-align: middle;
}
.status-dot.ok { background: var(--success); box-shadow: 0 0 0 3px rgba(34,197,94,.16); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.16); }

.cat-chart { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.cat-bar-row {
  display: grid;
  grid-template-columns: 108px 1fr 40px;
  align-items: center;
  gap: 12px;
}
.cat-bar-label { font-size: .82rem; color: var(--text); font-weight: 500; }
.cat-bar-track { height: 10px; background: #e9ebf1; border-radius: 50px; overflow: hidden; }
.cat-bar-fill {
  display: block;
  height: 100%;
  border-radius: 50px;
  min-width: 6px;
  background: linear-gradient(90deg, var(--accent), #5f82ff);
  transition: width .6s cubic-bezier(.22,.61,.36,1);
}
.cat-bar-value { font-size: .82rem; font-weight: 700; color: var(--text-muted); text-align: right; }

a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.sidebar-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sidebar-link:focus-visible { outline-offset: -2px; }

.login-screen {
  background:
    radial-gradient(1000px 520px at 18% 0%, #1f2534 0%, rgba(31,37,52,0) 60%),
    radial-gradient(820px 520px at 100% 100%, #14203a 0%, rgba(19,30,56,0) 55%),
    #0f1116;
}
.login-card {
  padding: 44px 40px;
  box-shadow: 0 30px 70px rgba(0,0,0,.45);
  border: 1px solid rgba(16,24,40,.05);
}
.login-logo { font-size: 1.5rem; }
.btn-login { box-shadow: 0 2px 10px rgba(16,24,40,.2); }

@media (max-width: 768px) {
  .cat-bar-row { grid-template-columns: 92px 1fr 34px; }
}
