* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f7fb;
  color: #1f2937;
}

button,
input,
select {
  font: inherit;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.sidebar {
  background: #071537;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 32px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-logo-badge-only {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

.brand-text h1 {
  margin: 0;
  line-height: 1.1;
}

.brand-text p {
  margin: 4px 0 0;
  opacity: 0.85;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 16px 18px;
  border-radius: 16px;
  cursor: pointer;
  transition: 0.2s ease;
  font-size: 18px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  background: #2d56d6;
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.sidebar-footer {
  margin-top: 10px;
  padding-top: 0;
}

.logout-btn,
.primary-btn,
.secondary-btn,
.danger-btn,
.quick-btn {
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 700;
}

.logout-btn {
  width: 100%;
  background: #ef2323;
  color: #fff;
  font-size: 16px;
}

.primary-btn,
.quick-btn {
  background: #2d56d6;
  color: #fff;
}

.secondary-btn {
  background: #dbe2ee;
  color: #10213f;
}

.danger-btn {
  background: #dc2626;
  color: #fff;
}

.main-area {
  padding: 30px 24px;
}

.topbar {
  background: #fff;
  border-radius: 24px;
  padding: 26px 32px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar h2 {
  margin: 0 0 8px;
  font-size: 42px;
  line-height: 1.1;
}

.topbar p {
  margin: 0;
  color: #64748b;
  font-size: 18px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: #dbeafe;
  color: #2563eb;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.4px;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
}

.hero-card,
.panel,
.stat-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.hero-card {
  padding: 30px 34px;
  margin-bottom: 28px;
}

.hero-card h3 {
  margin: 0 0 16px;
  font-size: 44px;
}

.hero-card p {
  margin: 0;
  color: #475569;
  line-height: 1.65;
  font-size: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 24px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 26px 28px;
}

.stat-label {
  display: block;
  color: #64748b;
  font-size: 18px;
  margin-bottom: 18px;
}

.stat-value {
  font-size: 54px;
  font-weight: 800;
  line-height: 1;
}

.panel-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
}

.panel-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.panel-grid-2-equal {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-top: 24px;
}

.panel {
  padding: 30px;
}

.panel h3 {
  margin: 0 0 16px;
  font-size: 28px;
}

.panel p {
  margin: 0 0 18px;
  color: #475569;
  font-size: 17px;
  line-height: 1.6;
}

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

.panel-head h3 {
  margin: 0;
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
}

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

.quick-btn {
  font-size: 16px;
}

.placeholder-box {
  border: 2px dashed #cbd5e1;
  border-radius: 18px;
  padding: 34px;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  font-size: 18px;
}

.mini-stats-list {
  display: grid;
  gap: 14px;
}

.mini-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #d8e0eb;
  border-radius: 18px;
}

.mini-stat-row span {
  color: #475569;
  font-size: 16px;
}

.mini-stat-row strong {
  color: #0f172a;
  font-size: 18px;
}

.stack-list {
  display: grid;
  gap: 14px;
}

.stack-item {
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  background: #f8fafc;
  padding: 16px 18px;
}

.stack-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.stack-item-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.stack-item-meta {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.5;
}

.stack-item-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.soft-badge.success {
  background: #dcfce7;
  color: #166534;
}

.soft-badge.warn {
  background: #fef3c7;
  color: #92400e;
}

.soft-badge.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.soft-badge.info {
  background: #e8f1ff;
  color: #1d4ed8;
}

.soft-badge.purple {
  background: #f3e8ff;
  color: #7c3aed;
}

.empty-state {
  border: 2px dashed #cbd5e1;
  border-radius: 18px;
  padding: 28px;
  text-align: center;
  color: #64748b;
  background: #f8fafc;
  font-size: 18px;
}

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

.filters-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.filters-grid input,
.filters-grid select,
.form-group input,
.form-group select {
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  outline: none;
}

.users-table-wrap {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

.spiu-table {
  min-width: 920px;
}

.users-table th,
.users-table td {
  padding: 14px 14px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: middle;
}

.users-table th {
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 14px;
}

.users-table td {
  background: #fff;
  font-size: 14px;
}

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

.table-btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.table-btn.view {
  background: #dbeafe;
  color: #1d4ed8;
}

.table-btn.edit {
  background: #dcfce7;
  color: #166534;
}

.table-btn.disable {
  background: #fee2e2;
  color: #b91c1c;
}

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

.status-pill.active {
  background: #dcfce7;
  color: #166534;
}

.status-pill.disabled {
  background: #fee2e2;
  color: #b91c1c;
}

.status-pill.pending {
  background: #fef3c7;
  color: #92400e;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: 100%;
  max-width: 860px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.modal-card-sm {
  max-width: 520px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
}

.icon-close {
  border: 0;
  background: transparent;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  color: #475569;
}

.modal-body {
  padding: 22px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-top: 1px solid #e5e7eb;
}

.confirm-message {
  margin: 0 0 18px;
  color: #475569;
  line-height: 1.6;
}

.charts-grid {
  margin-top: 18px;
}

.chart-wrap {
  position: relative;
  height: 320px;
  width: 100%;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 1200px) {

  .panel-grid-3,
  .panel-grid-2-equal {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 1100px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .main-area {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .users-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    flex-direction: column;
  }
}

/* =========================
   DOCUMENTS MODULE v1.1
   ========================= */

.documents-shell {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.documents-toolbar-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.documents-toolbar {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 16px;
  align-items: end;
}

.documents-filter-group,
.documents-path-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.documents-filter-group label,
.documents-path-group label {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#docsSpiuFilter {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(120, 120, 120, 0.25);
  padding: 0 12px;
  background: #fff;
  font: inherit;
}

.documents-breadcrumb {
  min-height: 42px;
  border: 1px solid rgba(120, 120, 120, 0.2);
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
}

.documents-breadcrumb button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
}

.documents-breadcrumb button:hover {
  background: rgba(15, 23, 42, 0.06);
}

.documents-breadcrumb .crumb-sep {
  opacity: 0.45;
  font-weight: 700;
}

.documents-meta-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.documents-meta-item {
  background: #f8fafc;
  border: 1px solid rgba(120, 120, 120, 0.16);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.documents-meta-item .meta-label {
  font-size: 12px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.documents-status {
  min-height: 20px;
  font-size: 14px;
  color: #334155;
}

.documents-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(120, 120, 120, 0.16);
  border-radius: 16px;
  background: #fff;
}

.documents-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.documents-table thead th {
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(120, 120, 120, 0.16);
  white-space: nowrap;
}

.documents-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(120, 120, 120, 0.10);
  vertical-align: middle;
}

.documents-table tbody tr:hover {
  background: #fcfcfd;
}

.documents-empty {
  text-align: center;
  color: #64748b;
  padding: 30px 16px !important;
}

.doc-type-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: #eef2ff;
}

.doc-type-badge.folder {
  background: #fef3c7;
}

.doc-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doc-name-main {
  font-weight: 700;
  color: #0f172a;
}

.doc-name-sub {
  font-size: 12px;
  color: #64748b;
}

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

.doc-action-btn {
  border: 1px solid rgba(120, 120, 120, 0.2);
  background: #fff;
  border-radius: 10px;
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.doc-action-btn:hover {
  background: #f8fafc;
}

.doc-action-btn.primary {
  background: #0f766e;
  color: #fff;
  border-color: #0f766e;
}

.doc-action-btn.primary:hover {
  filter: brightness(0.97);
}

.doc-folder-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.doc-folder-btn:hover .doc-name-main {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .documents-toolbar {
    grid-template-columns: 1fr;
  }

  .documents-meta-bar {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

/* =========================
   Documents Module v1.1
   Append this to the end of your current admin.css
   ========================= */

.documents-toolbar {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 14px;
  align-items: end;
  margin: 18px 0 16px;
}

.documents-filter-group,
.documents-path-group,
.documents-actions-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.documents-filter-group label,
.documents-path-group label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.documents-filter-group select {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d7deea;
  border-radius: 12px;
  background: #fff;
  font: inherit;
}

.documents-breadcrumb {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #d7deea;
  border-radius: 12px;
  background: #f8fafc;
}

.crumb-btn {
  border: 0;
  background: transparent;
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: #0f172a;
}

.crumb-btn:hover {
  background: #e2e8f0;
}

.crumb-btn.active {
  background: #dbeafe;
  color: #1d4ed8;
}

.crumb-sep {
  color: #94a3b8;
  font-weight: 700;
}

.documents-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.stat-card.compact {
  min-height: auto;
}

.documents-status {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 600;
}

.documents-status.error {
  background: #fef2f2;
  color: #b91c1c;
}

.documents-table-wrap {
  margin-top: 8px;
}

.doc-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 16px;
}

.doc-type-badge.folder {
  background: #fef3c7;
}

.doc-type-badge.file {
  background: #dbeafe;
}

.doc-folder-btn {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: #2563eb;
  cursor: pointer;
}

.doc-folder-btn:hover {
  text-decoration: underline;
}

.doc-name-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.doc-name-cell strong {
  color: #0f172a;
}

.doc-name-cell span {
  font-size: 12px;
  color: #64748b;
  word-break: break-all;
}

@media (max-width: 980px) {
  .documents-toolbar {
    grid-template-columns: 1fr;
  }

  .documents-summary-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

.documents-search-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.documents-search-group label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.documents-search-group input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #d7deea;
  border-radius: 12px;
  background: #fff;
  font: inherit;
}

.documents-actions-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.documents-actions-group .primary-btn,
.documents-actions-group .secondary-btn {
  min-height: 42px;
  padding: 0 16px;
}

.documents-toolbar {
  grid-template-columns: 240px 1fr 260px auto;
}

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

.doc-actions .table-btn {
  padding: 8px 10px;
}

.doc-actions .table-btn.delete {
  background: #fee2e2;
  color: #b91c1c;
}

.doc-row-muted {
  font-size: 12px;
  color: #64748b;
  word-break: break-all;
}

@media (max-width: 1280px) {
  .documents-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .documents-actions-group {
    grid-column: 1 / -1;
  }
}


.mini-summary-note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}

.mini-summary-note.success {
  background: #eaf7ee;
  color: #1f6b3a;
}

.mini-summary-note.warning {
  background: #fff4db;
  color: #8a5a00;
}