* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f4f6f8;
  color: #1d2a33;
}

a { color: #0d6efd; text-decoration: none; }
a:hover { text-decoration: underline; }

header.app-header {
  background: #12344d;
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
}

header.app-header h1 { font-size: 18px; margin: 0; }

nav.app-nav {
  display: flex;
  gap: 4px;
}

nav.app-nav a {
  color: #c9dbe9;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
}

nav.app-nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.session-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #c9dbe9;
}

.session-bar button {
  background: #1f4e72;
  color: #fff;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

main {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 16px;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 12px;
}

.page-title h2 { margin: 0; font-size: 22px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-card {
  background: #fff;
  border: 1px solid #d8e0e6;
  border-radius: 8px;
  padding: 14px 16px;
}

.summary-card .label {
  font-size: 12px;
  color: #5c7080;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-card .value {
  font-size: 28px;
  font-weight: 600;
  margin-top: 4px;
}

.card {
  background: #fff;
  border: 1px solid #d8e0e6;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h3 { margin-top: 0; font-size: 16px; }

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar input[type=search] {
  flex: 1 1 240px;
}

input, textarea, select {
  width: 100%;
  border: 1px solid #b5c4cf;
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 14px;
}

label {
  display: block;
  margin: 6px 0 4px;
  font-weight: 600;
  font-size: 13px;
}

button {
  background: #0d6efd;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
}

button:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

button.secondary { background: #5c7080; }
button.danger { background: #c0392b; }
button.ghost {
  background: transparent;
  color: #0d6efd;
  border: 1px solid #b5c4cf;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}

table th, table td {
  border-bottom: 1px solid #e5ebf0;
  padding: 9px 12px;
  text-align: left;
}

table th {
  background: #f0f4f7;
  font-weight: 600;
  color: #2b3d49;
  position: sticky;
  top: 50px;
}

table tbody tr:hover {
  background: #fafcfd;
  cursor: pointer;
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #5c7080;
}

.muted { color: #7a8893; }
.text-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge.green  { background: #e3f6ec; color: #14784a; }
.badge.amber  { background: #fff4d6; color: #8a5a00; }
.badge.red    { background: #fde4e0; color: #a4271a; }
.badge.gray   { background: #ecf0f3; color: #5c7080; }
.badge.blue   { background: #e1efff; color: #0a4a9e; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #1d2a33;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.15s, transform 0.15s;
  pointer-events: none;
  z-index: 50;
}

.toast.visible { opacity: 1; transform: translateY(0); }
.toast.danger { background: #7a1d12; }

.row-actions {
  display: inline-flex;
  gap: 6px;
}

.row-actions button {
  padding: 4px 8px;
  font-size: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 6px 14px;
  font-size: 14px;
}

.detail-grid dt {
  color: #5c7080;
  font-weight: 600;
}

.detail-grid dd {
  margin: 0;
  word-break: break-all;
}

.section-divider {
  height: 1px;
  background: #e5ebf0;
  margin: 14px 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 30;
}

.modal {
  background: #fff;
  border-radius: 8px;
  padding: 18px 20px;
  max-width: 440px;
  width: calc(100% - 40px);
}

.modal h3 { margin-top: 0; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.login-shell {
  max-width: 380px;
  margin: 64px auto;
}

.login-shell .card { padding: 24px; }

.error-banner {
  background: #fde4e0;
  color: #a4271a;
  border: 1px solid #f4baae;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.subtle-banner {
  background: #f0f4f7;
  color: #5c7080;
  border: 1px dashed #c0ccd5;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #c0ccd5;
  border-top-color: #0d6efd;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Phase 6: 활동 로그 필터 행 */
.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 12px 4px;
}
.filter-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-soft, #6b5f4f);
}
.filter-row input,
.filter-row select {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line, rgba(43,38,32,0.12));
  background: var(--bg-elev, #fff);
  font-size: 13px;
  min-width: 140px;
}
.filter-row button {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line, rgba(43,38,32,0.12));
  background: var(--bg-elev, #fff);
  cursor: pointer;
  font-size: 13px;
}
.filter-row button.primary {
  background: var(--accent-deep, #2c4a78);
  color: #fff;
  border-color: transparent;
}
