* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 18px/1.5 -apple-system, system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  color: #1a1a1a;
  background: #f8f9fa;
}
button, input, select, textarea { font: inherit; }
a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid #e8e8e8;
}
.brand h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: #1a1a1a; }
.sync-badge { display: block; margin-top: 8px; font-size: 13px; color: #666; font-weight: 500; }
.sync-badge.online { color: #0d7a3e; }

.nav-menu { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav-section-title {
  font-size: 11px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 16px 12px 8px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  color: #333;
  text-decoration: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  min-height: 44px;
  transition: background 0.15s;
}
.nav-item:hover { background: #f5f5f5; }
.nav-item.active { background: #e8f0fe; color: #1a73e8; font-weight: 600; }
.count-badge {
  margin-left: auto;
  background: #f0f0f0;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
}
.count-badge.warn { background: #fff3cd; color: #856404; }
.sidebar-footer {
  border-top: 1px solid #e8e8e8;
  padding: 16px 20px;
  font-size: 13px;
  color: #666;
}
.role-name { font-weight: 600; font-size: 14px; color: #333; margin-bottom: 4px; }

.main-wrapper { flex: 1; min-width: 0; background: #f8f9fa; }

/* Login Screen Styles */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: #f8f9fa;
}
.login-box {
  background: #fff;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  width: 100%;
  max-width: 360px;
  border: 1px solid #e5e5e5;
  text-align: center;
}
.login-box .field {
  text-align: left;
}

.mobile-header { display: none; }
.main { padding: 32px 40px 60px; max-width: 1400px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: #1a1a1a; }
.sub { color: #666; font-size: 15px; margin-top: 6px; font-weight: 400; }
.top-actions, .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.card {
  background: #fff;
  border: 1px solid #e5e5e5;
  padding: 24px;
  margin-bottom: 20px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.card-title { font-weight: 600; margin-bottom: 18px; font-size: 17px; color: #1a1a1a; }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

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

.stat-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  padding: 20px 22px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
.stat-val { font-size: 30px; font-weight: 600; color: #1a1a1a; letter-spacing: -0.02em; }
.stat-lbl { color: #666; font-size: 14px; margin-top: 6px; font-weight: 500; }

.field { margin-bottom: 16px; }
label {
  display: block;
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  border: 1px solid #d0d0d0;
  background: #fff;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 15px;
  min-height: 44px;
  transition: border 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.suggest { position: relative; }
.suggest-list {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 30;
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.suggest-list.open { display: block; }
.suggest-list button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #f0f0f0;
  background: #fff;
  padding: 12px 14px;
  cursor: pointer;
  font-size: 15px;
  min-height: 44px;
  transition: background 0.1s;
}
.suggest-list button:hover,
.suggest-list button.active { background: #f5f8ff; }
.search { min-width: 260px; font-size: 15px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #333;
  text-decoration: none;
  padding: 11px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  transition: all 0.15s;
}
.btn:hover { background: #f8f8f8; border-color: #bbb; }
.btn-primary { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; border-color: #1557b0; }
.btn-success { background: #0d7a3e; border-color: #0d7a3e; color: #fff; }
.btn-success:hover { background: #0a6030; border-color: #0a6030; }
.btn-danger { background: #fff; border-color: #dc3545; color: #dc3545; }
.btn-danger:hover { background: #fff5f5; }
.btn-sm { padding: 8px 14px; font-size: 14px; min-height: 36px; }

table { width: 100%; border-collapse: collapse; background: #fff; font-size: 15px; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
th { background: #fafafa; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; color: #666; }
tr.clickable { cursor: pointer; transition: background 0.1s; }
tr.clickable:hover { background: #f9fbfd; }
.table-container { overflow-x: auto; border: 1px solid #e5e5e5; border-radius: 8px; }

.badge {
  display: inline-block;
  border: 1px solid transparent;
  background: #f0f0f0;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
}
.st-Received { background: #f5f5f5; color: #666; }
.st-In-repair { background: #e8f0fe; color: #1967d2; border-color: #d2e3fc; }
.st-Hold { background: #fef7e0; color: #b06000; border-color: #fde293; }
.st-Complete { background: #e6f4ea; color: #137333; border-color: #ceead6; }
.st-Return { background: #fce8e6; color: #c5221f; border-color: #f7c9c7; }

.checklist-group { display: flex; flex-wrap: wrap; gap: 10px; }
.check-chip {
  border: 1px solid #d0d0d0;
  background: #fff;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  min-height: 40px;
  transition: all 0.15s;
}
.check-chip:hover { border-color: #bbb; background: #fafafa; }
.check-chip.checked { background: #1a73e8; color: #fff; border-color: #1a73e8; }

.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-tab {
  border: 1px solid #d0d0d0;
  background: #fff;
  padding: 10px 16px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  min-height: 40px;
  transition: all 0.15s;
}
.filter-tab:hover { background: #f8f8f8; }
.filter-tab.active { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }

.muted { color: #666; font-size: 14px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; font-size: 15px; border-bottom: 1px solid #f5f5f5; }
.kv:last-child { border-bottom: 0; }
.job-note { background: #fafafa; border: 1px solid #e5e5e5; padding: 14px; margin: 12px 0; border-radius: 8px; font-size: 15px; line-height: 1.5; }

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 50;
}
.toast {
  background: #1a1a1a;
  color: #fff;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: opacity 0.3s;
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 28px;
  width: min(640px, 100%);
  max-height: 85vh;
  overflow: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.modal-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  color: #1a1a1a;
}

@media (max-width: 900px) {
  .app { display: block; }
  .sidebar {
    width: 280px;
    position: fixed;
    left: -290px;
    z-index: 20;
    box-shadow: 4px 0 16px rgba(0,0,0,0.15);
  }
  .sidebar.open { left: 0; }
  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
  }
  .mobile-nav-toggle {
    border: 1px solid #d0d0d0;
    background: #fff;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    min-height: 40px;
    border-radius: 8px;
  }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .main { padding: 20px 16px; }
  h1 { font-size: 24px; }
  .btn, .nav-item, input, select { min-height: 48px; font-size: 16px; }
  .card { padding: 20px; }
  .stat-card { padding: 18px; }
}
