/* TMS Hub — global stylesheet */

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a { color: inherit; }

/* ── Tokens ─────────────────────────────────────────────────────────────────── */
:root {
  --teal:         #1B7A7A;
  --teal-light:   #e8f5f5;
  --teal-dark:    #155f5f;
  --hub-teal:     #0D9488;
  --hub-light:    #f0fdfc;
  --hub-hover:    #ccfbf1;
  --amber:        #F59E0B;
  --bg:           #f5f5f5;
  --white:        #ffffff;
  --text:         #1f2937;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --nav-width:    260px;
  --topbar-h:     56px;
}

/* ── Base ───────────────────────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-top: var(--topbar-h);
}

/* ── Top bar ────────────────────────────────────────────────────────────────── */
.tms-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  gap: 10px;
}

.tms-topbar__title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  color: var(--teal);
  letter-spacing: -0.01em;
}

.tms-topbar__agency {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Hamburger ──────────────────────────────────────────────────────────────── */
.tms-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s;
  flex-shrink: 0;
}

.tms-hamburger:hover { background: var(--teal-light); }

.tms-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--teal);
  border-radius: 2px;
}

/* ── Nav overlay ────────────────────────────────────────────────────────────── */
.tms-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.tms-nav-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Nav panel ──────────────────────────────────────────────────────────────── */
.tms-nav-panel {
  position: fixed;
  top: 0; left: 0;
  width: var(--nav-width);
  height: 100vh;
  background: var(--white);
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 4px 0 20px rgba(0,0,0,0.12);
}

.tms-nav-panel--open {
  transform: translateX(0);
}

/* Nav header */
.tms-nav-header {
  background: var(--teal);
  padding: 16px;
  flex-shrink: 0;
}

.tms-nav-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.tms-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tms-nav-title {
  font-size: 15px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.01em;
}

.tms-nav-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.tms-nav-close:hover { background: rgba(255,255,255,0.28); }

.tms-nav-agency {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tms-nav-agency-name {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.92);
}

/* Nav body */
.tms-nav-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 4px;
}

.tms-nav-section { margin-bottom: 2px; }

.tms-nav-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 16px 4px;
}

.tms-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.1s;
  gap: 8px;
}

.tms-nav-item:hover { background: var(--bg); }

.tms-nav-item--active {
  background: var(--teal-light);
  border-left-color: var(--teal);
  color: var(--teal-dark);
  font-weight: 600;
}

.tms-nav-item--hub {
  background: var(--hub-light);
  border-left-color: var(--hub-teal);
}

.tms-nav-item--hub:hover { background: var(--hub-hover); }

.tms-nav-item--active.tms-nav-item--hub {
  background: var(--hub-hover);
  border-left-color: var(--hub-teal);
  color: #0f766e;
}

/* Nav footer */
.tms-nav-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.tms-btn-logout {
  width: 100%;
  padding: 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
}

.tms-btn-logout:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fef2f2;
}

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.tms-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.tms-badge--pro        { background: var(--amber);    color: white; }
.tms-badge--hub        { background: var(--hub-teal); color: white; }
.tms-badge--free       { background: var(--text-muted); color: white; }
.tms-badge--operator   { background: var(--teal);     color: white; }
.tms-badge--consortia  { background: #7c3aed;         color: white; }

/* ── Main content ───────────────────────────────────────────────────────────── */
.tms-main {
  padding: 28px 20px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.tms-page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.tms-page-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── Welcome banner ─────────────────────────────────────────────────────────── */
.tms-welcome {
  background: linear-gradient(135deg, var(--teal) 0%, var(--hub-teal) 100%);
  color: white;
  border-radius: 14px;
  padding: 28px 32px;
  margin-bottom: 28px;
}

.tms-welcome__greeting {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.tms-welcome__sub {
  font-size: 14px;
  opacity: 0.82;
}

/* ── Module tiles ───────────────────────────────────────────────────────────── */
.tms-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.tms-tile {
  background: var(--white);
  border-radius: 14px;
  padding: 28px 24px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.tms-tile:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.tms-tile__icon {
  width: 52px;
  height: 52px;
  background: var(--teal-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal);
}

.tms-tile__label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tms-tile__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.tms-tile__desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  flex: 1;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.tms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  align-self: flex-start;
}

.tms-btn--primary {
  background: var(--teal);
  color: white;
}

.tms-btn--primary:hover { background: var(--teal-dark); }

.tms-btn--outline {
  background: none;
  border: 2px solid var(--teal);
  color: var(--teal);
}

.tms-btn--outline:hover { background: var(--teal-light); }

/* ── Notice bar ─────────────────────────────────────────────────────────────── */
.tms-notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  color: #92400e;
}

/* ── Module placeholder ─────────────────────────────────────────────────────── */
.tms-module-placeholder {
  background: var(--white);
  border-radius: 14px;
  padding: 60px 40px;
  text-align: center;
  border: 2px dashed var(--border);
  color: var(--text-muted);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.tms-module-placeholder svg { opacity: 0.3; }

.tms-module-placeholder p { font-size: 14px; max-width: 360px; line-height: 1.5; }

/* ── Coming-soon / centred pages ────────────────────────────────────────────── */
.tms-centered-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.tms-centered-card {
  background: var(--white);
  border-radius: 18px;
  padding: 52px 44px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.tms-centered-card .tms-logo-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--teal-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  color: var(--teal);
}

.tms-centered-card h1 {
  font-size: 23px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.3;
}

.tms-centered-card p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 32px;
}

/* ── Upgrade modal + tooltip (injected by tms-nav.js on all pages) ───────────── */
#tms-upgrade-modal   { display: none; }
#tms-upgrade-tooltip { display: none; }

.tms-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tms-modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  z-index: 9999;
}

.tms-upgrade-tooltip {
  display: none;
  position: fixed;
  background: #1e293b;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.4;
  max-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 9999;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.15s;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .tms-main      { padding: 20px 16px 32px; }
  .tms-tiles     { grid-template-columns: 1fr; }
  .tms-welcome   { padding: 22px 20px; }
  .tms-topbar__agency { display: none; }
  .tms-centered-card  { padding: 36px 24px; }
}
