:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #eef4f8;
  --ink: #172126;
  --muted: #62727c;
  --line: #d9e2e7;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --blue: #2563eb;
  --shadow: 0 18px 45px rgba(21, 35, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  max-width: min(320px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: 12px;
  background: #0f766e;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 18px 40px rgba(15, 118, 110, 0.18);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
  pointer-events: none;
}

.toast-container.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-container.error {
  background: #b91c1c;
}

.toast-container.success {
  background: #0f766e;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: url("./bg.png") center/cover no-repeat;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card label {
  display: grid;
  gap: 7px;
  color: #34444c;
  font-size: 13px;
  font-weight: 800;
}

.login-brand {
  margin-bottom: 4px;
  color: var(--ink);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #102326;
  color: #f8fbfb;
}

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

.brand-logo-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff;
  padding: 4px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-footer {
  color: #b9c8ca;
  font-size: 13px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #dce7e8;
  padding: 0 12px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  line-height: 1.5;
}

.main-content {
  min-width: 0;
  padding: 28px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

.topbar-actions,
.row-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
  padding: 0 15px;
}

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--ink);
  padding: 0 15px;
}

.icon-button {
  width: 40px;
  height: 40px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.icon-button:hover {
  border-color: #a9bac2;
}

.icon-button.danger {
  color: var(--red);
}

.text-button {
  background: transparent;
  color: var(--primary);
  padding: 0;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 20px;
  border-top: 4px solid var(--primary);
}

.metric-card strong {
  display: block;
  margin: 10px 0 4px;
  font-size: 34px;
}

.metric-card small,
.metric-label {
  color: var(--muted);
  font-weight: 600;
}

.accent-green {
  border-top-color: var(--green);
}

.accent-amber {
  border-top-color: var(--amber);
}

.accent-red {
  border-top-color: var(--red);
}

.content-grid,
.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.compact-list,
.status-breakdown,
.report-list {
  display: grid;
  gap: 10px;
}

.list-item,
.report-item,
.status-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.list-item {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.list-item span,
.report-item span {
  color: var(--muted);
  font-size: 13px;
}

.status-item {
  grid-template-columns: auto 1fr auto;
  align-items: center;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--primary);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 170px;
  gap: 12px;
  margin-bottom: 14px;
}

/* Make search bar length match table width (responsive) */
.toolbar .search-box {
  min-width: 0;
  width: 100%;
}

.toolbar {
  width: 100%;
}


.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search-box input,
select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.search-box input {
  border: 0;
  min-height: 40px;
}

select,
input {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  padding: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.table-wrap {
  position: relative;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
}

.user-table {
  min-width: 720px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #eef4f8;
  color: #44545c;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

td strong,
td span {
  display: block;
}

td span {
  color: var(--muted);
  font-size: 13px;
}

.asset-photo-trigger {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.asset-photo-stack {
  display: flex;
  align-items: center;
  gap: 4px;
}

.asset-thumb {
  display: grid;
  place-items: center;
  width: 52px;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f8;
  color: var(--muted);
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-thumb.placeholder svg {
  width: 18px;
  height: 18px;
}

.asset-photo-count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 999px;
  background: #0f172a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.photo-gallery-content {
  padding: 0 22px 22px;
}

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

.photo-gallery-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.photo-gallery-item a {
  display: block;
}

.photo-gallery-item img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.photo-gallery-empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 800;
}

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

.badge.Stok {
  background: #e0f2fe;
  color: #075985;
}

.badge.Maintenance {
  background: #fef3c7;
  color: #92400e;
}

.badge.Rusak,
.badge.Dipensiunkan {
  background: #fee2e2;
  color: #991b1b;
}

.empty-state {
  display: none;
  place-items: center;
  gap: 8px;
  padding: 44px;
  color: var(--muted);
  text-align: center;
}

.empty-state.visible {
  display: grid;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.pagination-meta,
.pagination-meta label,
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pagination-meta label {
  color: #34444c;
}

.pagination-meta select {
  width: 78px;
  min-height: 34px;
  padding: 0 8px;
}

.page-button {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.page-button.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

dialog {
  position: relative;
  width: min(760px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.22);
}

dialog::backdrop {
  background: rgba(12, 24, 28, 0.45);
}

.form-loading-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  align-items: center;
  justify-content: center;
  text-align: center;
}

.form-loading-overlay.visible {
  display: flex;
}

.form-loading-spinner {
  width: 52px;
  height: 52px;
  border: 5px solid rgba(15, 118, 110, 0.18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#assetForm,
#userForm {
  position: relative;
  padding: 22px;
}

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

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

.form-grid label {
  display: grid;
  gap: 7px;
  color: #34444c;
  font-size: 13px;
  font-weight: 800;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

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

.modal-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    white-space: nowrap;
  }

  .sidebar-footer {
    display: none;
  }

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

  .content-grid,
  .report-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 18px;
  }

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

  .topbar-actions {
    display: grid;
    grid-template-columns: 40px 40px 1fr 40px;
  }

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

  .pagination-bar,
  .pagination-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls {
    flex-wrap: wrap;
  }
}

.nav-item,
.primary-button,
.secondary-button,
.icon-button,
.text-button,
.page-button {
  text-decoration: none;
}

.topbar-actions form,
.row-actions form,
.inline-upload {
  margin: 0;
}

.inline-upload {
  display: inline-flex;
}

.toast-container.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
