/* IAconnects customer portal. System fonts only (the CSP allows no
   third-party origins); colours follow the AMS (webapp/css/style.css). */

:root {
  --bg: #f2f4f7;
  --panel: #ffffff;
  --text: #20202d;
  --text-secondary: #4a4a58;
  --muted: #6b6b6b;
  --border: #dddddd;
  --row-hover: rgba(32, 32, 45, 0.035);
  --header-bg: #20202d;
  --header-text: #ffffff;
  --accent: #0f6d66;
  --accent-hover: #2b7e78;
  --accent-soft: #e3f1ef;
  --error: #b42318;
  --error-soft: #fdecea;
  --success: #1e7b3c;
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.hidden { display: none !important; }

button, input, select { font: inherit; color: inherit; }

/* --- Header -------------------------------------------------------------- */

.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  flex-wrap: wrap;
}
.site-header .brand { display: flex; align-items: center; gap: 12px; }
.site-header .brand img { height: 26px; width: auto; }
.site-header .brand-name { font-weight: 600; font-size: 15px; }
.site-header .customer-name { color: #a3a3ad; }
.site-header nav { display: flex; gap: 4px; flex: 1; }
.site-header nav button {
  background: none; border: 0; color: #a3a3ad; padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.site-header nav button[aria-current="page"] { background: #323348; color: #fff; }
.site-header .account { display: flex; align-items: center; gap: 10px; color: #a3a3ad; margin-left: auto; }
.site-header .account .btn { background: transparent; color: #fff; border-color: #4a4a58; }

/* --- Layout -------------------------------------------------------------- */

main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.panel-header h2 { margin: 0; font-size: 16px; }
.subtle { color: var(--muted); }

.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tabs button {
  border: 1px solid var(--border); background: var(--panel); padding: 7px 14px; border-radius: 8px; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.filters { display: flex; gap: 10px; padding: 12px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.filters input, .filters select { min-width: 180px; }

input[type="text"], input[type="email"], input[type="search"], select {
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: #fff;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 7px 14px; cursor: pointer;
}
.btn:hover { background: var(--row-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.6; cursor: default; }

/* --- Tables -------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; background: #fafbfc; }
tbody tr:hover { background: var(--row-hover); }
td .secondary { display: block; color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.change-arrow { color: var(--muted); padding: 0 4px; }
.none { color: var(--muted); font-style: italic; }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; gap: 10px; }

/* --- Dialog -------------------------------------------------------------- */

dialog {
  border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(32, 32, 45, 0.45); }
.dialog-body { padding: 20px; }
.dialog-body h3 { margin: 0 0 4px; font-size: 17px; }
.field { display: block; margin-top: 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 4px; }
.field input, .field select { width: 100%; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.dialog-history { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.dialog-history h4 { margin: 0 0 6px; font-size: 13px; }
.dialog-history ul { list-style: none; margin: 0; padding: 0; max-height: 180px; overflow-y: auto; }
.dialog-history li { padding: 5px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px; }

.error {
  background: var(--error-soft); color: var(--error); border-radius: 8px; padding: 8px 12px; margin-top: 12px;
}
.notice {
  background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 10px 12px; margin-top: 12px;
}

/* --- Sign-in pages ------------------------------------------------------- */

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card {
  background: var(--panel); border-radius: 14px; padding: 28px; width: min(420px, 100%);
  box-shadow: 0 10px 40px rgba(32, 32, 45, 0.08);
}
.auth-card .logo { background: var(--header-bg); border-radius: 10px; padding: 12px 16px; margin-bottom: 20px; }
.auth-card .logo img { height: 28px; width: auto; display: block; }
.auth-card h1 { font-size: 20px; margin: 0 0 6px; }
.auth-card form { margin-top: 18px; }
.auth-card .btn-primary { width: 100%; margin-top: 14px; padding: 9px; }

@media (max-width: 640px) {
  .site-header .account .user-name { display: none; }
  .filters input, .filters select { min-width: 0; flex: 1 1 100%; }
  th:nth-child(2), td:nth-child(2) { display: none; }
}
