:root {
  --primary: #3366cc;
  --primary-dark: #153e91;
  --primary-deep: #0f2f6d;
  --primary-soft: #eaf1ff;
  --cyan: #19bfd7;
  --mint: #18a058;
  --amber: #f5a623;
  --red: #e44d4d;
  --white: #ffffff;
  --bg: #eef3fa;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --field: #f6f9fe;
  --text: #142033;
  --muted: #6f7d91;
  --border: #dfe8f5;
  --line: rgba(51, 102, 204, 0.13);
  --shadow: 0 12px 30px rgba(23, 50, 96, 0.1);
  --shadow-strong: 0 20px 48px rgba(16, 43, 94, 0.2);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(51, 102, 204, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 102, 204, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, #e9f0fb 0%, #f7f9fd 42%, #eef3fa 100%);
  background-size: 28px 28px, 28px 28px, 100% 100%;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

body {
  min-width: 320px;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 56px;
  padding: 8px 14px;
  background:
    linear-gradient(135deg, rgba(21, 62, 145, 0.98), rgba(51, 102, 204, 0.98)),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 18px);
  color: var(--white);
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto minmax(86px, 1fr);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 26px rgba(26, 67, 146, 0.24);
}

.header a {
  color: var(--white);
}

.header-home {
  display: flex;
  justify-content: space-between;
}

.header-brand {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-brand span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  line-height: 1.2;
}

.header-brand strong,
.header-home .header-phone {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  line-height: 1.25;
  font-weight: 800;
}

.header-phone {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}

.header-phone-right {
  text-align: right;
}

.header-title {
  max-width: 168px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
  font-size: 15px;
  text-align: center;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.header-pill {
  min-height: 28px;
  min-width: 50px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--white) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.back-link {
  min-width: 56px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 700;
}

.back-link::before {
  content: "<";
  font-size: 15px;
}

.page {
  width: 100%;
  max-width: 480px;
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  padding: 16px 14px 30px;
}

.login-page {
  position: relative;
  max-width: none;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 34px 20px 28px;
  overflow: hidden;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 18px),
    linear-gradient(145deg, #0e2b68 0%, #1c55b5 48%, #3366cc 100%);
  color: var(--white);
}

.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.075) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.18));
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

.login-page > .notice,
.login-page > .error-list {
  width: 100%;
  max-width: 420px;
  margin: 0;
}

.login-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
}

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

.login-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.07)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 9px);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 18px 34px rgba(0, 20, 65, 0.18);
}

.login-kicker {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  line-height: 1.4;
  text-transform: uppercase;
}

.login-brand h1 {
  margin: 0 0 9px;
  color: var(--white);
  font-size: 25px;
  line-height: 1.32;
  font-weight: 900;
}

.login-brand p,
.login-note {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.login-box form {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 8px;
  padding: 20px 16px 16px;
  color: var(--text);
  box-shadow: var(--shadow-strong);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.login-note {
  margin-top: 14px;
}

.page-head {
  margin: 4px 0 14px;
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  margin: 0 0 16px;
  padding: 18px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 18px),
    linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: var(--white);
  box-shadow: var(--shadow-strong);
}

.dashboard-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
}

.dashboard-hero > * {
  position: relative;
  z-index: 1;
}

.hero-kicker,
.section-bar small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  line-height: 1.4;
}

.dashboard-hero h1 {
  margin: 5px 0 8px;
  font-size: 24px;
  line-height: 1.28;
  font-weight: 900;
}

.dashboard-hero p {
  max-width: 28em;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.65;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.hero-stat {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.11);
}

.hero-stat span {
  display: block;
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
}

.hero-stat strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--white);
  font-size: 13px;
  line-height: 1.25;
}

.section-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 2px 0 10px;
}

.section-bar span {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.section-bar small {
  color: var(--muted);
}

.page-head h1,
.page-title {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 19px;
  line-height: 1.35;
  font-weight: 900;
}

.page-head p,
.page-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.page-head.dashboard-hero h1 {
  margin: 5px 0 8px;
  color: var(--white);
  font-size: 24px;
  line-height: 1.28;
  font-weight: 900;
}

.page-head.dashboard-hero p {
  max-width: 28em;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.65;
}

.section-title {
  margin: 18px 0 10px;
  color: var(--primary-deep);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 900;
}

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

.module-card,
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(212, 224, 241, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.module-card {
  min-height: 126px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
}

.module-card::before,
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}

.module-card::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 42px;
  height: 42px;
  border-right: 1px solid rgba(51, 102, 204, 0.16);
  border-bottom: 1px solid rgba(51, 102, 204, 0.16);
  pointer-events: none;
}

.module-icon {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(51, 102, 204, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(145deg, #f9fbff, #eaf1ff),
    repeating-linear-gradient(90deg, rgba(51, 102, 204, 0.08) 0 1px, transparent 1px 8px);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  font-weight: 900;
}

.dept-icon {
  color: var(--cyan);
  background: #eefbfe;
}

.module-name {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
}

.module-desc {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.card {
  margin-bottom: 11px;
  padding: 15px 14px 14px;
}

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

.card-title {
  margin: 0 0 11px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 900;
}

.card-head .card-title {
  margin-bottom: 0;
}

.meta,
.empty {
  color: var(--muted);
  line-height: 1.6;
}

.empty {
  text-align: center;
}

.inline-empty {
  text-align: left;
}

.row {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(223, 232, 245, 0.72);
}

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

.label {
  width: 104px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.value {
  min-width: 0;
  flex: 1;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.history-detail-row .label {
  width: 178px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: -2px 0 13px;
}

.btn,
button {
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid var(--primary);
  background: linear-gradient(135deg, var(--primary), #2857b7);
  color: var(--white);
  padding: 0 18px;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(51, 102, 204, 0.22);
}

.btn-block {
  width: 100%;
}

.btn.secondary,
button.secondary {
  border-color: rgba(51, 102, 204, 0.16);
  background: #eef4ff;
  color: var(--primary);
  box-shadow: none;
}

.btn.muted,
button.muted {
  border-color: #e4ebf5;
  background: #f3f6fa;
  color: var(--muted);
  box-shadow: none;
}

.btn.danger,
button.danger {
  border-color: #f7d7d7;
  background: #fff0f0;
  color: var(--red);
  box-shadow: none;
}

.form-card {
  padding: 18px 14px 12px;
}

.form-field {
  margin-bottom: 15px;
}

.form-field label {
  display: block;
  margin-bottom: 7px;
  color: #35445b;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 12px) 19px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input[readonly] {
  color: var(--muted);
  background: #f1f5fb;
}

.field-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(51, 102, 204, 0.55);
  box-shadow: 0 0 0 4px rgba(51, 102, 204, 0.1);
}

textarea {
  min-height: 96px;
}

.form-card .actions {
  position: sticky;
  bottom: 10px;
  margin: 20px -4px -2px;
  padding: 10px 4px 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.94) 28%);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

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

.check-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-solid);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.check-item input {
  width: auto;
  min-height: auto;
  box-shadow: none;
}

.check-item:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
}

.notice,
.error-list {
  margin: 0 0 12px;
  padding: 11px 12px;
  border-radius: 8px;
  line-height: 1.5;
  font-size: 13px;
}

.notice {
  background: #eaf8f0;
  color: var(--mint);
  border: 1px solid rgba(24, 160, 88, 0.14);
}

.error-list {
  background: #fff0f0;
  color: var(--red);
  border: 1px solid #ffd8d8;
}

.error-list ul {
  margin: 0;
  padding-left: 18px;
}

.status-badge {
  min-height: 24px;
  min-width: 54px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.status-badge.editable {
  background: #e8f7ef;
  color: var(--mint);
}

.status-badge.readonly {
  background: #f0f4fa;
  color: var(--muted);
}

.pre {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #dbe9ff;
  background: #10264f;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}

.inline-form {
  display: inline-flex;
}

@media (max-width: 360px) {
  .page {
    padding: 14px 10px 26px;
  }

  .header {
    grid-template-columns: minmax(52px, 1fr) auto minmax(72px, 1fr);
    padding-inline: 10px;
  }

  .header-title {
    max-width: 122px;
  }

  .header-actions {
    gap: 6px;
  }

  .header-pill {
    min-width: 42px;
    padding: 0 9px;
  }

  .dashboard-hero {
    padding: 16px 14px;
  }

  .dashboard-hero h1 {
    font-size: 22px;
  }

  .page-head.dashboard-hero h1 {
    font-size: 22px;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .grid {
    gap: 9px;
  }

  .module-card {
    min-height: 118px;
    padding: 12px;
  }

  .label {
    width: 92px;
  }

  .history-detail-row .label {
    width: 132px;
  }

  .actions .btn,
  .actions button {
    flex: 1 1 auto;
  }
}
