:root {
  --garmin-blue: #007dc5;
  --ink: #172033;
  --muted: #657286;
  --page: #f4f7fb;
  --surface: #ffffff;
  --line: #d9e1ea;
  --green: #277a46;
  --yellow: #a56800;
  --red: #b33630;
  --teal: #0f766e;
  --shadow: 0 10px 30px rgba(20, 32, 48, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #111827;
  color: #fff;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.18);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
}

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

.brand-logo {
  display: block;
  width: 132px;
  height: auto;
  flex: 0 0 auto;
  filter: brightness(0) invert(1);
}

.brand-login {
  align-items: flex-end;
}

.brand-login .brand-logo {
  width: 178px;
  filter: none;
}

.brand-subtitle {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 24px 10px;
  max-width: 1280px;
  margin: 0 auto;
}

.nav button {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 12px;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.nav button.active {
  color: #fff;
  border-bottom-color: var(--garmin-blue);
}

.user-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.9rem;
  text-align: right;
}

.language-select {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 4px 8px;
}

.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(0, 125, 197, 0.16), transparent 38%),
    radial-gradient(circle at 85% 16%, rgba(15, 118, 110, 0.14), transparent 28%),
    var(--page);
}

.login-panel {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}

.login-panel p {
  margin: 0 0 22px;
  color: var(--muted);
}

.login-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.login-actions a:not(.btn) {
  color: #075985;
  font-weight: 700;
}

.login-help {
  margin: 18px 0 0 !important;
  font-size: 0.86rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar h1 {
  margin: 0;
  font-size: 1.55rem;
}

.toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 0;
  font-size: 1.06rem;
}

.panel-body {
  min-width: 0;
  padding: 20px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.stat strong {
  display: block;
  color: var(--garmin-blue);
  font-size: 1.8rem;
  line-height: 1;
}

.stat span {
  color: var(--muted);
  font-size: 0.84rem;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field label {
  font-weight: 700;
  font-size: 0.88rem;
}

.help {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 0;
  border-color: var(--garmin-blue);
  box-shadow: 0 0 0 3px rgba(0, 125, 197, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--garmin-blue);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(0.96);
}

.btn.secondary {
  background: #eef5fb;
  color: #075985;
  border: 1px solid #b9d8ef;
}

.btn.success {
  background: var(--green);
}

.btn.danger {
  background: var(--red);
}

.btn.ghost {
  background: transparent;
  color: inherit;
  border: 1px solid currentColor;
}

.btn.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar select {
  min-height: 36px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-gutter: stable;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.computed-value {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 750;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  text-align: left;
  background: #182235;
  color: #fff;
  font-weight: 700;
  padding: 10px 12px;
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tr:hover td {
  background: #f8fafc;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.76rem;
  font-weight: 750;
  background: #edf2f7;
  color: #334155;
  white-space: nowrap;
}

.badge.pending,
.badge.employee_draft {
  background: #eef2f7;
  color: #475569;
}

.badge.employee_done {
  background: #e6f4ff;
  color: #075985;
}

.badge.manager_done,
.badge.approved {
  background: #e8f7ee;
  color: var(--green);
}

.badge.signed {
  background: #ecfdf5;
  color: var(--teal);
}

.process-health {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.process-health.green {
  background: #e8f7ee;
  color: var(--green);
}

.process-health.yellow {
  background: #fff7e6;
  color: var(--yellow);
}

.process-health.red {
  background: #feecec;
  color: var(--red);
}

.badge.grade-A {
  background: #e8f7ee;
  color: var(--green);
}

.badge.grade-B {
  background: #e6f4ff;
  color: #075985;
}

.badge.grade-C {
  background: #fff7e6;
  color: var(--yellow);
}

.badge.grade-D {
  background: #feecec;
  color: var(--red);
}

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  margin-bottom: 14px;
}

.notice.info {
  background: #eaf6fd;
  border-color: #b8def3;
  color: #075985;
}

.notice.warn {
  background: #fff7e6;
  border-color: #f3d08a;
  color: #754c00;
}

.notice.ok {
  background: #eaf8ef;
  border-color: #b9dfc7;
  color: #23623a;
}

.category {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}

.category-head {
  background: #f8fafc;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.category-head h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.category-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.category-body {
  padding: 16px;
}

.review-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.read-block {
  background: #f8fafc;
  border-left: 3px solid var(--garmin-blue);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.read-block.manager {
  border-left-color: var(--green);
  background: #f3fbf6;
}

.read-label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 4px;
}

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

.scale span {
  display: block;
  border-radius: 8px;
  padding: 8px;
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
}

.scale .a { background: #e8f7ee; color: var(--green); }
.scale .b { background: #e6f4ff; color: #075985; }
.scale .c { background: #fff7e6; color: var(--yellow); }
.scale .d { background: #feecec; color: var(--red); }

.empty {
  color: var(--muted);
  font-style: italic;
}

.toast {
  position: fixed;
  top: 88px;
  right: 20px;
  z-index: 50;
  width: min(420px, calc(100vw - 40px));
  border-radius: 8px;
  padding: 13px 16px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
}

.export-dialog {
  width: min(680px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.export-dialog::backdrop {
  background: rgba(15, 23, 42, 0.62);
}

.export-dialog-content {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  padding: 24px;
}

.export-dialog-image {
  width: 180px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
}

.export-dialog h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.export-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.export-dialog-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

.feedback-trigger {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid #9b2c2c;
  border-radius: 50%;
  background: #b4232d;
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.24);
  cursor: pointer;
}

.feedback-trigger:hover {
  background: #941b24;
}

.feedback-trigger:focus-visible {
  outline: 3px solid #7dd3fc;
  outline-offset: 3px;
}

.feedback-trigger svg,
.feedback-dialog-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feedback-dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.feedback-dialog::backdrop {
  background: rgba(15, 23, 42, 0.62);
}

.feedback-dialog-content {
  padding: 24px;
}

.feedback-dialog-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 20px;
}

.feedback-dialog-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: #fee2e2;
  color: #991b1b;
}

.feedback-dialog h2 {
  margin: 0 0 5px;
  font-size: 1.2rem;
}

.feedback-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.feedback-dialog textarea {
  min-height: 150px;
}

.feedback-dialog-actions {
  justify-content: flex-end;
}

.feedback-table {
  min-width: 1050px;
}

.feedback-message {
  min-width: 280px;
  max-width: 440px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.loading {
  padding: 38px;
  text-align: center;
  color: var(--muted);
}

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

.user-admin-layout {
  display: grid;
  gap: 18px;
}

.user-list-panel {
  min-width: 0;
}

.user-list-panel table {
  min-width: 1040px;
}

.user-admin-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.checkbox-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
}

.checkbox-field small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
}

.process-steps {
  margin: 0;
  padding-left: 20px;
}

.process-steps li {
  color: var(--muted);
  margin-bottom: 8px;
}

.process-steps li.done {
  color: var(--green);
  font-weight: 800;
}

@media (max-width: 860px) {
  .grid.cols-2,
  .grid.cols-3,
  .review-columns,
  .split-form,
  .user-admin-forms,
  .scale {
    grid-template-columns: 1fr;
  }

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

  .topbar-row,
  .nav,
  .main,
  .user-menu {
    width: 100%;
    min-width: 0;
  }

  .brand {
    min-width: 0;
  }

  .user-menu {
    text-align: left;
  }

  .main {
    padding: 18px 14px 36px;
  }

  th,
  td {
    padding: 9px 10px;
  }

  .toolbar > .actions,
  .toolbar > .btn {
    width: 100%;
  }
}

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

  .export-dialog-content {
    grid-template-columns: 1fr;
  }

  .export-dialog-image {
    width: 100%;
    max-height: 240px;
    aspect-ratio: 16 / 9;
  }
}

@media print {
  .topbar,
  .toolbar .actions,
  .btn,
  .filter-bar,
  aside {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .main {
    max-width: none;
    padding: 0;
  }

  .split-form {
    display: block;
  }

  .panel {
    box-shadow: none;
    border: 1px solid #d1d5db;
    break-inside: avoid;
  }
}
