/* ===== Reset & base ===== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #2d2d2d;
  background: #fafafa;
  line-height: 1.5;
}
a { color: #1f75cb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Header ===== */
.site-header {
  background: #fff;
  border-bottom: 1px solid #eee;
}
.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header__logo {
  display: flex; align-items: center; gap: 10px;
  color: #2d2d2d;
}
.logo-mark {
  width: 28px; height: 28px;
  background: url('/img/doc-logo.svg') center/contain no-repeat;
  display: inline-block;
}
.logo-text { font-size: 22px; font-weight: 600; letter-spacing: -0.3px; }
.site-header__cta {
  background: #fff;
  border: 1px solid #d0d0d0;
  color: #555;
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: 3px;
  text-decoration: none;
  display: inline-block;
}
.site-header__cta:hover { background: #f5f5f5; text-decoration: none; }

/* ===== Page wrap ===== */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ===== 大横幅 ===== */
.banner {
  margin: 16px 0 24px;
  padding: 14px 20px;
  border-radius: 4px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.banner__title { font-size: 16px; font-weight: 600; }
.banner__meta  { font-size: 12px; opacity: 0.9; }
.banner--ok      { background: #108548; }
.banner--warn    { background: #e87324; }
.banner--bad     { background: #d93535; }
.banner--unknown { background: #777; }

.page-intro {
  font-size: 13px;
  color: #666;
  text-align: center;
  padding: 0 60px;
  margin: 0 0 32px;
}

/* ===== 进行中事件 ===== */
.open-incidents {
  margin-bottom: 24px;
}
.open-incidents h2 {
  font-size: 15px;
  margin: 0 0 8px;
  color: #555;
}

/* ===== 分组 / 服务列表 ===== */
.group { margin-top: 28px; }
.group__title {
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin: 0 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}
.service-list { list-style: none; margin: 0; padding: 0; }
.service {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 4px;
  border-bottom: 1px solid #f0f0f0;
}
.service:last-child { border-bottom: none; }
.service__name {
  font-size: 14px;
  color: #2d2d2d;
}
.service__url {
  font-size: 12px;
  margin-left: 6px;
  color: #999;
}
.service__provider {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 11px;
  background: #108548;
  color: #fff;
  border-radius: 2px;
}
.service__right { display: flex; gap: 12px; align-items: center; position: relative; }
.state {
  font-size: 13px;
  font-weight: 500;
}
.state--operational { color: #108548; }
.state--degraded    { color: #e69100; font-weight: 600; }
.state--down        { color: #d93535; font-weight: 600; }
.state--unknown     { color: #999; }
.service__error {
  position: relative;
  font-size: 11px;
  color: #d93535;
  cursor: help;
  border-bottom: 1px dotted #d93535;
  outline: none;
}
.service__error::after {
  content: attr(data-error);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  padding: 8px 10px;
  border: 1px solid #d8d8d8;
  border-radius: 4px;
  background: #fff;
  color: #333;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
.service__error::before {
  content: '';
  position: absolute;
  right: 8px;
  top: calc(100% + 3px);
  z-index: 21;
  display: none;
  width: 10px;
  height: 10px;
  border-left: 1px solid #d8d8d8;
  border-top: 1px solid #d8d8d8;
  background: #fff;
  transform: rotate(45deg);
}
.service__error:hover::after,
.service__error:hover::before,
.service__error:focus::after,
.service__error:focus::before {
  display: block;
}
.service__slow {
  font-size: 11px;
  color: #e69100;
  cursor: help;
  border-bottom: 1px dotted #e69100;
}

.history-link {
  margin-top: 40px;
  text-align: center;
  font-size: 13px;
}

/* ===== 历史 / 故障卡片 ===== */
.back-link { margin: 16px 0; font-size: 13px; }
.page-title { font-size: 20px; margin: 8px 0 24px; }

.month { margin-bottom: 36px; }
.month__title {
  font-size: 22px;
  font-weight: 400;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
  margin: 0 0 16px;
}

.incident-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-bottom: 16px;
  overflow: hidden;
}
.incident-card__title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 16px 4px;
}
.incident-card__title-row h3 { margin: 0; font-size: 16px; }
.incident-card__date {
  font-size: 12px;
  color: #999;
}
.incident-card__header {
  padding: 8px 16px;
  color: #fff;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.incident-card__severity {
  font-size: 12px;
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.incident-card__body { padding: 12px 16px; }
.incident-card--inline { margin-bottom: 12px; }

.incident-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}
.incident-table th, .incident-table td {
  text-align: left;
  padding: 8px 16px;
  border-bottom: 1px solid #f4f4f4;
  vertical-align: top;
}
.incident-table th {
  color: #888;
  font-weight: 500;
  width: 110px;
}

.incident-meta {
  display: flex;
  gap: 18px;
  font-size: 13px;
  color: #555;
}

/* ===== Timeline ===== */
.timeline {
  list-style: none;
  margin: 0;
  padding: 16px 0 0;
}
.timeline__item {
  display: flex;
  gap: 24px;
  padding: 10px 16px;
  border-top: 1px solid #f4f4f4;
}
.timeline__head {
  flex-shrink: 0;
  width: 200px;
  font-size: 12px;
}
.timeline__time { color: #999; display: block; }
.timeline__status { font-weight: 600; font-size: 11px; letter-spacing: 0.5px; }
.timeline__msg { margin: 0; font-size: 13px; color: #333; }

.timeline--admin { padding: 8px 0 0; }
.timeline--admin li { padding: 4px 0; font-size: 12px; }

/* ===== Admin ===== */
.admin .admin-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 4px;
  padding: 16px 20px;
  margin-bottom: 16px;
}
.admin h2 { font-size: 16px; margin: 0 0 12px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.form-grid label { display: flex; flex-direction: column; font-size: 12px; color: #555; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  font-family: inherit;
  font-size: 13px;
}
.form-grid button { grid-column: 1 / -1; }

.form-inline {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}
.form-inline input[type="text"] { flex: 1; padding: 6px 8px; border: 1px solid #d0d0d0; border-radius: 3px; }
.form-inline textarea { flex: 1; padding: 6px 8px; border: 1px solid #d0d0d0; border-radius: 3px; font-family: inherit; font-size: 13px; resize: vertical; }
.form-inline:has(textarea) { align-items: flex-start; }
.form-inline select { padding: 6px 8px; border: 1px solid #d0d0d0; border-radius: 3px; }

.btn {
  padding: 6px 14px;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #2d2d2d;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { background: #f5f5f5; }
.btn--primary { background: #1f75cb; color: #fff; border-color: #1f75cb; }
.btn--primary:hover { background: #1968a8; }
.btn--danger  { color: #d93535; border-color: #f3c2c2; }
.btn--danger:hover  { background: #fbe9e9; }

.admin-incident__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.admin-incident__head h3 { margin: 0; font-size: 15px; }

.empty-state {
  text-align: center;
  color: #888;
  padding: 60px 0;
  font-size: 13px;
}

/* ===== 服务管理表格 ===== */
.services-table input {
  width: 100%;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid #ddd;
  border-radius: 2px;
  font-family: inherit;
  box-sizing: border-box;
}
.services-table input:focus {
  outline: none;
  border-color: #1f75cb;
  background: #f8fbff;
}
.services-table td { padding: 6px 8px; vertical-align: middle; }
.services-table .btn { padding: 4px 10px; font-size: 12px; margin-right: 4px; }

/* ===== Login ===== */
.login-card {
  max-width: 400px;
  margin: 60px auto;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 32px 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.login-card__title {
  font-size: 20px;
  margin: 0 0 6px;
  text-align: center;
}
.login-card__sub {
  font-size: 13px;
  color: #888;
  text-align: center;
  margin: 0 0 24px;
}
.login-card__error {
  background: #fde7e7;
  border: 1px solid #f3c2c2;
  color: #a83232;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 14px;
}
.login-card form label {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  color: #555;
}
.login-card form label span {
  display: block;
  margin-bottom: 4px;
}
.login-card form input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 3px;
  font-size: 14px;
  font-family: inherit;
}
.login-card form input:focus {
  outline: none;
  border-color: #1f75cb;
  box-shadow: 0 0 0 3px rgba(31, 117, 203, 0.15);
}
.login-card__submit {
  width: 100%;
  padding: 9px;
  margin-top: 6px;
}

/* admin 顶部用户条 */
.admin-user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #777;
  padding: 8px 4px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 12px;
}
.admin-user-bar form { display: inline; margin: 0; }
.admin-user-bar button {
  background: none;
  border: none;
  color: #1f75cb;
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.admin-user-bar button:hover { text-decoration: underline; }

/* ===== Footer ===== */
.site-footer {
  margin-top: 60px;
  border-top: 1px solid #eee;
  background: #fff;
}
.site-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
}
.site-footer__links a { margin-left: 16px; }
.site-footer__contact {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 16px;
  font-size: 12px;
  color: #888;
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
}
.site-footer__beian {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 24px 16px;
  font-size: 12px;
  color: #999;
  text-align: center;
  border-top: 1px solid #f0f0f0;
}
.site-footer__beian a { color: #999; }
.site-footer__beian a:hover { color: #666; }
.site-footer__sep { margin: 0 8px; color: #ddd; }

@media (max-width: 720px) {
  .page-intro { padding: 0 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .timeline__head { width: 140px; }
}
