:root {
  --ink: #1b0f0f;
  --line: #2d3135;
  --accent: #1a6edd;
  --paper: #ffffff;
  --muted: rgba(27, 15, 15, 0.58);
  --soft: #f4f6f8;
  --font-display: "Russo One", sans-serif;
  --font-body: "Manrope", Arial, sans-serif;
  --ease: ease-in-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  background: var(--paper);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 55% at 10% 0%, rgba(26, 110, 221, 0.12), transparent 55%),
    linear-gradient(180deg, #f7f9fb 0%, #ffffff 48%, #eef2f6 100%);
}

.auth-card {
  width: min(420px, 100%);
  padding: 1.6rem 1.5rem 1.35rem;
  border: 2px solid var(--line);
  background: var(--paper);
  animation: auth-in 0.35s var(--ease);
}

@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.auth-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1;
}

.auth-lead {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

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

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

.auth-form label span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-form input {
  width: 100%;
  height: 42px;
  padding: 0 0.75rem;
  border: 2px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.auth-form input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.auth-form button[type="submit"] {
  margin-top: 0.25rem;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 32px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.12s var(--ease), border-color 0.12s var(--ease);
}

.auth-form button[type="submit"]:hover,
.auth-form button[type="submit"]:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.auth-form button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-error {
  margin: 0;
  color: #b42318;
  font-size: 0.86rem;
  font-weight: 600;
}

.auth-hint {
  margin: 0 0 0.25rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.auth-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.pw-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.pw-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 22, 0.42);
  animation: auth-in 0.2s var(--ease);
}

.pw-modal-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 1.35rem 1.35rem 1.2rem;
  border: 2px solid var(--line);
  background: var(--paper);
  animation: auth-in 0.28s var(--ease);
}

.pw-modal-title {
  margin: 0 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.15;
}

.pw-modal-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
}

.pw-modal-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.pw-modal-actions .pw-keep,
.pw-keep {
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 32px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pw-modal-actions .pw-keep:hover,
.pw-modal-actions .pw-keep:focus-visible,
.pw-keep:hover,
.pw-keep:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.pw-modal-actions .pw-keep:disabled,
.pw-keep:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.85rem 0;
}

.top-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
  min-width: 0;
}

.session {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.session-name {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

.session-out {
  appearance: none;
  height: 34px;
  padding: 0 0.85rem;
  border: 2px solid var(--line);
  border-radius: 32px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.session-out:hover,
.session-out:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.logo-link {
  display: inline-flex;
  line-height: 0;
  flex-shrink: 0;
}

.logo {
  display: block;
  width: 36px;
  height: 36px;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  line-height: 1;
  letter-spacing: 0.01em;
}

.services {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.service {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.35rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 32px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    background-color 0.12s var(--ease),
    color 0.12s var(--ease),
    border-color 0.12s var(--ease);
}

.service:hover,
.service:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  outline: none;
}

.rule {
  height: 2px;
  background: var(--line);
  width: 100%;
}

.shell {
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 1.5rem;
}

.board {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 0.85rem;
  align-items: stretch;
  min-height: calc(100vh - 5.5rem);
}

.section-label {
  margin: 0 0 0.65rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.workspace,
.mail {
  min-height: 0;
  border: 2px solid var(--line);
  background: var(--paper);
  padding: 0.9rem;
}

.slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  height: calc(100% - 1.6rem);
}

.slot {
  position: relative;
  margin: 0;
  min-height: 11rem;
  padding: 0.85rem 0.85rem 2.2rem;
  border: 2px solid var(--line);
  background: var(--soft);
}

.slot.is-link {
  cursor: pointer;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), background 0.15s var(--ease);
}

.slot.is-link:hover,
.slot.is-link:focus-visible {
  border-color: var(--accent);
  background: #eef4fc;
  outline: none;
  transform: translateY(-1px);
}

.slot-state.is-live {
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 600;
}

.slot-num {
  display: block;
  margin-bottom: 2.2rem;
  color: var(--accent);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  text-align: right;
}

.slot h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.slot-state {
  position: absolute;
  left: 0.85rem;
  bottom: 0.75rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mail {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.mail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.mail-head .section-label {
  margin: 0;
}

.mail-open {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.mail-open:hover,
.mail-open:focus-visible {
  text-decoration: underline;
  outline: none;
}

.mail-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
}

.mail-search input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 0.75rem;
  border: 2px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.mail-search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.mail-search input:disabled {
  background: var(--soft);
  color: var(--muted);
}

.mail-search button {
  height: 40px;
  padding: 0 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 32px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mail-search button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 2px solid var(--line);
  flex: 1;
  min-height: 12rem;
  overflow: auto;
}

.mail-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(45, 49, 53, 0.18);
}

.mail-item:last-child {
  border-bottom: 0;
}

.mail-item.is-stub {
  opacity: 0.72;
}

.mail-from {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.mail-subject {
  margin: 0;
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
}

.mail-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.mail-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

@media (max-width: 960px) {
  .board {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .slots {
    grid-template-columns: 1fr;
    height: auto;
  }

  .slot {
    min-height: 7rem;
  }

  .slot-num {
    margin-bottom: 0.9rem;
  }
}

@media (max-width: 640px) {
  .top {
    align-items: flex-start;
  }

  .top-right,
  .services {
    width: 100%;
  }

  .session {
    width: 100%;
    justify-content: space-between;
  }
}
