:root {
  --bg: #f3f6f9;
  --ink: #12212f;
  --panel: #ffffff;
  --line: #d8e0e7;
  --brand: #0b5fff;
  --brand-dark: #0a3ea8;
  --muted: #596b7c;
  --warn: #ac2f2f;
  --ok: #1f7a36;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at 10% 0%, #ffffff, var(--bg));
  color: var(--ink);
  font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", sans-serif;
}

.app {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.hidden { display: none !important; }

.hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.6vw, 2.8rem);
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
}

.hero.compact { margin-bottom: 10px; }

#auth-screen .hero {
  text-align: center;
}

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

.header-logo {
  width: 130px;
  height: 58px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #d8e0e7;
  padding: 4px;
  cursor: pointer;
}

.hero-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.push-right {
  margin-left: auto;
}

.session-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid #d8e0e7;
  background: #fff;
}

.admin-user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-user-thumb {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #b8c5d2;
  background: #fff;
}

.panel {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(16, 35, 52, 0.05);
}

h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.94rem;
  position: relative;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid #b8c5d2;
  border-radius: 9px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #95b8ff;
  outline-offset: 1px;
  border-color: #5d92ff;
}

button {
  border: none;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:hover { background: var(--brand-dark); }

.ghost { background: #e6edf5; color: #1d334a; }
.ghost:hover { color: #fff; }
.secondary { background: #2c4258; }
.danger { background: var(--warn); }
.cleaned-btn { background: var(--ok); color: #fff; }
.cleaned-btn:hover { background: #17622b; }
.audited-btn { background: var(--ok); color: #fff; }
.audited-btn:hover { background: var(--ok); }
.audited-text { color: var(--ok); font-weight: 700; }
.audit-admin-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.tab-btn.is-active {
  background: #1d334a;
  color: #fff;
}

.mini {
  min-width: 72px;
  padding: 8px 10px;
}

.status {
  min-height: 1.2rem;
  margin: 10px 0 0;
  font-weight: 700;
}

.status.ok { color: var(--ok); }
.status.err { color: var(--warn); }
.muted { color: var(--muted); }

#employee-csv-headers-hint,
#catalog-page .panel .muted {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.auth-center {
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
  justify-items: center;
}


.auth-box {
  width: min(420px, 100%);
}

.login-logos {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.login-logos img {
  width: 180px;
  height: 62px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #d8e0e7;
  border-radius: 10px;
  padding: 4px;
}

.stack-form {
  display: grid;
  gap: 10px;
}

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

.company-option {
  min-height: 130px;
  display: grid;
  gap: 10px;
  justify-items: center;
  align-content: center;
  background: #fff;
  color: #11263a;
  border: 2px solid #d8e0e7;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.company-option:hover {
  background: var(--brand);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(10, 28, 46, 0.12);
  border-color: #87aefb;
}

.company-option img {
  max-height: 58px;
  max-width: 220px;
  object-fit: contain;
}

.module-panel {
  display: grid;
  gap: 14px;
}

#module-admin-settings-panel {
  border: 1px dashed #c4d2df;
  border-radius: 10px;
  padding: 14px;
  background: #f8fbff;
}

.settings-row + .settings-row {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #dce6ef;
}

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

.module-card {
  min-height: 72px;
  background: #eef4ff;
  color: #17314a;
}

.module-card:hover {
  background: var(--brand);
  color: #fff;
}

.tab-btn:hover {
  color: #fff;
}

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

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

.inline-input {
  display: flex;
  gap: 8px;
  align-items: center;
}

.conditional-field.hidden-field {
  display: none;
}

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

#audit-report-view-template {
  margin-bottom: 14px;
}

#audit-report-view-panel .actions {
  margin-top: 8px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

#employee-list-toolbar {
  justify-content: flex-start;
  align-items: end;
}

#employee-list-toolbar .search {
  flex: 1 1 320px;
}

#employee-list-toolbar > button,
#employee-list-toolbar > label {
  flex: 0 0 auto;
}

.search { flex: 1 1 220px; }

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.list-page-size-toolbar {
  justify-content: flex-start;
  align-items: center;
  margin-top: 12px;
  margin-bottom: 14px;
  padding-bottom: 6px;
}

.list-page-size-toolbar > label,
.list-page-size-toolbar > .inline-input {
  flex: 0 0 auto;
}

.list-page-size-toolbar .inline-input {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.list-page-size-toolbar .inline-input span {
  line-height: 1;
}

.list-page-size-toolbar select {
  min-width: 96px;
}

.list-pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  flex-wrap: wrap;
  row-gap: 10px;
}

.list-pagination .muted {
  white-space: nowrap;
  line-height: 1;
  display: inline-block;
  padding: 0 4px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(7, 18, 28, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 20px;
}

.modal-card {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #d8e0e7;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 18px 42px rgba(8, 19, 30, 0.26);
}

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

.toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
}

.toggle-wrap input {
  width: auto;
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #8ea0b3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 30, 45, 0.16);
  z-index: 20;
}

.suggestion-item {
  padding: 9px 10px;
  color: #13263a;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.suggestion-item:hover {
  background: #e9f0ff;
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

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

th,
td {
  border-bottom: 1px solid #e4eaf0;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  color: #42556b;
  letter-spacing: 0.03em;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  font-size: 0.78rem;
  padding: 6px 8px;
}

.employee-row-actions {
  min-width: 280px;
  white-space: nowrap;
}

.employee-row-actions button {
  margin-right: 6px;
  margin-bottom: 6px;
}

.eye-btn {
  padding: 5px 8px;
  font-size: 0.75rem;
}

.barcode-preview {
  border: 1px dashed #bccad7;
  border-radius: 11px;
  min-height: 130px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fbfdff;
  margin-bottom: 12px;
}

.barcode-preview.empty { color: #5f7185; }
.barcode-content { display: grid; justify-items: center; gap: 8px; }
.asset-meta { font-size: 0.9rem; text-align: center; }

.photo-preview-wrap {
  display: flex;
  align-items: center;
  min-height: 90px;
}

#assign-photo-preview,
.assignee-thumb {
  width: 86px;
  height: 86px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #b8c5d2;
}

svg {
  max-width: 100%;
  height: auto;
}

@media (max-width: 980px) {
  .auth-grid,
  .company-grid,
  .module-grid,
  .grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app {
    padding: 16px;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions button {
    flex: 1 1 180px;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > label,
  .toolbar > .search,
  .toolbar > button,
  .toolbar > .toolbar-actions,
  .toolbar > .inline-input {
    flex: 1 1 220px;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .modal {
    padding: 10px;
  }

  .modal-card {
    max-height: 95vh;
    padding: 12px;
  }

  .employee-row-actions {
    min-width: 220px;
    white-space: normal;
  }

  table {
    min-width: 1120px;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 12px;
  }

  body {
    overflow-x: hidden;
  }

  .auth-grid,
  .company-grid,
  .module-grid,
  .grid-form {
    grid-template-columns: 1fr;
  }

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

  .hero h1 {
    font-size: 1.6rem;
  }

  .header-logo {
    width: 110px;
    height: 50px;
  }

  .panel {
    padding: 12px;
    border-radius: 12px;
    overflow: hidden;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  button {
    min-height: 42px;
  }

  .toolbar,
  .actions,
  .hero-actions {
    gap: 8px;
  }

  .toolbar > label,
  .toolbar > .search,
  .toolbar > button,
  .toolbar > .toolbar-actions,
  .toolbar > .inline-input,
  .actions > button,
  .hero-actions > button {
    width: 100%;
    flex: 1 1 100%;
  }

  .inline-input {
    flex-wrap: wrap;
  }

  .inline-input > * {
    width: 100%;
  }

  .login-logos img {
    width: 140px;
    height: 52px;
  }

  .table-wrap {
    margin-top: 4px;
    border-radius: 10px;
  }

  table {
    min-width: 920px;
  }

  th,
  td {
    padding: 8px 7px;
  }

  .row-actions button,
  .employee-row-actions button {
    font-size: 0.8rem;
    padding: 7px 9px;
  }

  .barcode-preview {
    padding: 8px;
    min-height: 110px;
  }

  #employee-csv-headers-hint,
  #catalog-page .panel .muted {
    font-size: 0.88rem;
    line-height: 1.35;
  }

}
