:root {
  --ink: #1c1410;
  --paper: #f7f1e8;
  --gold: #c9a227;
  --gold-soft: #e8d48b;
  --cyan: #00aeef;
  --cyan-soft: rgba(0, 174, 239, 0.28);
  --muted: #6b5b4f;
  --card: #fffdf9;
  --line: rgba(28, 20, 16, 0.08);
  --shadow: 0 18px 40px rgba(28, 20, 16, 0.12);
  --brand: #8b4513;
  --brand-soft: #f5e6d3;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color: var(--ink);
  background: var(--paper);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

.directory-page {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  overflow-x: hidden;
  background: #102832;
  color: #ffffff;
}

.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.scene-gradient {
  position: absolute;
  inset: -8%;
  background:
    radial-gradient(820px 420px at 8% 0%, rgba(0, 174, 239, 0.28), transparent 55%),
    radial-gradient(720px 380px at 96% 8%, rgba(0, 174, 239, 0.14), transparent 52%),
    radial-gradient(640px 420px at 50% 100%, rgba(0, 20, 28, 0.45), transparent 58%),
    linear-gradient(180deg, #163a48 0%, #102832 46%, #0c1f28 100%);
  animation: scene-shift 18s ease-in-out infinite alternate;
}
.scene-glow {
  position: absolute;
  width: min(46vw, 420px);
  height: min(46vw, 420px);
  border-radius: 50%;
  filter: blur(36px);
  opacity: 0.55;
}
.scene-glow-a {
  top: -10%;
  left: -6%;
  background: rgba(0, 174, 239, 0.26);
  animation: glow-float 12s ease-in-out infinite;
}
.scene-glow-b {
  right: -8%;
  bottom: 6%;
  background: rgba(0, 174, 239, 0.16);
  animation: glow-float 16s ease-in-out infinite reverse;
}
.scene-steam {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.7) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 90%, rgba(255,255,255,0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 45% 85%, rgba(0,174,239,0.18) 0 2px, transparent 3px);
  background-size: 220px 220px, 280px 280px, 180px 180px;
  animation: steam-rise 16s linear infinite;
}
.scene-beans i,
.scene-lights span {
  position: absolute;
  display: block;
}
.scene-beans i {
  width: 16px;
  height: 22px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(135deg, #d7a06a, #b57a45);
  box-shadow: inset -3px -2px 0 rgba(255,255,255,0.25);
  opacity: 0.18;
  animation: bean-drift 22s linear infinite;
}
.scene-beans i:nth-child(1) { left: 8%; top: 22%; animation-duration: 26s; }
.scene-beans i:nth-child(2) { left: 22%; top: 68%; animation-duration: 20s; }
.scene-beans i:nth-child(3) { left: 48%; top: 16%; animation-duration: 24s; }
.scene-beans i:nth-child(4) { left: 71%; top: 42%; animation-duration: 18s; }
.scene-beans i:nth-child(5) { left: 84%; top: 74%; animation-duration: 28s; }
.scene-beans i:nth-child(6) { left: 36%; top: 82%; animation-duration: 21s; }
.scene-lights span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
  opacity: 0.45;
  animation: twinkle 3.6s ease-in-out infinite;
}
.scene-lights span:nth-child(1) { left: 14%; top: 18%; }
.scene-lights span:nth-child(2) { left: 62%; top: 12%; animation-delay: .6s; }
.scene-lights span:nth-child(3) { left: 78%; top: 36%; animation-delay: 1.2s; }
.scene-lights span:nth-child(4) { left: 30%; top: 48%; animation-delay: 1.8s; }

@keyframes scene-shift {
  from { transform: scale(1) translateY(0); }
  to { transform: scale(1.04) translateY(-1.5%); }
}
@keyframes glow-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(5%, 7%); }
}
@keyframes steam-rise {
  from { background-position: 0 40px, 40px 80px, 20px 60px; }
  to { background-position: 0 -220px, 40px -240px, 20px -180px; }
}
@keyframes bean-drift {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-22px) rotate(14deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.85); }
  50% { opacity: 0.75; transform: scale(1.15); }
}

.directory-content {
  position: relative;
  z-index: 1;
  padding-bottom: 40px;
}

.directory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 0 12px;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.brand-logo {
  flex: 0 0 auto;
  height: 96px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  mix-blend-mode: screen;
}
.brand-mark strong {
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  color: var(--cyan);
}
.directory-header p {
  margin: 0;
  flex: 0 0 auto;
  color: var(--cyan);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(0, 174, 239, 0.35);
  border-radius: 999px;
  padding: 8px 14px;
}

.directory-hero { padding: 28px 0 24px; }
.directory-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 4.6vw, 3.1rem);
  line-height: 1.15;
  color: #ffffff;
}
.directory-hero p {
  margin: 0;
  max-width: 36rem;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(1rem, 2.2vw, 1.12rem);
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  padding-bottom: 48px;
}

.company-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 240px;
  padding: 28px 18px 22px;
  touch-action: manipulation;
  background: #fff;
  color: var(--ink);
  border-radius: 22px;
  border: 1px solid rgba(139, 69, 19, 0.08);
  box-shadow: 0 12px 28px rgba(90, 58, 36, 0.08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.company-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0, 174, 239, 0.45);
  box-shadow: 0 18px 36px rgba(0, 174, 239, 0.14);
}
.logo-box {
  width: min(112px, 42vw);
  height: min(112px, 42vw);
  padding: 12px;
  border-radius: 20px;
  background: #fff4e8;
  display: grid;
  place-items: center;
}
.logo-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.company-card h2 {
  margin: 0;
  text-align: center;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
  color: #102832;
}
.company-card small {
  color: #0b8cbf;
  overflow-wrap: anywhere;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.82);
}

html:has(.tenant-auth),
body.tenant-auth {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.tenant-auth {
  min-height: 100dvh;
  height: 100dvh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(6px, 1.4vh, 16px) clamp(12px, 4vw, 24px) 0;
  overflow: hidden;
  background:
    radial-gradient(700px 360px at 80% 0%, color-mix(in srgb, var(--brand) 28%, transparent), transparent 55%),
    linear-gradient(180deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 70%, #fff));
}
.auth-card {
  width: min(480px, 100%);
  margin: auto;
  max-height: none;
  overflow: hidden;
  background: #fffdf9;
  border-radius: 24px;
  padding: clamp(10px, 2vh, 28px) clamp(16px, 3.4vw, 32px);
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-card .logo-box {
  width: clamp(52px, 9vh, 96px);
  height: clamp(52px, 9vh, 96px);
  margin: 0 auto clamp(6px, 1.2vh, 12px);
  padding: 8px;
  background: var(--brand-soft);
}
.auth-card h1 {
  margin: 0 0 4px;
  font-size: clamp(1.15rem, 2.6vh, 1.7rem);
  line-height: 1.2;
}
.auth-card .sub { margin: 0 0 clamp(8px, 1.6vh, 16px); color: var(--muted); font-size: clamp(0.88rem, 1.8vh, 1.02rem); }
.field { text-align: left; margin-bottom: clamp(6px, 1.2vh, 12px); }
.field label { display: block; margin-bottom: clamp(4px, 0.8vh, 7px); font-size: clamp(0.86rem, 1.6vh, 1rem); }
.field input {
  width: 100%;
  min-height: clamp(40px, 6vh, 54px);
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: clamp(8px, 1.2vh, 12px) 14px;
  font-size: clamp(1rem, 2vh, 1.12rem);
}
.field input:focus { outline: 3px solid var(--brand); border-color: transparent; }
.remember {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: clamp(32px, 4.6vh, 44px);
  margin: 0 0 clamp(8px, 1.4vh, 14px);
  color: var(--muted);
  font-size: clamp(0.9rem, 1.7vh, 1.02rem);
}
.remember input { width: 20px; height: 20px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: clamp(44px, 6.6vh, 56px);
  border: 0;
  border-radius: 14px;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  font-size: clamp(1.02rem, 2.1vh, 1.15rem);
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.08); }
.errors { color: #9b1c1c; text-align: left; margin: 0 0 8px; font-size: 0.9rem; }
.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(28px, 4vh, 40px);
  margin-top: clamp(6px, 1.2vh, 12px);
  color: var(--muted);
  font-size: clamp(0.88rem, 1.7vh, 1rem);
}
.site-copy {
  margin: 0;
  padding: 12px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,.72);
  flex-shrink: 0;
}
.directory-page .site-copy { color: rgba(255,255,255,.72); }
.tenant-auth .site-copy,
.tenant-shell .site-copy,
.pos-shell .site-copy { color: rgba(16, 40, 50, .7); }
.site-copy a { color: var(--cyan); font-weight: 700; }
.site-copy a:hover { text-decoration: underline; }

html:has(.pos-shell),
body.pos-shell {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.tenant-shell,
.pos-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--brand-soft);
}
.pos-shell {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}
.tenant-shell main,
.pos-main { flex: 1; }
.tenant-shell .directory-hero h1,
.tenant-shell .directory-hero p { color: var(--ink); }
.tenant-top,
.pos-top {
  background: var(--brand);
  color: #fff;
  padding: 12px 20px;
  flex-shrink: 0;
}
.tenant-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.pos-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px 16px;
}
.pos-logout-form { justify-self: end; }
.tenant-top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tenant-brand,
.pos-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tenant-brand img,
.pos-brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  padding: 5px;
}
.tenant-brand strong,
.pos-brand strong { display: block; font-size: 1.25rem; }
.pos-brand span { display: block; opacity: .85; font-size: 0.98rem; }
.pos-clock {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.ghost,
.pos-logout {
  width: auto;
  min-width: 120px;
  min-height: 56px;
  background: transparent;
  border: 2px solid rgba(255,255,255,0.45);
  color: #fff;
  padding: 12px 22px;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.pos-logout:active { background: rgba(255,255,255,.12); }
.pos-main {
  min-height: 0;
  padding: 16px 20px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.pos-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 12px;
}
.pos-tile {
  min-height: clamp(118px, 20vh, 168px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 6px;
  padding: 20px;
  border: 0;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 40, 50, 0.08);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pos-tile:not(:disabled):active {
  transform: scale(0.985);
  box-shadow: 0 6px 16px rgba(16, 40, 50, 0.12);
}
.pos-tile.is-soon {
  cursor: default;
  opacity: 0.92;
}
.pos-tile-icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: auto;
  color: var(--brand);
}
.pos-tile-label {
  font-size: 1.35rem;
  font-weight: 700;
}
.pos-tile-desc {
  font-size: 0.98rem;
  color: var(--muted);
}
.pos-empty {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  background: #fff;
  border-radius: 22px;
  font-size: 1.15rem;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 28px 0 64px;
}
.module-card {
  background: #fffdf9;
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  min-height: 150px;
}
.module-card h3 { margin: 0 0 8px; }
.module-card p { margin: 0; color: var(--muted); }
.badge {
  display: inline-block;
  margin-top: 14px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3e7c8;
  color: #7a5b10;
  font-size: 0.78rem;
}

@media (max-width: 1200px) {
  .pos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .wrap { width: min(1120px, calc(100% - 28px)); }
  .company-grid, .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .pos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pos-clock { font-size: 1.5rem; }
}

@media (max-width: 720px) {
  .directory-header {
    flex-direction: column;
    align-items: flex-start;
    padding-top: 20px;
  }
  .directory-hero { padding: 18px 0 20px; }
  .company-grid, .module-grid, .pos-grid { grid-template-columns: 1fr 1fr; }
  .company-card { padding: 22px 16px 18px; }
  .brand-logo { height: 78px; max-width: 180px; }
  .tenant-top .wrap { flex-wrap: wrap; }
  .pos-top {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand logout"
      "clock clock";
  }
  .pos-brand { grid-area: brand; }
  .pos-logout-form { grid-area: logout; align-self: start; }
  .pos-clock { grid-area: clock; width: 100%; text-align: center; }
  .pos-logout {
    min-width: 96px;
    min-height: 48px;
    padding: 10px 16px;
  }
  .auth-card { border-radius: 18px; }
  .pos-tile { min-height: 140px; padding: 16px; }
  .pos-tile-label { font-size: 1.15rem; }
}

@media (max-height: 720px) {
  .auth-card .logo-box {
    width: clamp(48px, 8vh, 64px);
    height: clamp(48px, 8vh, 64px);
  }
  .auth-card h1 { font-size: 1.15rem; }
  .pos-tile-desc { display: none; }
  .pos-tile { min-height: 112px; padding: 14px; }
}

@media (max-width: 420px) {
  .wrap { width: calc(100% - 20px); }
  .directory-header p { width: 100%; text-align: center; }
  .brand-mark { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .scene-gradient,
  .scene-glow,
  .scene-steam,
  .scene-beans i,
  .scene-lights span,
  .company-card { animation: none; }
}
