* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;

  --background: #f4f7fb;
  --surface: #ffffff;

  --text: #172033;
  --text-muted: #64748b;

  --border: #e2e8f0;

  --success: #16a34a;
  --success-bg: #dcfce7;

  --warning: #d97706;
  --warning-bg: #fef3c7;

  --danger: #dc2626;
  --danger-bg: #fee2e2;

  --info: #2563eb;
  --info-bg: #dbeafe;

  --gray-bg: #f1f5f9;

  --sidebar-width: 250px;

  --radius: 14px;

  --shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background: var(--background);
  color: var(--text);

  min-height: 100vh;
}

/* ========================= */
/* SIDEBAR TOGGLE */
/* ========================= */

.sidebar-toggle {
  position: fixed;
  opacity: 0;
  pointer-events: none;
}

/* ========================= */
/* SIDEBAR */
/* ========================= */

.sidebar {
  position: fixed;

  top: 0;
  left: 0;
  bottom: 0;

  width: var(--sidebar-width);

  background: #ffffff;

  border-right: 1px solid var(--border);

  padding: 24px 18px;

  display: flex;
  flex-direction: column;

  z-index: 1500;

  transition: transform 0.28s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;

  margin-bottom: 40px;
}

.brand-icon {
  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 12px;

  font-size: 24px;

  background: #eff6ff;
}

.brand h2 {
  font-size: 19px;
}

.brand span {
  display: block;
  margin-top: 2px;

  font-size: 12px;

  color: var(--text-muted);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;

  gap: 8px;
}

.menu-item {
  text-decoration: none;

  display: flex;
  align-items: center;

  gap: 12px;

  padding: 12px 14px;

  border-radius: 10px;

  color: var(--text-muted);

  font-weight: 600;
}

.menu-item:hover,
.menu-item.active {
  color: var(--primary);

  background: #eff6ff;
}

.sidebar-footer {
  margin-top: auto;

  padding: 12px;

  text-align: center;

  font-size: 12px;

  color: var(--text-muted);
}

.sidebar-close {
  display: none;
}

.sidebar-overlay {
  display: none;
}

/* ========================= */
/* MAIN */
/* ========================= */

.main {
  margin-left: var(--sidebar-width);

  padding: 32px;
}

.topbar {
  display: flex;

  justify-content: space-between;
  align-items: center;

  gap: 20px;

  margin-bottom: 28px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.mobile-menu-btn {
  display: none;
}

.topbar h1 {
  font-size: 28px;

  margin-bottom: 5px;
}

.topbar p {
  color: var(--text-muted);

  font-size: 14px;
}

/* ========================= */
/* BUTTON */
/* ========================= */

.btn {
  border: none;

  border-radius: 10px;

  padding: 11px 18px;

  font-size: 14px;

  font-weight: 600;

  cursor: pointer;

  transition: 0.2s;
}

.btn:disabled {
  opacity: 0.6;

  cursor: not-allowed;
}

.btn-primary {
  color: white;

  background: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #f1f5f9;

  color: var(--text);
}

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

/* ========================= */
/* DASHBOARD */
/* ========================= */

.stats-grid {
  display: grid;

  grid-template-columns: repeat(4, minmax(0, 1fr));

  gap: 18px;

  margin-bottom: 24px;
}

.stat-card {
  display: flex;

  gap: 15px;

  align-items: center;

  background: white;

  padding: 20px;

  border: 1px solid var(--border);

  border-radius: var(--radius);

  box-shadow: var(--shadow);
}

.stat-icon {
  width: 50px;
  height: 50px;

  display: flex;

  align-items: center;
  justify-content: center;

  flex-shrink: 0;

  border-radius: 12px;

  background: #eff6ff;

  font-size: 24px;
}

.stat-card span {
  font-size: 13px;

  color: var(--text-muted);
}

.stat-card h2 {
  margin-top: 4px;

  font-size: 25px;
}

/* ========================= */
/* CONTENT */
/* ========================= */

.content-card {
  background: white;

  border: 1px solid var(--border);

  border-radius: var(--radius);

  box-shadow: var(--shadow);

  padding: 22px;
}

.content-header {
  display: flex;

  align-items: center;
  justify-content: space-between;

  margin-bottom: 20px;
}

.content-header h2 {
  font-size: 19px;

  margin-bottom: 4px;
}

.content-header p {
  color: var(--text-muted);

  font-size: 13px;
}

/* ========================= */
/* TOOLBAR */
/* ========================= */

.toolbar {
  display: flex;

  justify-content: space-between;

  gap: 12px;

  margin-bottom: 20px;
}

.search-box {
  flex: 1;

  max-width: 500px;

  display: flex;
  align-items: center;

  gap: 8px;

  padding: 0 14px;

  border: 1px solid var(--border);

  border-radius: 10px;

  background: white;
}

.search-box input {
  width: 100%;

  padding: 11px 0;

  border: none;
  outline: none;

  font-size: 14px;

  background: transparent;
}

.toolbar select {
  min-width: 190px;

  border: 1px solid var(--border);

  border-radius: 10px;

  padding: 10px 13px;

  color: var(--text);

  background: white;

  outline: none;
}

/* ========================= */
/* TABLE */
/* ========================= */

.table-wrapper {
  width: 100%;

  overflow-x: auto;
}

table {
  width: 100%;

  border-collapse: collapse;

  min-width: 1500px;
}

thead {
  background: #f8fafc;
}

th {
  text-align: left;

  color: #475569;

  font-size: 12px;

  text-transform: uppercase;

  letter-spacing: 0.03em;

  padding: 13px 12px;

  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 12px;

  font-size: 14px;

  border-bottom: 1px solid #edf2f7;

  vertical-align: middle;
}

tbody tr:hover {
  background: #fafcff;
}

/* ========================= */
/* BADGE */
/* ========================= */

.badge {
  display: inline-flex;

  align-items: center;

  border-radius: 999px;

  padding: 5px 10px;

  font-size: 12px;

  font-weight: 600;
}

.badge-baik {
  color: var(--success);

  background: var(--success-bg);
}

.badge-rusak-ringan {
  color: var(--warning);

  background: var(--warning-bg);
}

.badge-rusak-berat {
  color: var(--danger);

  background: var(--danger-bg);
}

.badge-perbaikan {
  color: var(--info);

  background: var(--info-bg);
}

.badge-tidak-digunakan {
  color: #64748b;

  background: var(--gray-bg);
}

/* ========================= */
/* ACTION */
/* ========================= */

.action-group {
  display: flex;

  gap: 6px;
}

.action-button {
  border: 1px solid var(--border);

  background: white;

  border-radius: 8px;

  padding: 7px 9px;

  cursor: pointer;

  font-size: 13px;
}

.action-button:hover {
  background: #f8fafc;
}

.action-edit {
  color: var(--primary);
}

.action-delete {
  color: var(--danger);
}

/* ========================= */
/* LOADING / EMPTY */
/* ========================= */

.loading {
  padding: 30px;

  text-align: center;

  color: var(--text-muted);
}

.empty-state {
  text-align: center;

  padding: 50px 20px;

  color: var(--text-muted);
}

.empty-state div {
  font-size: 40px;

  margin-bottom: 10px;
}

.empty-state h3 {
  color: var(--text);

  margin-bottom: 6px;
}

.hidden {
  display: none !important;
}

/* ========================= */
/* MODAL */
/* ========================= */

.modal {
  position: fixed;

  inset: 0;

  z-index: 2000;

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 20px;
}

.modal-overlay {
  position: absolute;

  inset: 0;

  background: rgba(15, 23, 42, 0.55);
}

.modal-content {
  position: relative;

  width: 100%;

  max-width: 540px;

  max-height: 92vh;

  overflow-y: auto;

  background: white;

  border-radius: 16px;

  padding: 24px;

  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.modal-header {
  display: flex;

  align-items: flex-start;
  justify-content: space-between;

  margin-bottom: 22px;
}

.modal-header h2 {
  font-size: 21px;

  margin-bottom: 4px;
}

.modal-header p {
  font-size: 13px;

  color: var(--text-muted);
}

.modal-close {
  width: 36px;
  height: 36px;

  border: none;

  background: #f1f5f9;

  border-radius: 8px;

  cursor: pointer;

  font-size: 22px;
}

/* ========================= */
/* FORM */
/* ========================= */

.form-group {
  display: flex;

  flex-direction: column;

  gap: 7px;

  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;

  font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;

  padding: 11px 12px;

  border: 1px solid var(--border);

  border-radius: 9px;

  outline: none;

  font: inherit;

  font-size: 14px;

  background: white;
}

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

  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.form-row {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 14px;
}

.modal-actions {
  display: flex;

  justify-content: flex-end;

  gap: 10px;

  margin-top: 22px;
}

/* ========================= */
/* TOAST */
/* ========================= */

.toast {
  position: fixed;

  right: 25px;
  bottom: 25px;

  z-index: 2500;

  max-width: 350px;

  padding: 13px 18px;

  border-radius: 10px;

  background: #172033;

  color: white;

  box-shadow: var(--shadow);

  transform: translateY(100px);

  opacity: 0;

  pointer-events: none;

  transition: 0.3s;
}

.toast.show {
  transform: translateY(0);

  opacity: 1;
}

.toast.success {
  background: #15803d;
}

.toast.error {
  background: #b91c1c;
}

/* ========================= */
/* MOBILE CARD */
/* ========================= */

.mobile-list {
  display: none;

  flex-direction: column;

  gap: 12px;
}

.mobile-card {
  border: 1px solid var(--border);

  border-radius: 12px;

  padding: 16px;
}

.mobile-card-header {
  display: flex;

  justify-content: space-between;

  gap: 10px;

  margin-bottom: 14px;
}

.mobile-card-title {
  font-weight: 700;

  font-size: 15px;
}

.mobile-card-serial {
  font-size: 12px;

  margin-top: 3px;

  color: var(--text-muted);
}

.mobile-info {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 12px;

  margin-bottom: 15px;
}

.mobile-info span {
  display: block;

  font-size: 11px;

  color: var(--text-muted);

  margin-bottom: 3px;
}

.mobile-actions {
  display: flex;

  gap: 8px;
}

.mobile-actions button {
  flex: 1;
}

/* ========================= */
/* TABLET */
/* ========================= */

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ========================= */
/* MOBILE */
/* ========================= */

@media (max-width: 768px) {
  .sidebar {
    width: 280px;

    transform: translateX(-100%);

    box-shadow: 12px 0 35px rgba(15, 23, 42, 0.15);
  }

  .sidebar-close {
    position: absolute;

    top: 18px;
    right: 18px;

    width: 36px;
    height: 36px;

    display: flex;

    align-items: center;
    justify-content: center;

    border: none;

    border-radius: 9px;

    background: #f1f5f9;

    color: var(--text);

    cursor: pointer;

    font-size: 24px;

    line-height: 1;

    z-index: 2;
  }

  .sidebar-overlay {
    display: block;

    position: fixed;

    inset: 0;

    z-index: 1400;

    background: rgba(15, 23, 42, 0.45);

    opacity: 0;

    visibility: hidden;

    transition:
      opacity 0.28s ease,
      visibility 0.28s ease;

    cursor: pointer;
  }

  .sidebar-toggle:checked ~ .sidebar {
    transform: translateX(0);
  }

  .sidebar-toggle:checked ~ .sidebar-overlay {
    opacity: 1;

    visibility: visible;
  }

  .main {
    margin-left: 0;

    padding: 20px 14px;
  }

  .mobile-menu-btn {
    width: 42px;
    height: 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border: 1px solid var(--border);

    border-radius: 10px;

    background: #ffffff;

    color: var(--text);

    cursor: pointer;

    font-size: 22px;

    line-height: 1;
  }

  .mobile-menu-btn:hover {
    background: #f8fafc;
  }

  .topbar {
    flex-direction: column;

    align-items: stretch;

    gap: 16px;
  }

  .topbar-left {
    width: 100%;

    align-items: flex-start;
  }

  .topbar-left > div {
    flex: 1;

    min-width: 0;
  }

  .topbar h1 {
    font-size: 23px;

    line-height: 1.2;
  }

  .topbar p {
    margin-top: 5px;

    line-height: 1.4;
  }

  .topbar > .btn {
    width: 100%;
  }

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

    gap: 10px;
  }

  .stat-card {
    padding: 14px;

    gap: 10px;

    min-width: 0;
  }

  .stat-icon {
    width: 42px;
    height: 42px;

    font-size: 19px;
  }

  .stat-card h2 {
    font-size: 21px;
  }

  .toolbar {
    flex-direction: column;
  }

  .search-box {
    max-width: none;

    width: 100%;
  }

  .toolbar select {
    width: 100%;
  }

  .table-wrapper {
    display: none;
  }

  .mobile-list {
    display: flex;
  }

  .content-card {
    padding: 15px;
  }

  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;

    max-width: none;
  }
}

/* ========================= */
/* SMALL MOBILE */
/* ========================= */

@media (max-width: 480px) {
  .sidebar {
    width: min(280px, 85vw);
  }

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

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

  .modal {
    padding: 10px;
  }

  .modal-content {
    padding: 18px;
  }

  .mobile-info {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===================================================== */
/* UPDATE INVENTARIS v40 - KOLOM BARU + DOWNLOAD EXCEL */
/* ===================================================== */

.content-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-download {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  white-space: nowrap;
}

.btn-download:hover {
  background: #bbf7d0;
}

.filter-group {
  display: flex;
  gap: 10px;
}

.form-help {
  margin-top: -2px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.4;
}

table {
  min-width: 1360px;
}

.mobile-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 15px;
}

.mobile-meta-grid span,
.mobile-description span {
  display: block;
  margin-bottom: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.mobile-meta-grid strong {
  font-size: 13px;
}

.mobile-description {
  margin-bottom: 15px;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .content-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .content-header .btn-download {
    width: 100%;
  }

  .filter-group {
    width: 100%;
    flex-direction: column;
  }

  .filter-group select {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .mobile-meta-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* =====================================================
   V50 - CABANG + LOKASI ALAT
===================================================== */

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.table-wrapper table {
  min-width: 1450px;
}

@media (max-width: 1100px) {
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    max-width: none;
  }

  .filter-group {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .filter-group {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .filter-group select,
  .toolbar select {
    width: 100%;
    min-width: 0;
  }
}
