/* glomotec portal stylesheet v2
   Brand canon: Navy #2B3E8F -> Cyan #00A2E9, Inter, arctic palette.
   No em dashes anywhere. Module names always uppercase.
   v2: avatar image support, admin row avatars.
*/

:root {
  --deep-navy: #2B3E8F;
  --bright-cyan: #00A2E9;
  --dark-navy: #1A1A2E;
  --ink: #1E293B;
  --charcoal: #334155;
  --slate: #64748B;
  --silver: #94A3B8;
  --frost: #B8D4E3;
  --glacier: #D0E8F2;
  --ice-blue: #E8F4FA;
  --cloud-grey: #F5F7FA;
  --white: #FFFFFF;
  --success: #047857;
  --warning: #B45309;
  --danger: #B91C1C;
  --gradient: linear-gradient(135deg, #2B3E8F 0%, #00A2E9 100%);
  --gradient-h: linear-gradient(90deg, #2B3E8F 0%, #00A2E9 100%);
  --max: 1280px;
  --gutter: 32px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 1px 2px rgba(15, 23, 42, 0.06), 0 16px 40px rgba(43, 62, 143, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cloud-grey);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--deep-navy); text-decoration: none; }
a:hover { color: var(--bright-cyan); }
button { font-family: inherit; cursor: pointer; }

.atm-shell {
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: radial-gradient(ellipse at top, var(--ice-blue) 0%, var(--cloud-grey) 55%, var(--cloud-grey) 100%);
  overflow: hidden;
}
.atm-shell::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(184, 212, 227, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(184, 212, 227, 0.16) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
}
.atm-shell::after {
  content: '';
  position: absolute; top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0, 162, 233, 0.10) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--white);
  border: 1px solid var(--glacier);
  border-radius: 14px;
  padding: 44px 40px 36px;
  box-shadow: var(--shadow-card);
}
.auth-card.wide { max-width: 560px; }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-logo { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 24px; }
.auth-logo img { height: 36px; width: auto; display: block; }
.auth-logo .tm { font-size: 11px; font-weight: 500; color: var(--slate); align-self: flex-start; margin-top: 5px; }
.auth-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--slate); margin: 0 0 8px; }
.auth-eyebrow .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--bright-cyan); margin-right: 8px; vertical-align: 2px; }
.auth-title { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; color: var(--ink); }
.auth-sub { font-size: 14px; color: var(--slate); margin: 0; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--glacier); margin: 0 0 24px; }
.tab { flex: 1; background: none; border: none; padding: 12px 0; font-size: 14px; font-weight: 500; color: var(--slate); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.2s, border-color 0.2s; }
.tab.active { color: var(--ink); border-bottom-color: var(--deep-navy); }
.tab:hover { color: var(--ink); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--charcoal); margin-bottom: 6px; }
.field-input, .field-select { display: block; width: 100%; padding: 11px 14px; font-size: 14px; font-family: inherit; color: var(--ink); background: var(--white); border: 1px solid var(--frost); border-radius: 8px; transition: border-color 0.15s, box-shadow 0.15s; }
.field-input:focus, .field-select:focus { outline: none; border-color: var(--bright-cyan); box-shadow: 0 0 0 3px rgba(0, 162, 233, 0.12); }
.field-input:disabled, .field-input[readonly] { background: var(--cloud-grey); color: var(--slate); }
.field-hint { font-size: 12px; color: var(--slate); margin: 6px 0 0; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; font-size: 14px; font-weight: 600; letter-spacing: 0.01em; border-radius: 8px; border: 1px solid transparent; transition: all 0.2s var(--ease); text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--deep-navy); }
.btn-gradient { background: var(--gradient-h); color: var(--white); }
.btn-gradient:hover:not(:disabled) { box-shadow: 0 6px 20px rgba(43, 62, 143, 0.25); }
.btn-secondary { background: var(--white); color: var(--ink); border-color: var(--frost); }
.btn-secondary:hover:not(:disabled) { background: var(--ice-blue); border-color: var(--bright-cyan); }
.btn-ghost { background: none; color: var(--slate); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { color: var(--ink); background: var(--ice-blue); }
.btn-danger { background: var(--white); color: var(--danger); border-color: var(--frost); }
.btn-danger:hover:not(:disabled) { background: #FEF2F2; border-color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12px; }

.oauth-stack { display: flex; flex-direction: column; gap: 8px; }
.btn-oauth { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 16px; font-size: 14px; font-weight: 500; background: var(--white); color: var(--ink); border: 1px solid var(--frost); border-radius: 8px; width: 100%; transition: all 0.15s var(--ease); }
.btn-oauth:hover:not(:disabled) { background: var(--ice-blue); border-color: var(--bright-cyan); }
.btn-oauth svg, .btn-oauth img { width: 18px; height: 18px; display: block; flex-shrink: 0; }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--silver); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--glacier); }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; line-height: 1.5; margin-bottom: 16px; border: 1px solid; }
.alert-error { background: #FEF2F2; border-color: #FECACA; color: var(--danger); }
.alert-success { background: #ECFDF5; border-color: #A7F3D0; color: var(--success); }
.alert-info { background: var(--ice-blue); border-color: var(--frost); color: var(--charcoal); }
.alert-warning { background: #FFFBEB; border-color: #FDE68A; color: var(--warning); }
.alert.hidden { display: none; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 999px; border: 1px solid transparent; }
.pill-pending  { background: #FFFBEB; border-color: #FDE68A; color: var(--warning); }
.pill-active   { background: #ECFDF5; border-color: #A7F3D0; color: var(--success); }
.pill-suspended{ background: #FEF2F2; border-color: #FECACA; color: var(--danger); }
.pill-admin    { background: var(--ice-blue); border-color: var(--frost); color: var(--deep-navy); }
.pill-internal { background: #EDE9FE; border-color: #DDD6FE; color: #5B21B6; }
.pill-client   { background: var(--cloud-grey); border-color: var(--glacier); color: var(--charcoal); }
.pill-live     { background: var(--ice-blue); border-color: var(--bright-cyan); color: var(--deep-navy); }
.pill-dev      { background: var(--cloud-grey); border-color: var(--glacier); color: var(--slate); }
.pill-locked   { background: #F5F5F4; border-color: #E7E5E4; color: var(--slate); }
.pill .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.muted { color: var(--slate); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-nav { background: var(--white); border-bottom: 1px solid var(--glacier); position: sticky; top: 0; z-index: 50; }
.app-nav-inner { max-width: var(--max); margin: 0 auto; padding: 14px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.app-logo { display: flex; align-items: center; gap: 4px; }
.app-logo img { height: 32px; width: auto; display: block; }
.app-logo .tm { font-size: 10px; color: var(--slate); align-self: flex-start; margin-top: 4px; font-weight: 500; }
.app-nav-links { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.app-nav-links a { color: var(--charcoal); font-weight: 500; transition: color 0.15s; }
.app-nav-links a:hover, .app-nav-links a.active { color: var(--deep-navy); }

.user-menu { position: relative; }
.user-menu-trigger { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid var(--glacier); padding: 6px 12px 6px 6px; border-radius: 999px; transition: border-color 0.15s, background 0.15s; }
.user-menu-trigger:hover { background: var(--ice-blue); border-color: var(--frost); }

/* Avatar component: image or fallback initials */
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gradient-h);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.user-avatar.fallback { /* gradient bg visible because no img */ }
.row-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gradient-h);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}
.row-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.user-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.user-menu-panel { position: absolute; top: calc(100% + 8px); right: 0; background: var(--white); border: 1px solid var(--glacier); border-radius: 10px; box-shadow: var(--shadow-hover); min-width: 240px; padding: 8px; z-index: 60; display: none; }
.user-menu-panel.open { display: block; }
.user-menu-info { padding: 12px 12px 10px; border-bottom: 1px solid var(--glacier); margin-bottom: 6px; }
.user-menu-info .um-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-menu-info .um-email { font-size: 12px; color: var(--slate); margin-top: 2px; }
.user-menu-info .um-pills { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.user-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; background: none; border: none; font-size: 13px; color: var(--charcoal); border-radius: 6px; text-align: left; }
.user-menu-item:hover { background: var(--ice-blue); color: var(--ink); }
.user-menu-item.danger { color: var(--danger); }
.user-menu-item.danger:hover { background: #FEF2F2; }

.app-body { flex: 1; max-width: var(--max); width: 100%; margin: 0 auto; padding: 40px var(--gutter) 80px; }
.app-hero { margin-bottom: 32px; }
.app-hero .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--slate); display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.app-hero .eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--bright-cyan); display: inline-block; }
.app-hero h1 { font-size: clamp(28px, 3vw, 38px); font-weight: 600; letter-spacing: -0.015em; margin: 0 0 8px; color: var(--ink); }
.app-hero p { font-size: 15px; color: var(--slate); margin: 0; max-width: 640px; }

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.module-card { position: relative; background: var(--white); border: 1px solid var(--glacier); border-radius: 12px; padding: 24px; display: flex; flex-direction: column; gap: 14px; transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s; }
.module-card.live:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--frost); }
.module-card.locked { background: var(--cloud-grey); }
.module-card.locked .module-name { color: var(--slate); }
.module-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.module-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--ice-blue); border: 1px solid var(--frost); display: flex; align-items: center; justify-content: center; color: var(--deep-navy); flex-shrink: 0; }
.module-card.locked .module-icon { background: var(--white); color: var(--silver); }
.module-name { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; color: var(--ink); margin: 0; }
.module-tagline { font-size: 13px; color: var(--slate); line-height: 1.5; margin: 0; flex: 1; }
.module-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.module-cta { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--deep-navy); background: none; border: none; padding: 0; transition: gap 0.2s var(--ease), color 0.2s; }
.module-cta:hover { color: var(--bright-cyan); gap: 10px; }
.module-cta:disabled { color: var(--silver); cursor: not-allowed; }

.section-block { background: var(--white); border: 1px solid var(--glacier); border-radius: 12px; overflow: hidden; }
.section-block-head { padding: 18px 22px; border-bottom: 1px solid var(--glacier); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.section-block-head h2 { font-size: 15px; font-weight: 600; margin: 0; color: var(--ink); }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pill { padding: 5px 11px; font-size: 12px; font-weight: 500; background: var(--white); border: 1px solid var(--frost); border-radius: 999px; color: var(--charcoal); transition: all 0.15s; }
.filter-pill:hover { background: var(--ice-blue); }
.filter-pill.active { background: var(--ink); color: var(--white); border-color: var(--ink); }

.user-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.user-table th, .user-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--glacier); vertical-align: middle; }
.user-table th { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--slate); background: var(--cloud-grey); }
.user-table tbody tr:hover { background: var(--cloud-grey); }
.user-table td.actions { text-align: right; white-space: nowrap; }
.user-table td.actions .btn { margin-left: 6px; }
.user-table .user-cell { display: flex; gap: 12px; align-items: center; }
.user-table .name-cell { font-weight: 500; color: var(--ink); }
.user-table .email-cell { color: var(--slate); font-size: 12px; }
.user-table select.field-select { padding: 5px 10px; font-size: 12px; width: auto; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--slate); font-size: 14px; }

@media (max-width: 640px) {
  .auth-card { padding: 32px 24px; border-radius: 10px; }
  .auth-title { font-size: 22px; }
  .app-nav-inner { padding: 12px 20px; }
  .app-nav-links { display: none; }
  .app-body { padding: 28px 20px 60px; }
  .field-row { flex-direction: column; gap: 0; }
  .user-table th:nth-child(3), .user-table td:nth-child(3) { display: none; }
  .module-grid { grid-template-columns: 1fr; }
  .user-name { display: none; }
}

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.veil { position: fixed; inset: 0; background: var(--cloud-grey); display: flex; align-items: center; justify-content: center; z-index: 9999; transition: opacity 0.25s ease; }
.veil.hidden { opacity: 0; pointer-events: none; }
.veil-content { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--slate); font-size: 13px; }
