* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Segoe UI, Arial, sans-serif;
  background: #f5f7fa;
  color: #1a2744;
  line-height: 1.45;
}

a { color: #c9a84c; }

.site-header {
  background: #1a2744;
  color: #fff;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.site-header.sticky-header {
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  min-width: 0;
}

.brand-logo {
  height: 40px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-btn, .nav-link {
  background: transparent;
  border: 1px solid #c9a84c;
  color: #c9a84c;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
  min-height: 32px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.nav-btn:hover, .nav-link:hover {
  background: rgba(201, 168, 76, .15);
}

.nav-link.active {
  background: rgba(201, 168, 76, .25);
}

.sticky-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.status-strip {
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #dde3ec;
  flex-wrap: wrap;
  font-size: 12px;
}

.status-badge {
  font-size: 15px;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 4px;
  color: #fff;
  flex-shrink: 0;
}

.status-badge.pass { background: #2a7a2a; }
.status-badge.fail { background: #b00020; }

.meta-inline {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: #333;
}

.email-strip {
  padding: 5px 16px;
  border-bottom: 1px solid #dde3ec;
  font-size: 11px;
  color: #444;
  background: #fafbfc;
  line-height: 1.4;
}

.email-strip strong { color: #1a2744; }

.filters {
  padding: 6px 16px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #dde3ec;
  flex-wrap: wrap;
  align-items: center;
}

.filter-btn {
  background: #fff;
  color: #1a2744;
  border: 1px solid #1a2744;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  min-height: 30px;
}

.filter-btn.active {
  background: #1a2744;
  color: #c9a84c;
  border-color: #1a2744;
}

.filter-label {
  font-size: 11px;
  color: #555;
}

.type-select {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid #1a2744;
  border-radius: 3px;
  min-height: 30px;
  background: #fff;
  color: #1a2744;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th {
  background: #1a2744;
  color: #fff;
  padding: 8px 6px;
  text-align: left;
  font-size: 12px;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #243358; }
th .sort-arrow { font-size: 10px; margin-left: 4px; opacity: .7; }

tr.filter-row th {
  background: #eef1f6;
  color: #1a2744;
  padding: 3px 4px;
  font-weight: normal;
}

tr.filter-row input {
  width: 100%;
  padding: 4px 6px;
  font-size: 11px;
  border: 1px solid #ccc;
  border-radius: 3px;
}

td {
  padding: 6px;
  font-size: 12px;
  border-bottom: 1px solid #e8ecf1;
  vertical-align: top;
}

td.detail-cell { max-width: 420px; word-break: break-word; }
tr.row-even td { background: #f5f7fa; }
tr.row-odd td { background: #fff; }
tr.fail td { background: #fee !important; }
.passed-ok { color: #2a7a2a; font-weight: bold; }
.passed-bad { color: #b00020; font-weight: bold; }

.page-footer {
  padding: 8px 16px;
  color: #888;
  font-size: 11px;
  border-top: 1px solid #dde3ec;
  line-height: 1.5;
  background: #fff;
}

.page-footer .run-id { color: #aaa; font-size: 10px; }

.page-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.panel {
  background: #fff;
  border: 1px solid #dde3ec;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 16px;
  margin: 0 0 12px;
  border-bottom: 1px solid #dde3ec;
  padding-bottom: 6px;
}

.panel-sub {
  font-size: 14px;
  margin: 16px 0 8px;
  color: #1a2744;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 13px;
}

.check-row input[type=checkbox] {
  width: auto;
  margin: 0;
}

.field textarea {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #ccd4e0;
  border-radius: 4px;
  font-family: inherit;
  resize: vertical;
}

.list-editor input {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid #ccd4e0;
  border-radius: 4px;
}

.list-editor {
  margin: 8px 0 12px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

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

.field label {
  display: block;
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
}

.field input, .field select {
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  border: 1px solid #ccc;
  border-radius: 3px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.btn-primary {
  background: #1a2744;
  color: #c9a84c;
  border: 1px solid #c9a84c;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  min-height: 36px;
}

.btn-primary:hover { background: #243358; }
.btn-primary:disabled { opacity: .6; cursor: wait; }

.btn-secondary {
  background: #fff;
  color: #1a2744;
  border: 1px solid #1a2744;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  min-height: 36px;
}

.notify-bar {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-radius: 4px;
  font-size: 13px;
}

.notify-bar.on { background: #eef6ee; color: #1e5c1e; border: 1px solid #b8ddb8; }
.notify-bar.off { background: #fff8e6; color: #7a5a00; border: 1px solid #e8d49a; }

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
}

.doc-table th, .doc-table td {
  border: 1px solid #dde3ec;
  padding: 6px 8px;
  text-align: left;
}

.doc-table th { background: #1a2744; color: #fff; }

.recv-addr {
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  word-break: break-all;
}

.send-fail td { background: #fff5f5; }
.send-result.fail {
  color: #b00020;
  font-weight: 600;
  word-break: break-word;
}

.msg { font-size: 13px; margin: 8px 0; }
.msg.ok { color: #1e5c1e; }
.msg.err { color: #b00020; }

.login-page {
  margin: 0;
  font-family: Segoe UI, Arial, sans-serif;
  background: #1a2744;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  background: #fff;
  border-radius: 6px;
  padding: 28px 32px;
  width: 100%;
  max-width: 380px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-brand img {
  height: 48px;
  width: auto;
}

.login-brand h2 {
  margin: 0;
  color: #1a2744;
  font-size: 18px;
}

.login-card label {
  display: block;
  font-size: 13px;
  color: #555;
  margin: 0 0 4px;
}

.login-card input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 15px;
  margin-bottom: 12px;
}

.pw-wrap { position: relative; margin-bottom: 12px; }
.pw-wrap input { margin-bottom: 0; padding-right: 52px; }

.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #1a2744;
  font-size: 12px;
  cursor: pointer;
  padding: 8px;
  min-height: 44px;
  min-width: 44px;
}

.login-card button[type=submit] {
  width: 100%;
  background: #1a2744;
  color: #c9a84c;
  border: none;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
  min-height: 44px;
}

.login-card button[type=submit]:hover { background: #243358; }
.login-err { color: #b00020; font-size: 13px; margin: 0 0 12px; }
.login-hint { font-size: 13px; color: #555; margin: 0 0 16px; }
.login-methods { margin: 0 0 16px; }
.login-method {
  display: block;
  margin: 0 0 10px;
  font-size: 14px;
  cursor: pointer;
}
.login-method input { width: auto; margin: 0 8px 0 0; }
.btn-login-secondary {
  width: 100%;
  background: #fff;
  color: #1a2744;
  border: 1px solid #1a2744;
  padding: 10px;
  font-size: 14px;
  border-radius: 3px;
  cursor: pointer;
}
.btn-login-secondary:hover { background: #f4f6fa; }

@media (max-width: 768px) {
  .brand-title { font-size: 14px; max-width: 140px; }
  .brand-logo { height: 34px; }
  .meta-inline { flex-direction: column; gap: 2px; }
  .table-wrap { padding: 0 8px; overflow-x: visible; }
  table { min-width: 0; }
  table thead { display: none; }
  tr.filter-row { display: none; }
  table tbody tr {
    display: block;
    margin: 0 0 10px;
    border: 1px solid #dde3ec;
    border-radius: 6px;
    overflow: hidden;
  }
  table tbody td {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid #e8ecf1;
  }
  table tbody td:last-child { border-bottom: none; }
  table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #1a2744;
    flex: 0 0 38%;
    max-width: 38%;
  }
  table tbody td.detail-cell { text-align: right; max-width: none; }
  .btn-row .btn-primary, .btn-row .btn-secondary { flex: 1 1 calc(50% - 4px); }
}
