:root {
  --navy: #08101f;
  --navy-2: #101d35;
  --panel: #ffffff;
  --page: #f3f6fb;
  --line: #dce4ef;
  --ink: #142039;
  --muted: #68758c;
  --mint: #62edc1;
  --mint-dark: #087861;
  --blue: #50c8ff;
  --violet: #8b78ff;
  --gold: #ffc85c;
  --danger: #d9485f;
  --shadow: 0 25px 65px rgba(17, 32, 62, .13);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family:
    "Aptos", "Segoe UI Variable", "Segoe UI",
    ui-sans-serif, system-ui, sans-serif;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: var(--mint-dark);
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
.team-brand,
.primary-button {
  font-family:
    "Aptos Display", "Segoe UI Variable Display",
    "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

h1 {
  letter-spacing: -.045em;
  line-height: 1.05;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  padding: 13px 24px;
  color: white;
  background:
    radial-gradient(circle at 85% 20%, rgba(98,237,193,.12), transparent 18rem),
    linear-gradient(135deg, #080f1e, #111e35);
  box-shadow: 0 10px 35px rgba(4, 10, 24, .2);
}

.team-brand {
  display: grid;
  grid-template-columns: 42px auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  color: white;
}

.team-brand > span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #101727;
  border-radius: 14px;
  background: linear-gradient(145deg, #ffe18b, #ffba3d);
  box-shadow: 0 9px 25px rgba(255, 190, 63, .25);
  font-size: 1.35rem;
  font-weight: 900;
}

.team-brand strong {
  line-height: 1.1;
}

.team-brand small {
  color: #9dacbf;
}

.team-nav {
  display: flex;
  align-items: center;
  gap: 19px;
}

.team-nav > a,
.text-button {
  color: #dbe5f2;
  font-size: .9rem;
  font-weight: 750;
}

.team-nav form {
  margin: 0;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.team-identity {
  padding-left: 18px;
  border-left: 1px solid rgba(255,255,255,.17);
}

.team-identity strong,
.team-identity small {
  display: block;
}

.team-identity small {
  color: var(--mint);
  text-transform: capitalize;
}

.menu-toggle {
  display: none;
  padding: 8px 12px;
  color: white;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 9px;
  background: rgba(255,255,255,.08);
}

.login-shell {
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: 1.08fr .92fr;
}

.login-art {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(50px, 8vw, 120px);
  color: white;
  background:
    radial-gradient(circle at 15% 15%, rgba(98,237,193,.2), transparent 21rem),
    radial-gradient(circle at 85% 85%, rgba(139,120,255,.3), transparent 28rem),
    linear-gradient(145deg, #080e1c, #13213c 55%, #211c4a);
}

.login-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .14;
  background-image:
    linear-gradient(rgba(255,255,255,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(135deg, black, transparent);
}

.login-art h1 {
  max-width: 780px;
  margin: 20px 0;
  font-size: clamp(3.2rem, 6vw, 6.5rem);
}

.login-art p {
  max-width: 650px;
  color: #c5d0e1;
  font-size: 1.12rem;
}

.kicker {
  color: var(--mint-dark);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.login-art .kicker {
  color: var(--mint);
}

.mail-orbit {
  position: relative;
  width: 220px;
  height: 220px;
  margin-top: 42px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;
  animation: orbitTurn 18s linear infinite;
}

.mail-core {
  position: absolute;
  inset: 56px;
  display: grid;
  place-items: center;
  color: #11182a;
  border-radius: 29px;
  background: linear-gradient(145deg, var(--mint), var(--blue));
  box-shadow: 0 20px 45px rgba(80,200,255,.22);
  font-size: 2.4rem;
}

.orbit-dot {
  position: absolute;
  width: 25px;
  height: 25px;
  border: 5px solid rgba(255,255,255,.3);
  border-radius: 50%;
}

.dot-one {
  top: -12px;
  left: 98px;
  background: var(--gold);
}

.dot-two {
  right: 3px;
  bottom: 28px;
  background: var(--violet);
}

.dot-three {
  left: 4px;
  bottom: 35px;
  background: var(--mint);
}

@keyframes orbitTurn {
  to { transform: rotate(360deg); }
}

.login-side,
.center-page {
  display: grid;
  place-items: center;
  padding: clamp(28px, 6vw, 85px);
  background:
    radial-gradient(circle at 90% 10%, rgba(80,200,255,.1), transparent 20rem),
    #f5f8fc;
}

.login-card,
.form-card {
  width: min(100%, 530px);
  padding: clamp(28px, 5vw, 50px);
  border: 1px solid rgba(198,211,228,.8);
  border-radius: 27px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}

.login-card h1,
.form-card h1 {
  margin: 13px 0 8px;
  font-size: clamp(2.4rem, 4vw, 3.7rem);
}

.login-card form,
.form-card form {
  margin-top: 28px;
}

label {
  display: block;
  margin-bottom: 18px;
  color: var(--ink);
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 47px;
  margin-top: 7px;
  padding: 12px 14px;
  color: var(--ink);
  border: 1px solid #cbd6e4;
  border-radius: 12px;
  background: #fbfcff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #0d9a7b;
  box-shadow: 0 0 0 4px rgba(13,154,123,.12);
}

textarea {
  resize: vertical;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 47px;
  padding: 11px 18px;
  border: 1px solid #087861;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, #087d65, #08708a);
  box-shadow: 0 12px 27px rgba(8,112,110,.19);
  font-weight: 850;
  cursor: pointer;
}

.secondary-button {
  color: var(--ink);
  border-color: #cbd6e4;
  background: white;
  box-shadow: none;
}

.full {
  width: 100%;
}

.hint {
  padding: 11px 13px;
  border-radius: 10px;
  background: #eef3f8;
  font-size: .85rem;
}

.alert {
  margin: 18px 0;
  padding: 13px 15px;
  border-radius: 11px;
  font-weight: 650;
}

.alert.success {
  color: #076047;
  border: 1px solid #a9e3cf;
  background: #e1f8ef;
}

.alert.error {
  color: #92273a;
  border: 1px solid #efbdc5;
  background: #ffecef;
}

.workspace {
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
}

.inbox-sidebar {
  padding: 30px 18px;
  color: white;
  background:
    radial-gradient(circle at 20% 90%, rgba(139,120,255,.15), transparent 20rem),
    linear-gradient(180deg, #0b1426, #101c33);
}

.sidebar-heading {
  padding: 0 11px 20px;
}

.sidebar-heading .kicker {
  color: var(--mint);
}

.sidebar-heading h1 {
  margin: 8px 0 0;
  font-size: 2.2rem;
}

.mailbox-link {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 5px 0;
  padding: 12px;
  color: #c8d3e2;
  border: 1px solid transparent;
  border-radius: 13px;
}

.mailbox-link:hover,
.mailbox-link.active {
  color: white;
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.08);
}

.mailbox-link small,
.mailbox-link strong {
  display: block;
}

.mailbox-link small {
  max-width: 175px;
  overflow: hidden;
  color: #8fa0b7;
  font-size: .73rem;
  text-overflow: ellipsis;
}

.mailbox-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  color: #102035;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--mint), var(--blue));
  font-weight: 900;
}

.inbox-main {
  min-width: 0;
  padding: clamp(24px, 4vw, 52px);
}

.inbox-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.inbox-header h1 {
  margin: 7px 0 0;
  font-size: clamp(2.4rem, 4vw, 4rem);
}

.inbox-filters {
  display: flex;
  align-items: center;
  gap: 9px;
}

.inbox-filters input,
.inbox-filters select {
  margin: 0;
}

.conversation-list {
  display: grid;
  gap: 10px;
}

.conversation-row {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
  padding: 19px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
  box-shadow: 0 10px 35px rgba(18,35,68,.055);
  transition: transform .2s, box-shadow .2s;
}

.conversation-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 45px rgba(18,35,68,.11);
}

.conversation-row::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 0 5px 5px 0;
  background: #cdd6e3;
}

.conversation-row.priority-urgent::before {
  background: var(--danger);
}

.conversation-row.priority-high::before {
  background: var(--gold);
}

.customer-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: white;
  border-radius: 15px;
  background: linear-gradient(145deg, #5d7ee8, var(--violet));
  font-size: 1.1rem;
  font-weight: 900;
}

.conversation-top {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.conversation-top time {
  color: var(--muted);
  font-size: .76rem;
}

.conversation-content h2 {
  margin: 5px 0;
  font-size: 1.08rem;
}

.conversation-content p {
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: .77rem;
}

.badge,
.status,
.priority {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf2f7;
  font-weight: 800;
  text-transform: capitalize;
}

.status-new {
  color: #075d75;
  background: #dff3fb;
}

.status-open {
  color: #5d398e;
  background: #eee6fa;
}

.status-pending {
  color: #775807;
  background: #fff0c8;
}

.status-resolved,
.status-closed {
  color: #076047;
  background: #def7ed;
}

.status-spam {
  color: #92273a;
  background: #ffe8ec;
}

.empty-state {
  padding: 80px 25px;
  text-align: center;
  border: 1px dashed #bdcadb;
  border-radius: 20px;
  background: rgba(255,255,255,.65);
}

.empty-state > div {
  color: var(--violet);
  font-size: 2.4rem;
}

.team-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 24px;
  color: #8996a9;
  background: #08101f;
  font-size: .78rem;
}

.centered {
  text-align: center;
}

@media (max-width: 1000px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-art {
    min-height: 560px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .inbox-sidebar {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 15px;
  }

  .sidebar-heading {
    display: none;
  }

  .mailbox-link {
    flex: 0 0 auto;
  }

  .inbox-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 780px) {
  .menu-toggle {
    display: block;
  }

  .team-nav {
    position: absolute;
    display: none;
    top: 67px;
    left: 12px;
    right: 12px;
    align-items: stretch;
    padding: 17px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 15px;
    background: #101c33;
    box-shadow: var(--shadow);
  }

  .team-nav.open {
    display: grid;
  }

  .team-identity {
    padding: 12px 0 0;
    border-left: 0;
    border-top: 1px solid rgba(255,255,255,.15);
  }

  .login-art {
    min-height: 500px;
    padding: 50px 25px;
  }

  .login-art h1 {
    font-size: 3.3rem;
  }

  .mail-orbit {
    width: 150px;
    height: 150px;
  }

  .mail-core {
    inset: 40px;
  }

  .dot-one {
    left: 63px;
  }

  .inbox-main {
    padding: 25px 13px;
  }

  .inbox-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .conversation-row {
    grid-template-columns: 1fr;
  }

  .conversation-top {
    flex-direction: column;
    gap: 3px;
  }

  .team-footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

.admin-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(45px,7vw,90px);
  color: white;
  background:
    radial-gradient(circle at 85% 20%,rgba(98,237,193,.18),transparent 22rem),
    radial-gradient(circle at 10% 90%,rgba(139,120,255,.2),transparent 26rem),
    linear-gradient(145deg,#09101f,#14213d);
}
.admin-hero.compact { padding-block: 50px; }
.admin-hero h1 { margin: 10px 0; font-size: clamp(2.7rem,5vw,5rem); }
.admin-hero p { color: #bdc9db; }
.admin-hero .kicker { color: var(--mint); }
.admin-actions { display: flex; gap: 10px; }
.admin-content { padding: clamp(28px,5vw,65px); }
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 15px; }
.stat-grid article,.admin-card,.management-form,.user-card,.mailbox-card,.side-card,.thread-panel {
  border: 1px solid var(--line);
  border-radius: 19px;
  background: white;
  box-shadow: 0 14px 40px rgba(17,32,62,.07);
}
.stat-grid article { padding: 23px; }
.stat-grid span,.stat-grid strong { display: block; }
.stat-grid span { color: var(--muted); }
.stat-grid strong { margin-top: 7px; font-size: 2.3rem; }
.admin-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; margin-top: 35px; }
.admin-card { padding: 28px; color: var(--ink); }
.admin-card p { min-height: 77px; }
.admin-icon,.mailbox-large-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 20px; border-radius: 14px; background: linear-gradient(145deg,var(--mint),var(--blue)); }
.management-layout { display: grid; grid-template-columns: 360px minmax(0,1fr); gap: 25px; align-items: start; }
.management-form { position: sticky; top: 98px; padding: 25px; }
.management-list,.mailbox-grid { display: grid; gap: 15px; }
.mailbox-grid { grid-template-columns: repeat(2,1fr); }
.user-card,.mailbox-card { padding: 23px; }
.user-card.inactive { opacity: .62; }
.user-card-head { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; }
.user-card-head h2,.user-card-head p { margin: 0; }
.role-badge { padding: 5px 9px; border-radius: 999px; background: #e9e5fb; color: #5e4494; font-size: .75rem; font-weight: 900; text-transform: capitalize; }
.user-details,.mailbox-stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0; color: var(--muted); font-size: .82rem; }
fieldset { margin: 15px 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; }
legend { padding: 0 6px; font-weight: 800; }
.check-option { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.check-option input { width: auto; min-height: auto; margin: 0; }
.check-option small,.check-option strong { display: block; }
details { margin: 12px 0; padding: 11px; border: 1px solid var(--line); border-radius: 10px; }
summary { cursor: pointer; font-weight: 800; }
details form { margin-top: 15px; }
.danger-button { padding: 9px 13px; border: 1px solid #d9485f; border-radius: 10px; color: #b52e45; background: #fff0f2; font-weight: 800; cursor: pointer; }
.address-input { display: grid; grid-template-columns: 1fr auto; align-items: center; }
.address-input span { padding: 12px; margin-top: 7px; border: 1px solid #cbd6e4; border-left: 0; border-radius: 0 12px 12px 0; color: var(--muted); background: #eef3f8; }
.address-input input { border-radius: 12px 0 0 12px; }

.conversation-page { padding: clamp(20px,4vw,45px); }
.conversation-toolbar { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.conversation-layout { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 22px; align-items: start; }
.thread-panel { overflow: hidden; }
.thread-header { padding: 28px; border-bottom: 1px solid var(--line); }
.thread-header h1 { margin: 9px 0; font-size: clamp(2rem,4vw,3.4rem); }
.message-thread { display: grid; gap: 14px; padding: 25px; background: #f7f9fc; }
.thread-message { max-width: 86%; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.thread-message.outbound { margin-left: auto; border-color: #b9e6d8; background: #e9f9f3; }
.message-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.message-head span { padding: 3px 7px; border-radius: 999px; background: #edf2f7; font-size: .7rem; text-transform: uppercase; }
.message-head time { margin-left: auto; color: var(--muted); font-size: .75rem; }
.message-body { margin: 13px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-placeholder { padding: 25px; border-top: 1px solid var(--line); background: #fff7de; }
.conversation-sidebar { display: grid; gap: 15px; }
.side-card { padding: 20px; }
.notes-list { display: grid; gap: 9px; margin-bottom: 16px; }
.notes-list article { padding: 11px; border-radius: 10px; background: #f1f4f8; }
.notes-list p { margin: 5px 0; color: var(--ink); }
.notes-list small { color: var(--muted); }

@media (max-width: 1000px) {
  .management-layout,.conversation-layout { grid-template-columns: 1fr; }
  .management-form { position: static; }
  .stat-grid,.admin-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 650px) {
  .admin-hero { align-items: stretch; flex-direction: column; padding: 40px 18px; }
  .admin-actions { flex-direction: column; }
  .stat-grid,.admin-grid,.mailbox-grid { grid-template-columns: 1fr; }
  .admin-content,.conversation-page { padding: 20px 12px; }
  .user-card-head { grid-template-columns: 48px 1fr; }
  .role-badge { grid-column: 1/-1; width: max-content; }
  .thread-message { max-width: 100%; }
}

.mailbox-explanation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.mailbox-explanation div {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.mailbox-explanation strong,
.mailbox-explanation span,
.login-ready strong,
.login-ready span {
  display: block;
}

.mailbox-explanation span {
  margin-top: 4px;
  color: var(--muted);
}

.agent-login-setup {
  margin-top: 20px;
  border-color: #a9ded0;
  background: #f1fbf7;
}

.agent-login-setup summary {
  color: #07634e;
}

.login-address-preview {
  margin: 12px 0 17px;
  padding: 11px;
  border-radius: 10px;
  background: #e5f2ee;
  color: var(--muted);
  font-size: .85rem;
}

.login-address-preview strong {
  display: block;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.login-ready {
  margin-top: 20px;
  padding: 14px;
  color: #075b45;
  border: 1px solid #a9e2cf;
  border-radius: 12px;
  background: #e5f8f0;
}

.login-ready span {
  margin-top: 5px;
  color: #477467;
  font-size: .85rem;
}

@media (max-width: 650px) {
  .mailbox-explanation {
    grid-template-columns: 1fr;
  }
}
