* {
  box-sizing: border-box;
}

:root {
  --page-max: 1180px;
  --panel: #efefef;
  --ink: #171717;
  --muted: #5f5f5f;
  --line: #cdcdcd;
  --side: #1f1d20;
  --save: #ff3e2d;
  --save-dark: #d82b1e;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
  background: #0f0c0f url("../img/app-bg.jpg") center center / cover no-repeat fixed;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(12, 8, 10, 0.56);
  z-index: -1;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.topbar {
  background: #f6f6f6;
  border-bottom: 1px solid #d9d9d9;
}

.topbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand img {
  width: auto;
  height: 58px;
  max-width: 100%;
}

.topbar-user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: #1d1d1d;
  max-width: 400px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.topbar-user .icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #151515;
  color: #fff;
  font-size: 13px;
}

.topbar-link {
  color: #222;
  font-weight: 700;
  text-decoration: none;
}

.topbar-link:hover {
  text-decoration: underline;
}

.page-wrap {
  max-width: var(--page-max);
  margin: 36px auto 48px;
  padding: 0 20px;
}

.panel {
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
}

.panel.center {
  max-width: 760px;
  margin: 0 auto;
}

.panel.large {
  max-width: 980px;
  margin: 0 auto;
}

.panel-body {
  padding: 30px 34px;
}

.panel h1 {
  margin: 0;
  line-height: 1.18;
  font-size: 2.85rem;
}

.subhead {
  margin: 6px 0 0;
  color: #282828;
  font-size: 1.13rem;
}

.menu-list {
  margin-top: 18px;
  border-top: 1px solid #d7d7d7;
}

.menu-row {
  display: flex;
  align-items: center;
  gap: 18px;
  text-decoration: none;
  color: #111;
  padding: 18px 2px;
  border-bottom: 1px solid #d7d7d7;
}

.menu-row:last-child {
  border-bottom: 0;
}

.menu-icon {
  min-width: 44px;
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  line-height: 1;
}

.menu-copy strong {
  display: block;
  font-size: 2rem;
}

.menu-copy span {
  display: block;
  color: #1e1e1e;
  margin-top: 4px;
  font-size: 1.03rem;
}

.menu-row:hover strong {
  text-decoration: underline;
}

.start-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 26px;
}

.system-card {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.system-card.selectable img {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.system-card.selectable.selected img {
  border: 2px solid #111;
  box-shadow: 0 0 0 1px #111 inset;
}

.system-card.selectable.selected .system-label {
  color: #111;
}

.system-card:disabled {
  opacity: 0.6;
  cursor: wait;
}

.system-card img {
  width: 100%;
  height: 112px;
  object-fit: cover;
  border: 1px solid #c7c7c7;
}

.system-label {
  margin-top: 8px;
  color: #e43a2f;
  font-size: 1.95rem;
  font-weight: 700;
}

.system-label .arrow {
  margin-right: 6px;
}

.setup-grid {
  margin-top: 12px;
}

.back-link {
  display: inline-block;
  margin-top: 32px;
  color: #141414;
  font-weight: 700;
  text-underline-offset: 4px;
}

.inspection-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  align-items: start;
}

.inspection-nav {
  background: var(--side);
  color: #fff;
  padding: 16px 0 20px;
  position: sticky;
  top: 20px;
}

.inspection-nav a,
.inspection-nav button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  text-align: left;
  padding: 11px 20px;
  font-size: 1.7rem;
  line-height: 1.35;
  cursor: pointer;
}

.inspection-nav .home-link {
  font-size: 1.55rem;
  margin-bottom: 14px;
}

.inspection-nav .section-link {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.inspection-nav .section-link.active {
  background: #f2f2f2;
  color: #101010;
  font-weight: 700;
}

.save-block {
  margin: 18px 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 12px;
}

.save-note {
  margin: 0 0 9px;
  font-size: 1.52rem;
}

.save-note .clock {
  margin-right: 7px;
}

.save-btn {
  border: 0;
  font-size: 1.58rem;
  font-weight: 700;
  color: #fff;
  background: var(--save);
  padding: 6px 14px;
  cursor: pointer;
}

.save-btn + .save-btn {
  margin-top: 8px;
}

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

.save-btn.save-btn-secondary {
  background: #2c2c2c;
}

.save-btn.save-btn-secondary:hover {
  background: #1a1a1a;
}

.save-status {
  margin: 9px 0 0;
  font-size: 1.35rem;
  color: #d9d9d9;
  min-height: 20px;
}

.inspection-content {
  background: var(--panel);
  padding: 20px 26px 30px;
}

.section-meta {
  margin-top: -6px;
  margin-bottom: 14px;
  color: #474747;
  font-size: 1.38rem;
}

.form-section {
  display: none;
}

.form-section.active {
  display: block;
}

.form-section h2 {
  margin: 0;
  font-size: 2.75rem;
  line-height: 1.2;
}

.section-intro {
  margin: 5px 0 18px;
  color: #3b3b3b;
  font-size: 1.3rem;
}

.row-inline {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 10px 16px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.row-inline:first-of-type {
  margin-top: 2px;
}

.row-label {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.inline-options {
  display: grid;
  gap: 9px;
}

.inline-options label,
.option-item {
  display: inline-flex;
  align-items: start;
  gap: 8px;
  font-size: 1.28rem;
  line-height: 1.35;
}

.line-grid {
  display: grid;
  gap: 11px;
  margin-top: 8px;
}

.line-field label {
  display: block;
  margin: 0;
  font-size: 1.24rem;
  font-weight: 700;
}

.job-number-mode {
  margin-top: 6px;
  grid-template-columns: repeat(auto-fit, minmax(170px, max-content));
  gap: 8px 16px;
}

.field-note {
  margin: 6px 0 0;
  font-size: 1.05rem;
  color: #444;
}

.line-field input[type="text"],
.line-field input[type="date"],
.line-field input[type="email"],
.line-field input[type="password"],
.line-field select,
.line-field textarea {
  margin-top: 5px;
  width: 100%;
  border: 0;
  border-bottom: 2px solid #8f8f8f;
  background: transparent;
  padding: 8px 2px;
  color: #111;
  font: inherit;
}

.line-field input[type="file"] {
  margin-top: 8px;
  font: inherit;
  font-size: 1.02rem;
}

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

.line-field input:focus,
.line-field select:focus,
.line-field textarea:focus {
  outline: 0;
  border-bottom-color: #111;
}

.photo-box {
  margin-top: 10px;
}

.photo-preview {
  width: 260px;
  height: 155px;
  border: 1px solid #c8c8c8;
  background: #cccccc;
  display: grid;
  place-items: center;
  color: #535353;
  font-size: 1.28rem;
  text-align: center;
  padding: 8px;
}

.photo-preview.has-photo {
  background: #e6e6e6;
  color: #222;
}

.photo-buttons {
  margin-top: 9px;
  display: flex;
  gap: 10px;
}

.mini-btn {
  border: 1px solid #c7c7c7;
  background: #efefef;
  color: #333;
  padding: 9px 16px;
  cursor: pointer;
  font: inherit;
}

.mini-btn:hover {
  background: #fff;
}

.hint {
  margin-top: 9px;
  color: #3f3f3f;
  font-size: 1.06rem;
  font-style: italic;
}

.procedure-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 13px;
}

.procedure-grid h3 {
  margin: 0;
  font-size: 1.35rem;
}

.procedure-grid ol {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 8px;
  font-size: 1.26rem;
  line-height: 1.38;
}

.checklist-group {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 13px;
}

.checklist-group h3 {
  margin: 0;
  font-size: 1.35rem;
}

.option-list {
  display: grid;
  gap: 9px;
}

.record-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.admin-card {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid #d4d4d4;
  background: #f8f8f8;
}

.admin-card h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-card-head h2 {
  margin: 0;
}

.admin-card .record-actions {
  margin-top: 6px;
}

.record-card {
  background: #f8f8f8;
  border: 1px solid #d4d4d4;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.file-list-preview {
  margin-top: 8px;
  display: grid;
  gap: 5px;
}

.file-list-preview p {
  margin: 0;
  color: #333;
  font-size: 1rem;
}

.record-files {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.record-files a {
  display: inline-block;
  border: 1px solid #c8c8c8;
  background: #fff;
  color: #222;
  text-decoration: none;
  padding: 4px 8px;
  font-size: 0.95rem;
}

.record-files a:hover {
  background: #f2f2f2;
}

.user-manage-form {
  gap: 10px;
}

.record-title {
  margin: 0;
  font-size: 1.35rem;
}

.record-meta {
  color: #4d4d4d;
  margin: 0;
}

.record-actions {
  margin-top: 3px;
  display: flex;
  gap: 10px;
}

.btn {
  border: 1px solid #222;
  background: #222;
  color: #fff;
  font: inherit;
  padding: 7px 12px;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  opacity: 0.9;
}

.btn.alt {
  border-color: #6c6c6c;
  background: #f5f5f5;
  color: #111;
}

.btn.btn-danger {
  border-color: #aa2b20;
  background: #fff1ef;
  color: #8d1e16;
}

.btn.btn-danger:hover {
  background: #ffe6e2;
}

.btn.btn-warning {
  border-color: #a46a08;
  background: #fff5df;
  color: #7d4f00;
}

.btn.btn-warning:hover {
  background: #ffecc0;
}

.empty-state {
  margin-top: 20px;
  font-size: 1.2rem;
  color: #404040;
}

.account-form {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.account-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 1.2rem;
  font-weight: 700;
}

.account-form input {
  width: 100%;
  border: 1px solid #bdbdbd;
  background: #f8f8f8;
  font: inherit;
  padding: 10px 11px;
}

.account-form input[readonly] {
  background: #ebebeb;
  color: #444;
}

.account-form input:focus {
  outline: 2px solid #111;
  outline-offset: 1px;
}

.account-msg {
  margin: 4px 0 0;
  color: #1b1b1b;
  min-height: 20px;
}

.schedule-controls {
  display: grid;
  gap: 12px;
}

.schedule-filter {
  max-width: 320px;
}

.schedule-calendar {
  margin-top: 8px;
}

.schedule-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.schedule-weekday {
  background: #e7e7e7;
  border: 1px solid #d3d3d3;
  padding: 6px 8px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.schedule-day {
  border: 1px solid #cdcdcd;
  background: #fff;
  min-height: 104px;
  padding: 8px;
  text-align: left;
  cursor: pointer;
  display: grid;
  align-content: start;
  gap: 6px;
}

.schedule-day:hover {
  background: #f7f7f7;
}

.schedule-day.is-outside {
  background: #f3f3f3;
  color: #666;
}

.schedule-day.is-selected {
  border-color: #2c2c2c;
  box-shadow: inset 0 0 0 1px #2c2c2c;
}

.schedule-day.is-today {
  border-color: #0f4f63;
}

.schedule-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schedule-day-num {
  font-weight: 700;
}

.schedule-day-count {
  display: inline-block;
  border-radius: 999px;
  background: #222;
  color: #fff;
  font-size: 0.75rem;
  min-width: 20px;
  text-align: center;
  padding: 2px 6px;
}

.schedule-day-preview {
  display: grid;
  gap: 3px;
}

.schedule-day-job {
  display: block;
  font-size: 0.83rem;
  line-height: 1.25;
  color: #303030;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schedule-day-more {
  font-size: 0.8rem;
  color: #4a4a4a;
}

.schedule-day-title {
  margin: 0 0 10px;
  font-size: 1.35rem;
}

.schedule-job-list {
  display: grid;
  gap: 10px;
}

.schedule-job-card {
  border: 1px solid #d2d2d2;
  background: #f8f8f8;
  padding: 11px 12px;
  display: grid;
  gap: 6px;
}

.schedule-job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schedule-job-head h4 {
  margin: 0;
  font-size: 1.06rem;
}

.schedule-job-card p {
  margin: 0;
  color: #2f2f2f;
}

.schedule-pill {
  display: inline-block;
  border: 1px solid #157f2e;
  background: #ecf8ef;
  color: #1b6d2d;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
}

.login-panel .panel-body {
  padding-top: 24px;
}

.login-brand {
  text-align: center;
  margin-bottom: 10px;
}

.login-brand img {
  max-width: 320px;
  width: 100%;
  height: auto;
}

.seed-note {
  margin-top: 20px;
  border-top: 1px solid #d1d1d1;
  padding-top: 10px;
  color: #2f2f2f;
}

.seed-note p {
  margin: 4px 0;
  font-size: 0.95rem;
}

.seed-note .small-note {
  font-size: 0.82rem;
  color: #555;
}

@media (max-width: 1100px) {
  .panel h1 {
    font-size: 2.4rem;
  }

  .menu-copy strong {
    font-size: 1.7rem;
  }

  .system-label {
    font-size: 1.62rem;
  }

  .inspection-nav a,
  .inspection-nav button {
    font-size: 1.45rem;
  }

  .form-section h2 {
    font-size: 2.25rem;
  }
}

@media (max-width: 900px) {
  .inspection-layout {
    grid-template-columns: 1fr;
  }

  .inspection-nav {
    position: static;
    padding-bottom: 12px;
  }

  .inspection-nav .home-link {
    margin-bottom: 10px;
  }

  .inspection-nav .section-link {
    border-top: 0;
    border-left: 4px solid transparent;
  }

  .inspection-nav .section-link.active {
    border-left-color: #111;
  }

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

  .system-card img {
    height: 180px;
  }

  .schedule-weekdays,
  .schedule-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .topbar-inner {
    padding: 10px 12px;
  }

  .topbar-user {
    font-size: 0.9rem;
  }

  .topbar-actions {
    gap: 10px;
  }

  .brand img {
    height: 44px;
  }

  .page-wrap {
    margin-top: 18px;
    padding: 0 10px;
  }

  .panel-body {
    padding: 18px 15px;
  }

  .panel h1 {
    font-size: 2rem;
  }

  .menu-row {
    gap: 10px;
    padding: 14px 0;
  }

  .menu-icon {
    min-width: 34px;
    font-size: 28px;
  }

  .menu-copy strong {
    font-size: 1.38rem;
  }

  .menu-copy span {
    font-size: 0.96rem;
  }

  .inspection-content {
    padding: 15px 12px 20px;
  }

  .row-inline,
  .procedure-grid,
  .checklist-group {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .photo-preview {
    width: 100%;
    max-width: 280px;
  }

  .photo-buttons {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .schedule-day {
    min-height: 88px;
  }

  .schedule-job-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
