@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap&subset=latin-ext");

:root {
  --bg-0: #edf2ff;
  --bg-1: #f7f9ff;
  --surface: rgba(255, 255, 255, 0.76);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(68, 88, 122, 0.18);
  --text: #101a30;
  --muted: #5e6b87;
  --brand: #3d61ff;
  --brand-2: #5f43ff;
  --ok: #0c8f64;
  --danger: #c33250;
  --tile-width: 330px;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #dce7ff 0, transparent 34%), linear-gradient(135deg, var(--bg-0), var(--bg-1));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
}

.muted {
  color: var(--muted);
}

.logout-btn {
  margin: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.content {
  padding: 0.65rem 1rem 3.2rem;
}

.manager-box,
.workspace-box,
.auth-card,
.upload-tile,
.email-results-tile,
.manager-store-bar {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgba(34, 57, 104, 0.08);
}

.manager-store-bar {
  margin-bottom: 0.85rem;
  padding: 0.75rem 0.9rem;
}

.manager-store-label {
  margin: 0 0 0.55rem 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.manager-store-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.store-picker-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.store-picker-tile:hover,
.store-picker-tile.active {
  border-color: transparent;
  background: linear-gradient(130deg, var(--brand), var(--brand-2));
  color: #fff;
  transform: translateY(-1px);
}

.store-picker-tile-asm {
  font-weight: 800;
  letter-spacing: 0.06em;
}

.manager-asm-layout {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.asm-side-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: var(--tile-width);
  min-width: var(--tile-width);
}

.asm-module-tile {
  text-align: left;
}

.asm-workspace {
  flex: 1;
  min-width: 0;
  padding: 0.9rem 1rem;
}

.asm-module-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.asm-module-head h2 {
  margin: 0 0 0.25rem 0;
}

.asm-module-status {
  margin: 0 0 0.5rem 0;
  min-height: 1.1rem;
}

.asm-module-meta {
  margin: 0.65rem 0 0 0;
  font-size: 0.78rem;
}

.asm-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.asm-overview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.asm-overview-table th,
.asm-overview-table td {
  padding: 0.62rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.asm-overview-table th {
  background: #f7f9fd;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.asm-overview-table tr:last-child td {
  border-bottom: none;
}

.asm-overview-actions {
  white-space: nowrap;
}

.asm-open-store {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

.asm-open-store:hover {
  text-decoration: underline;
}

.menu-layout {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}

.side-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.upload-tile {
  width: var(--tile-width);
  min-width: var(--tile-width);
  max-width: var(--tile-width);
  padding: 0.8rem;
}

.upload-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.upload-order {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(130deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 800;
}

.upload-head h2 {
  margin: 0;
  font-size: 1rem;
}

.upload-tile p {
  margin: 0 0 0.45rem 0;
  font-size: 0.8rem;
}

.upload-form {
  display: grid;
  gap: 0.45rem;
}

.upload-form input[type="file"] {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.35rem;
  background: #fff;
  font-size: 0.74rem;
}

button {
  border: none;
  border-radius: 10px;
  background: linear-gradient(130deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 700;
  padding: 0.65rem 0.95rem;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

.upload-btn {
  width: 100%;
  font-size: 0.86rem;
}

.upload-info {
  margin-top: 0.4rem;
}

.upload-status {
  margin: 0.22rem 0 0.35rem 0;
  min-height: 1rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.upload-status.success {
  color: var(--ok);
}

.upload-status.error {
  color: var(--danger);
}

.email-results-tile {
  width: var(--tile-width);
  min-width: var(--tile-width);
  max-width: var(--tile-width);
  padding: 0.8rem;
}

.email-results-tile h2 {
  margin: 0 0 0.35rem 0;
  font-size: 0.95rem;
}

.email-results-tile p {
  margin: 0 0 0.55rem 0;
  font-size: 0.76rem;
}

.email-results-label {
  display: block;
  margin: 0 0 0.3rem 0;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}

.email-results-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
  font-size: 0.8rem;
  margin-bottom: 0.45rem;
  background: #fff;
}

.send-results-btn {
  width: 100%;
  background: linear-gradient(130deg, #16a34a, #15803d) !important;
  color: #fff;
  font-weight: 800;
  padding: 0.55rem 0.75rem;
  font-size: 0.86rem;
}

.send-results-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.send-results-status {
  margin: 0.45rem 0 0 0;
  min-height: 1rem;
  font-size: 0.74rem;
}

.send-results-status.success {
  color: #15803d;
}

.send-results-status.error {
  color: #b42318;
}

.upload-hamster {
  display: block;
  width: 100%;
  height: 200px;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

.upload-hamster-box {
  position: relative;
}

.upload-hamster-fallback {
  display: none;
  width: 100%;
  height: 200px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  place-items: center;
  font-size: 3.2rem;
}

.menu-tile {
  width: var(--tile-width);
  min-width: var(--tile-width);
  max-width: var(--tile-width);
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-areas:
    "order title"
    "order subtitle";
  align-items: center;
  gap: 0.1rem 0.65rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--text);
  padding: 0.75rem 0.8rem;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.menu-tile:hover,
.menu-tile.active {
  border-color: rgba(61, 97, 255, 0.48);
  box-shadow: 0 10px 22px rgba(61, 97, 255, 0.16);
  transform: translateX(2px);
}

.menu-order {
  grid-area: order;
  font-weight: 800;
  color: var(--brand);
}

.menu-title {
  grid-area: title;
  font-weight: 700;
  line-height: 1.2;
  font-size: 0.9rem;
}

.menu-subtitle {
  grid-area: subtitle;
  color: var(--muted);
  font-size: 0.76rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.18s ease, opacity 0.18s ease;
}

.menu-tile:hover .menu-subtitle,
.menu-tile.active .menu-subtitle {
  max-height: 2.2rem;
  opacity: 1;
}

.workspace-box {
  flex: 1;
  min-height: 1500px;
  padding: 0.8rem;
}

.workspace-box h2 {
  margin: 0;
  font-size: 1.1rem;
}

.workspace-box p {
  margin: 0.28rem 0 0.5rem;
  font-size: 0.84rem;
}

.module-frame {
  width: 100%;
  min-height: 1350px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

#moduleFrameHost {
  width: 100%;
}

.module-frame-instance {
  display: none;
}

.module-frame-instance.active {
  display: block;
}

.data-load-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.42rem 0.9rem 0.55rem;
  background: rgba(12, 20, 35, 0.88);
  color: #f8fbff;
  display: grid;
  gap: 0.3rem;
  z-index: 1000;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.data-load-wrap.done {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}

.data-load-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

.data-load-bar {
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(130deg, #63a4ff, #6a5cff);
  transition: width 0.3s ease;
}

.data-load-label {
  font-size: 0.74rem;
  font-weight: 600;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  padding: 2rem;
}

.auth-card h1 {
  margin-top: 0;
}

.auth-form {
  display: grid;
  gap: 0.55rem;
}

label {
  font-weight: 700;
}

input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.alert {
  margin: 1rem 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid #ffb4c4;
  border-radius: 12px;
  color: #97213b;
  background: #ffe8ee;
}

@media (max-width: 1050px) {
  .menu-layout {
    flex-direction: column;
  }

  .side-menu,
  .upload-tile,
  .email-results-tile,
  .menu-tile {
    width: 100%;
    min-width: unset;
    max-width: 100%;
  }

  .workspace-box {
    width: 100%;
  }
}
