/* Shared design system for the Connect Admin app.
   Palette/spacing approximate the Amazon Connect admin console (Cloudscape). */
:root {
  --color-navy-900: #0f1b2e;
  --color-navy-800: #16273f;
  --color-navy-700: #1c3350;
  --color-blue-600: #0972d3;
  --color-blue-700: #075a9e;
  --color-red-600: #d13212;
  --color-green-600: #037f51;
  --color-text: #16191f;
  --color-text-muted: #5f6b7a;
  --color-border: #d5dbdb;
  --color-bg: #f2f3f3;
  --color-surface: #ffffff;
  --color-badge: #16191f;
  --radius-md: 8px;
  --radius-pill: 20px;
  --sidebar-width: 64px;
  --topbar-height: 56px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--color-text);
  background: var(--color-bg);
}

a { color: var(--color-blue-600); }

/* ---- top bar ---- */
.topbar {
  height: var(--topbar-height);
  background: var(--color-navy-900);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-brand { display: flex; align-items: center; gap: 0.65rem; font-size: 1.05rem; font-weight: 600; }
.brand-mark-img { width: 26px; height: 26px; border-radius: 6px; display: block; }
.brand-powered {
  font-size: 0.7rem; font-weight: 400; color: #9fb3c8;
  margin-left: 0.4rem; padding-left: 0.75rem; border-left: 1px solid rgba(255,255,255,0.18);
}
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.icon-btn { background: none; border: none; color: #cdd6e0; font-size: 1.1rem; cursor: pointer; padding: 0.25rem; }
.icon-btn:hover { color: #fff; }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.sidebar-icon svg { width: 20px; height: 20px; display: block; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--color-blue-600);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 600;
}

/* ---- shell layout: sidebar + content ---- */
.shell-body { display: flex; min-height: calc(100vh - var(--topbar-height)); }

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-navy-900);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 0.75rem;
  gap: 0.35rem;
}
.sidebar-item {
  width: 48px; height: 48px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: #9fb3c8;
  text-decoration: none;
  font-size: 1.15rem;
  transition: background 0.12s, color 0.12s;
}
.sidebar-item:hover { background: var(--color-navy-700); color: #fff; }
.sidebar-item.active { background: #fff; color: var(--color-navy-900); }
.sidebar-icon { line-height: 1; }
.sidebar-label { display: none; }

main.content { flex: 1; padding: 1.5rem 2rem; max-width: 1280px; }

/* ---- page header ---- */
.page-title { margin: 0 0 0.35rem; font-size: 1.5rem; font-weight: 700; }
.page-desc { margin: 0 0 1.25rem; color: var(--color-text-muted); font-size: 0.92rem; max-width: 900px; }

/* ---- card ---- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(15, 27, 46, 0.06);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.card-header h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.card-header h2 .count { color: var(--color-text-muted); font-weight: 400; }
.card-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---- toolbar / search ---- */
.toolbar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 240px; }
.search-box input {
  width: 100%; padding: 0.55rem 0.75rem 0.55rem 2.1rem; border: 1px solid var(--color-border);
  border-radius: 6px; font-size: 0.9rem;
}
.search-box::before {
  content: "🔍"; position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%);
  font-size: 0.85rem; opacity: 0.55;
}
.hint { font-size: 0.8rem; color: var(--color-text-muted); margin: 0.15rem 0 1rem; }

/* ---- buttons ---- */
button, .btn {
  font: inherit;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-blue-600);
  background: #fff;
  color: var(--color-blue-600);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.06s ease;
}
button:active:not(:disabled) { transform: scale(0.98); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--color-blue-600);
  outline-offset: 2px;
}
.sidebar-item:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
button:hover:not(:disabled) { background: #f0f8ff; }
button.primary { background: var(--color-blue-600); color: #fff; }
button.primary:hover:not(:disabled) { background: var(--color-blue-700); }
button.danger { border-color: var(--color-red-600); color: var(--color-red-600); }
button.danger:hover:not(:disabled) { background: #fdf1ee; }
button.subtle { border-color: var(--color-border); color: var(--color-text); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.row-actions button { padding: 0.3rem 0.6rem; font-size: 0.78rem; margin-right: 0.35rem; border-radius: 6px; }

/* ---- table ---- */
table { border-collapse: collapse; width: 100%; margin-top: 0.75rem; font-size: 0.88rem; }
th, td { border-bottom: 1px solid #eceff1; padding: 0.65rem 0.5rem; text-align: left; vertical-align: top; }
th { color: var(--color-text-muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: #fafbfc; }

.truncate {
  display: block; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
textarea.prompt-textarea {
  width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--color-border); border-radius: 6px;
  box-sizing: border-box; font-size: 0.85rem; font-family: inherit; resize: vertical; min-height: 4.5em;
}

/* ---- badges / chips ---- */
.badge {
  display: inline-block; background: var(--color-badge); color: #fff; border-radius: 4px;
  padding: 2px 8px; margin: 1px 2px 1px 0; font-size: 0.72rem; font-weight: 600;
}
.chip {
  display: inline-block; background: #eef2f7; color: var(--color-text); border-radius: 4px;
  padding: 2px 7px; margin: 1px 2px 1px 0; font-size: 0.72rem;
}
.pill-enabled { color: var(--color-green-600); font-weight: 600; }
.pill-disabled { color: var(--color-text-muted); }

/* ---- status / empty state ---- */
.status-line { color: var(--color-text-muted); margin: 0.35rem 0 0.75rem; font-size: 0.85rem; min-height: 1.1em; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--color-text-muted); }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 27, 46, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; border-radius: var(--radius-md); padding: 1.5rem;
  width: 460px; max-width: 92vw; max-height: 85vh; overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  animation: modal-in 0.15s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal h2 { margin-top: 0; font-size: 1.1rem; }
.field { margin-bottom: 0.85rem; }
.field label { display: block; font-size: 0.83rem; margin-bottom: 0.3rem; color: #444; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--color-border); border-radius: 6px;
  box-sizing: border-box; font-size: 0.9rem;
}
.field input:focus, .field select:focus { outline: 2px solid var(--color-blue-600); outline-offset: 1px; }
.checkbox-list { border: 1px solid var(--color-border); border-radius: 6px; padding: 0.5rem; max-height: 150px; overflow-y: auto; }
.checkbox-list label { display: block; font-size: 0.85rem; font-weight: normal; margin: 0.2rem 0; }
.day-row { display: grid; grid-template-columns: 26px 100px 1fr 1fr; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid #f2f2f2; }
.day-row label { font-size: 0.85rem; font-weight: normal; }
.day-row input[type="time"] { padding: 0.35rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }

/* ---- toast ---- */
.toast-stack {
  position: fixed; top: 1rem; right: 1rem; z-index: 200;
  display: flex; flex-direction: column; gap: 0.5rem; width: 320px; max-width: 90vw;
}
.toast {
  border-radius: 8px; padding: 0.75rem 1rem; font-size: 0.87rem; color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18); animation: toast-in 0.15s ease-out;
}
.toast.success { background: var(--color-green-600); }
.toast.error { background: var(--color-red-600); }
.toast.info { background: var(--color-navy-800); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ---- auth / login page ---- */
body.auth-page {
  background: radial-gradient(circle at top, var(--color-navy-800) 0%, var(--color-navy-900) 65%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.auth-card {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 2.25rem 2rem;
  width: 380px;
  max-width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  text-align: center;
  animation: modal-in 0.2s ease-out;
}
.auth-logo { width: 56px; height: 56px; border-radius: 12px; margin-bottom: 0.9rem; }
.auth-title { margin: 0 0 0.15rem; font-size: 1.3rem; font-weight: 700; }
.auth-subtitle { margin: 0 0 1.75rem; font-size: 0.8rem; color: var(--color-text-muted); }
.auth-form { text-align: left; }
.auth-form button[type="submit"] { width: 100%; margin-top: 0.4rem; padding: 0.65rem; }
.auth-hint { font-size: 0.82rem; color: var(--color-text-muted); margin: 0 0 1rem; text-align: left; }
.code-input {
  text-align: center; font-size: 1.4rem; letter-spacing: 0.5em; font-weight: 700;
  padding-left: 0.7em !important;
}
.auth-back { background: none; border: none; color: var(--color-blue-600); font-size: 0.82rem; padding: 0.5rem 0; margin-top: 0.25rem; text-decoration: underline; }
.auth-back:hover { background: none; }
