* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f3f4f6;
  color: #111827;
  font-size: 14px;
  line-height: 1.5;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.muted { color: #6b7280; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }

/* Topbar */
.topbar { background: #ffffff; border-bottom: 1px solid #e5e7eb; margin-bottom: 24px; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; }
.logo { font-weight: 600; text-decoration: none; color: #111827; font-size: 16px; }
.user { display: flex; align-items: center; gap: 14px; }

/* Buttons */
.btn {
  display: inline-block; padding: 8px 16px; border: 1px solid #d1d5db;
  background: #fff; border-radius: 6px; cursor: pointer; font-size: 14px;
  text-decoration: none; color: #111827; font-weight: 500;
}
.btn:hover { background: #f9fafb; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-ghost { background: transparent; }
.btn-link {
  background: none; border: none; color: #2563eb; cursor: pointer;
  font-size: 14px; padding: 0;
}
.btn-link:hover { text-decoration: underline; }

/* Card */
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 20px; margin-bottom: 16px;
}
.card h3 { margin-top: 0; margin-bottom: 12px; font-size: 15px; color: #374151; }

/* Login */
.login-wrap { max-width: 380px; margin: 60px auto; }
.login-card h1 { margin-top: 0; }
.login-card label { display: block; margin: 12px 0 6px; font-weight: 500; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db;
  border-radius: 6px; font-size: 14px;
}
.login-card input:focus { outline: none; border-color: #2563eb; }
.login-card .btn { width: 100%; margin-top: 16px; padding: 10px; }

.phone-input {
  display: flex;
  align-items: stretch;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.phone-input:focus-within { border-color: #2563eb; }
.phone-prefix {
  padding: 10px 12px;
  background: #f3f4f6;
  color: #6b7280;
  border-right: 1px solid #d1d5db;
  font-weight: 500;
  user-select: none;
}
.phone-input input {
  border: none !important;
  flex: 1;
  border-radius: 0 !important;
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  letter-spacing: 0.5px;
}
.phone-input input:focus { outline: none; }
.alert {
  background: #fee2e2; color: #991b1b; padding: 10px 12px;
  border-radius: 6px; margin-bottom: 12px; font-size: 13px;
}

/* Status tabs */
.status-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  padding: 8px 14px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 6px; text-decoration: none; color: #374151;
  font-size: 13px; display: inline-flex; gap: 6px; align-items: center;
}
.tab:hover { background: #f9fafb; }
.tab.active { background: #111827; color: #fff; border-color: #111827; }
.tab .cnt {
  background: rgba(0,0,0,0.08); padding: 1px 8px; border-radius: 10px; font-size: 12px;
}
.tab.active .cnt { background: rgba(255,255,255,0.2); }

/* Filters */
.filters {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
  background: #fff; padding: 12px; border-radius: 8px; border: 1px solid #e5e7eb;
}
.filters input {
  padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 13px; flex: 1; min-width: 140px;
}
.filters input:focus { outline: none; border-color: #2563eb; }

/* Table */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 10px 14px; text-align: left; border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
.table th { background: #f9fafb; font-size: 12px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #f9fafb; }
.table tbody tr:last-child td { border-bottom: none; }
.truncate {
  max-width: 350px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  color: #fff; font-size: 12px; font-weight: 500;
}

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination a {
  padding: 6px 12px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 6px; text-decoration: none; color: #374151; font-size: 13px;
}
.pagination a.active { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Empty */
.empty {
  background: #fff; padding: 60px 20px; border-radius: 8px;
  text-align: center; color: #6b7280; border: 1px dashed #d1d5db;
}

/* Detail */
.back {
  display: inline-block; margin-bottom: 16px; color: #2563eb;
  text-decoration: none; font-size: 13px;
}
.back:hover { text-decoration: underline; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .grid { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: #6b7280; font-size: 13px; }
.kv dd { margin: 0; }

.text-block { white-space: pre-wrap; line-height: 1.6; margin: 0; }

.status-form { display: flex; flex-direction: column; gap: 8px; }
.status-option {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: 6px; cursor: pointer;
}
.status-option:hover { background: #f9fafb; }
.status-option input { margin: 0; }
.status-form .btn { margin-top: 8px; align-self: flex-start; }
