* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f7fa;
  color: #333;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  background: #fff;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.header h1 { font-size: 20px; margin-bottom: 6px; }
.header p { color: #888; font-size: 13px; }

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab {
  border: none;
  background: #fff;
  color: #333;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.tab:hover {
  color: #1a73e8;
}

.tab.active {
  background: #1a73e8;
  color: #fff;
}

.panel {
  display: none;
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.panel.active { display: block; }

.panel h2 {
  font-size: 16px;
  margin-bottom: 16px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

input, select, textarea {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}

button {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  background: #1a73e8;
  color: #fff;
}

button.secondary { background: #6c757d; }
button.danger { background: #dc3545; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  border-bottom: 1px solid #eee;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th { background: #fafafa; font-weight: 600; }

.msg-content {
  max-width: 320px;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg-image-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.msg-content .msg-thumb {
  display: block;
  max-width: 160px;
  max-height: 120px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 6px;
  background: #f0f0f0;
  cursor: pointer;
  object-fit: cover;
}

.msg-content .msg-thumb.is-broken {
  display: none;
}

.msg-content .msg-img-link {
  font-size: 12px;
  color: #1a73e8;
  word-break: break-all;
}

.msg-content .msg-img-raw {
  font-size: 11px;
  color: #999;
}

.message-table-wrap {
  overflow-x: auto;
}

.message-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.message-pager-actions {
  display: flex;
  gap: 8px;
}

.page-info {
  font-size: 13px;
  color: #666;
  min-height: 20px;
}

.page-info.is-loading {
  color: #999;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.form-item label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.form-item input, .form-item select {
  width: 100%;
}

.tip {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
}

.alert {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 12px;
}

.alert.error { background: #fdecea; color: #c62828; }
.alert.success { background: #e8f5e9; color: #2e7d32; }

.online-badge {
  display: inline-block;
  background: #e3f2fd;
  color: #1565c0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
}

.empty {
  text-align: center;
  color: #999;
  padding: 24px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.section-subtitle {
  font-size: 14px;
  margin: 24px 0 12px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.user-id-link {
  color: #1a73e8;
  cursor: pointer;
  text-decoration: underline;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 10px;
  padding: 32px 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 6px;
  text-align: center;
}

.login-subtitle {
  text-align: center;
  color: #888;
  font-size: 13px;
  margin-bottom: 24px;
}

.login-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  font-size: 14px;
}
