:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-soft: #eef4f6;
  --text: #172126;
  --muted: #68767d;
  --line: #dbe5e8;
  --navy: #153b4a;
  --teal: #0f9f8f;
  --green: #1f9d5a;
  --amber: #d89116;
  --red: #d84b45;
  --shadow: 0 18px 45px rgba(21, 59, 74, 0.09);
  --radius: 8px;
  font-family: "Pretendard", "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  background: #102f3a;
  color: #ffffff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #18b49f;
}

.brand-mark svg {
  width: 26px;
  height: 26px;
  fill: #ffffff;
}

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

.brand strong {
  font-size: 18px;
  line-height: 1.2;
}

.brand span {
  margin-top: 3px;
  color: #b9cbd1;
  font-size: 12px;
}

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

.tree-nav {
  align-content: start;
  gap: 7px;
}

.menu-branch {
  display: grid;
  gap: 4px;
}

.nav-item {
  border: 0;
  border-radius: var(--radius);
  padding: 12px;
  color: #d6e5e8;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover,
.menu-branch.open > .nav-item {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.nav-item:disabled,
.nav-subitem:disabled,
.nav-leaf:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.nav-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.13);
  font-weight: 800;
}

.nav-subgroup {
  display: grid;
  gap: 4px;
  margin: -4px 0 8px 34px;
}

.menu-children {
  display: none;
  gap: 4px;
}

.menu-branch.open > .menu-children {
  display: grid;
}

.level-2 {
  margin-left: 18px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.13);
}

.level-3 {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.level-4 {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 1px dashed rgba(255, 255, 255, 0.16);
}

.nav-subitem,
.nav-leaf {
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #b9cbd1;
  padding: 7px 10px;
  text-align: left;
  font-size: 13px;
}

.nav-subitem.active,
.nav-subitem:hover,
.nav-leaf.active,
.nav-leaf:hover,
.menu-branch.open > .nav-subitem,
.menu-branch.open > .nav-leaf {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item,
.nav-subitem,
.nav-leaf {
  width: 100%;
}

.menu-toggle {
  position: relative;
  padding-right: 28px;
}

.menu-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  color: #b9cbd1;
  font-size: 12px;
  transition: transform 160ms ease;
}

.menu-branch.open > .menu-toggle .menu-caret {
  transform: translateY(-50%) rotate(0deg);
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-note span,
.sidebar-note small {
  color: #b9cbd1;
}

.sidebar-note strong {
  display: block;
  margin: 8px 0;
  font-size: 30px;
  letter-spacing: 0;
}

.workspace {
  padding: 28px;
  overflow: hidden;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
}

.topbar p,
.section-heading p,
.checklist-header span,
.result-box p {
  color: var(--muted);
}

.topbar p {
  margin-top: 6px;
}

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

.sync-state {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.primary-button,
.ghost-button,
.export-button {
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 15px;
  font-weight: 700;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
}

.ghost-button,
.export-button {
  background: var(--surface);
  color: var(--navy);
  border-color: var(--line);
}

.logout-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.user-badge {
  color: var(--navy);
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(120px, 0.75fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-panel {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-panel span {
  color: var(--muted);
  font-size: 13px;
}

.metric-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.metric-panel.success strong {
  color: var(--green);
}

.metric-panel.warning strong {
  color: var(--amber);
}

.metric-panel.danger strong {
  color: var(--red);
}

.progress-track {
  height: 8px;
  margin-top: 14px;
  border-radius: 999px;
  background: #dce8eb;
  overflow: hidden;
}

.progress-track div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
  transition: width 180ms ease;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

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

.inspection-panel,
.evidence-panel {
  padding: 20px;
}

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

.section-heading h2,
.checklist-header h2 {
  font-size: 19px;
}

.section-heading p {
  margin-top: 5px;
  font-size: 13px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

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

input,
select,
textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fbfdfe;
  outline: none;
}

input {
  height: 42px;
  padding: 0 12px;
}

select {
  height: 42px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 159, 143, 0.13);
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
}

.checklist-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 18px 0 12px;
}

.checklist {
  display: grid;
  gap: 10px;
}

.check-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfe;
}

.check-copy strong,
.check-copy span {
  display: block;
}

.check-copy strong {
  font-size: 15px;
}

.check-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.status-group {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 6px;
}

.status-button {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-button.active.ok {
  color: #ffffff;
  border-color: var(--green);
  background: var(--green);
}

.status-button.active.warn {
  color: #ffffff;
  border-color: var(--amber);
  background: var(--amber);
}

.status-button.active.bad {
  color: #ffffff;
  border-color: var(--red);
  background: var(--red);
}

.upload-box {
  min-height: 132px;
  border: 1px dashed #a9bcc2;
  border-radius: var(--radius);
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  color: var(--navy);
  cursor: pointer;
}

.upload-box input {
  display: none;
}

.upload-box strong,
.upload-box small {
  display: block;
}

.upload-box small {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 500;
}

.upload-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 8px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: var(--teal);
  font-size: 24px;
  line-height: 1;
}

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

.photo-card {
  position: relative;
  min-height: 94px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #e8f0f2;
}

.photo-card img {
  width: 100%;
  height: 112px;
  display: block;
  object-fit: cover;
}

.photo-card button {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: rgba(16, 47, 58, 0.84);
  color: #ffffff;
}

.text-field {
  display: block;
  margin-top: 14px;
}

.result-box {
  margin-top: 16px;
  border-radius: var(--radius);
  padding: 16px;
  background: #edf6f4;
  border: 1px solid #c9e7e1;
}

.result-box span {
  color: var(--muted);
  font-size: 13px;
}

.result-box strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  color: var(--teal);
}

.result-box p {
  margin-top: 8px;
  font-size: 13px;
}

.result-box.bad {
  background: #fff0ef;
  border-color: #f4c8c5;
}

.result-box.bad strong {
  color: var(--red);
}

.result-box.warn {
  background: #fff8e8;
  border-color: #eed8a7;
}

.result-box.warn strong {
  color: var(--amber);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 159, 143, 0.1), transparent 42%),
    var(--bg);
}

.auth-shell {
  width: min(100%, 430px);
}

.auth-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

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

.auth-brand strong {
  font-size: 18px;
}

.auth-brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.auth-copy {
  margin: 28px 0 22px;
}

.auth-copy h1 {
  font-size: 28px;
}

.auth-copy p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-error {
  padding: 12px;
  border: 1px solid #f4c8c5;
  border-radius: var(--radius);
  background: #fff0ef;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
}

.success-notice {
  color: var(--green);
  border: 1px solid #bfe4cf;
  background: #edf8f1;
}

.error-notice {
  color: var(--red);
  border: 1px solid #f4c8c5;
  background: #fff0ef;
}

.admin-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.permission-panel {
  margin-top: 16px;
}

.permission-toggle-form {
  margin: 0;
}

.permission-toggle {
  min-width: 62px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
}

.permission-toggle.allowed {
  color: var(--green);
  border-color: #bfe4cf;
  background: #e8f7ef;
}

.permission-toggle.denied {
  color: var(--red);
  border-color: #f4c8c5;
  background: #fff0ef;
}

.permission-toggle:not(:disabled):hover {
  filter: brightness(0.97);
}

.permission-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.admin-form-panel,
.table-panel,
.category-panel,
.empty-panel {
  padding: 20px;
}

.admin-form-panel h3,
.table-panel h3,
.category-panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.muted-copy,
.empty-panel p,
.category-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.data-table th {
  color: var(--muted);
  background: #f7fafb;
  font-weight: 800;
}

.data-table input,
.data-table select {
  min-width: 130px;
  margin-top: 0;
}

.inline-member-form,
.inline-action-form {
  display: inline;
}

.action-cell {
  min-width: 250px;
}

.password-reset {
  max-width: 130px;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.danger-button {
  color: var(--red);
  border-color: #f1c6c3;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  background: #e8f0f2;
  color: var(--muted);
}

.status-pill.ok,
.status-pill.normal {
  background: #e8f7ef;
  color: var(--green);
}

.status-pill.bad,
.status-pill.faulty {
  background: #fff0ef;
  color: var(--red);
}

.status-pill.abnormal {
  background: #fff8e8;
  color: var(--amber);
}

.table-subtext {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.category-panel strong {
  display: block;
  margin-bottom: 12px;
  font-size: 28px;
  color: var(--teal);
}

.simple-list {
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.simple-list li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfe;
}

.simple-list span,
.simple-list small {
  display: block;
}

.simple-list small {
  margin-top: 4px;
  color: var(--muted);
}

.room-panel {
  min-height: 180px;
  display: grid;
  align-content: space-between;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
  }

  .nav {
    grid-template-columns: repeat(4, auto);
    margin-left: auto;
  }

  .nav-subgroup {
    display: none;
  }

  .tree-nav {
    display: flex;
    gap: 8px;
    margin-left: auto;
  }

  .tree-nav .menu-children {
    display: none;
  }

  .sidebar-note {
    display: none;
  }

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

  .admin-grid,
  .category-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .section-heading,
  .checklist-header {
    display: grid;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions > * {
    flex: 1;
  }

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

  .check-item {
    grid-template-columns: 1fr;
  }

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

  .sidebar {
    overflow-x: auto;
  }

  .brand {
    min-width: 178px;
  }

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

@media (max-width: 520px) {
  .summary-grid,
  .field-grid,
  .photo-list {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  .inspection-panel,
  .evidence-panel {
    padding: 16px;
  }
}
