:root {
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e4e2dc;
  --bg: #f3f1ec;
  --accent: #16181d;
  --accent-dark: #000;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15px; }

body.portal {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* Brand block: company logo above the system title */
.brand-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
}
.brand-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.1rem;
  border-radius: 0.9rem;
}
.brand-plate[style] { padding: 0.9rem 1.4rem; }
.brand-logo {
  display: block;
  width: auto;
  max-width: min(260px, 70vw);
  object-fit: contain;
}
.ctms-title {
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.3;
  max-width: 24ch;
}
.ctms-company {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Sign in */
body.signin {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-top: 6px solid var(--accent);
  border-radius: 1.1rem;
  padding: 2.2rem 1.9rem 1.6rem;
  box-shadow: 0 12px 34px rgba(22, 24, 29, 0.07);
}
.signin-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1.7rem;
}
.signin-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.signin-form input {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #fff;
  min-width: 0;
}
.signin-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.form-error {
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 0.6rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.88rem;
}
.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border-radius: 0.6rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  margin-top: 0.3rem;
}
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.ghost { padding: 0.45rem 0.8rem; font-size: 0.85rem; }
.btn.ghost:hover { border-color: var(--ink); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.fine {
  margin-top: 1.4rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

/* Set password */
.setup-intro { margin-top: 1.6rem; text-align: center; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.setup-title { color: var(--ink); font-weight: 700; font-size: 1.05rem; margin-bottom: 0.25rem; }
.setup-intro + .signin-form { margin-top: 1.2rem; }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; padding-right: 2.9rem; }
.eye {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.eye:hover { color: var(--ink); background: #f1efea; }
.eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.eye .eye-closed { display: none; }
.eye.on .eye-open { display: none; }
.eye.on .eye-closed { display: block; }
.hint { color: var(--muted); font-size: 0.8rem; margin-top: -0.3rem; }

/* Menu */
.menubar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.25rem;
}
.who { color: var(--muted); font-size: 0.85rem; }
.who b { color: var(--ink); font-weight: 600; }
.menu-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.2rem;
  padding: 1.5rem 1.25rem 3rem;
}

.chooser {
  width: min(860px, 100%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.15rem;
}
.chooser.single { grid-template-columns: 1fr; width: min(340px, 100%); }

.tile {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: 1.5rem 1.45rem 1.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 8px solid var(--accent);
  border-radius: 1.15rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 10px 28px rgba(22, 24, 29, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.tile:hover { transform: translateY(-5px); box-shadow: 0 18px 40px rgba(22, 24, 29, 0.1); }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.tile .logo-wrap { display: inline-flex; align-self: flex-start; border-radius: 0.6rem; max-width: 100%; }
.tile .logo-wrap[style] { padding: 0.5rem 0.75rem; }
.tile .logo {
  display: block;
  height: 52px;
  width: auto;
  max-width: 78%;
  object-fit: contain;
  object-position: left center;
}
.tile .copy { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; }
.tile .name {
  font-size: clamp(1.7rem, 3.5vw, 2.3rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.05;
}
.tile .detail { margin-top: 0.45rem; color: var(--muted); font-size: 0.95rem; line-height: 1.35; }

.empty {
  width: min(460px, 100%);
  text-align: center;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 1.1rem;
  padding: 2.2rem 1.5rem;
  color: var(--muted);
}
.empty-title { color: var(--ink); font-weight: 700; font-size: 1.05rem; margin-bottom: 0.3rem; }

@media (max-width: 720px) {
  .chooser { grid-template-columns: 1fr; width: min(420px, 100%); }
  .tile { padding: 1.25rem; }
  .tile .logo { height: 44px; }
  .card { padding: 1.8rem 1.3rem 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tile { transition: none; }
  .tile:hover { transform: none; }
}
