/* 屏幕时间管控 · 管理端样式
   单文件、无外部依赖、无内联样式；桌面与 390px 手机宽度均不横向溢出。 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: #1f2937;
  background: #f4f6f8;
  overflow-wrap: break-word;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #eef2ff;
  color: #3730a3;
  padding: 1px 5px;
  border-radius: 5px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.topbar-inner {
  max-width: 1020px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #16a34a);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  flex: none;
}

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

.topbar-user {
  color: #6b7280;
  font-size: 13px;
}

/* ---------- 布局 ---------- */
.container {
  max-width: 1020px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.card h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2::before {
  content: "";
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(180deg, #2563eb, #60a5fa);
  flex: none;
}

.hint {
  margin: 0 0 16px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.grid-days {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ---------- 表单 ---------- */
.form {
  margin: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.field-hint {
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.5;
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #ffffff;
  color: inherit;
  font: inherit;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

textarea {
  resize: vertical;
  min-height: 62px;
}

input[readonly] {
  background: #f9fafb;
  color: #4b5563;
}

.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.03em;
  overflow-wrap: anywhere;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}

.check input[type="checkbox"] {
  margin-top: 4px;
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: #2563eb;
}

/* 开关 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: #374151;
}

.switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.switch-track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #d1d5db;
  transition: background 0.15s ease;
  flex: none;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.3);
  transition: transform 0.15s ease;
}

.switch input[type="checkbox"]:checked + .switch-track {
  background: #16a34a;
}

.switch input[type="checkbox"]:checked + .switch-track::after {
  transform: translateX(20px);
}

.switch input[type="checkbox"]:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* ---------- 锁屏文案行 ---------- */
.msg-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.msg-head {
  display: grid;
  grid-template-columns: 110px 110px minmax(0, 1fr);
  gap: 8px;
  padding: 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

.msg-row {
  display: grid;
  grid-template-columns: 110px 110px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.msg-row input {
  min-width: 0;
}

/* ---------- 提示条 / 徽标 ---------- */
.alert {
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.7;
}

.alert ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.alert-success {
  background: #ecfdf3;
  border: 1px solid #a7f3c9;
  color: #166534;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ok {
  background: #ecfdf3;
  color: #166534;
}

.badge-warn {
  background: #fffbeb;
  color: #92400e;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-ghost {
  background: #ffffff;
  border-color: #d1d5db;
  color: #374151;
}

.btn-ghost:hover {
  background: #f9fafb;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 4px 0 12px;
}

.form-actions .field-hint {
  margin-right: auto;
}

/* ---------- 登录页 ---------- */
.page-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 15% 15%, #e0ecff 0, transparent 42%),
    radial-gradient(circle at 85% 85%, #dcfce7 0, transparent 40%), #f4f6f8;
}

.login-wrap {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: 0 20px 45px -20px rgba(16, 24, 40, 0.25);
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: #2563eb;
  margin-bottom: 14px;
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.login-card .hint {
  margin-bottom: 18px;
}

.login-card .field {
  margin-bottom: 14px;
}

.login-foot {
  margin: 16px 0 0;
  color: #9ca3af;
  font-size: 12px;
  text-align: center;
}

/* ---------- 页脚 ---------- */
.footer {
  padding: 8px 20px 32px;
  color: #9ca3af;
  font-size: 12px;
}

.footer-inner {
  max-width: 1020px;
  margin: 0 auto;
  text-align: center;
}

/* ---------- 窄屏 ---------- */
@media (max-width: 600px) {
  body {
    font-size: 14px;
  }

  .topbar-inner,
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .container {
    padding-top: 14px;
  }

  .card {
    padding: 16px;
    border-radius: 12px;
  }

  .topbar-user {
    display: none;
  }

  .msg-head {
    display: none;
  }

  .msg-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
    border: 1px dashed #e5e7eb;
    border-radius: 10px;
  }

  .msg-row .msg-text {
    grid-column: 1 / -1;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .field-hint {
    margin-right: 0;
    text-align: center;
  }

  .form-actions .btn {
    width: 100%;
  }

  .page-login {
    padding: 16px;
  }
}
