:root {
  --bg: #f6f8fc;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --ink: #1f1f1f;
  --muted: #5f6368;
  --line: rgba(60, 64, 67, 0.12);
  --accent: #1a73e8;
  --accent-dark: #1558b0;
  --accent-soft: rgba(26, 115, 232, 0.1);
  --danger: #db4e5d;
  --danger-dark: #c74150;
  --success: #158f6a;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.16), 0 2px 6px rgba(60, 64, 67, 0.1);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.auth-screen {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(26, 115, 232, 0.14), transparent 30%),
    radial-gradient(circle at 80% 30%, rgba(91, 156, 255, 0.16), transparent 28%),
    linear-gradient(180deg, #f5f9ff 0%, #eef4fc 100%);
}

.auth-background {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cube {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(26, 115, 232, 0.32), rgba(91, 156, 255, 0.55));
  box-shadow: 0 10px 24px rgba(26, 115, 232, 0.12);
  animation: drift 16s linear infinite;
}

.cube-1 { top: 12%; left: 9%; animation-duration: 18s; }
.cube-2 { top: 20%; left: 75%; animation-duration: 22s; width: 14px; height: 14px; }
.cube-3 { top: 48%; left: 18%; animation-duration: 17s; width: 22px; height: 22px; }
.cube-4 { top: 68%; left: 82%; animation-duration: 20s; }
.cube-5 { top: 78%; left: 30%; animation-duration: 19s; width: 12px; height: 12px; }
.cube-6 { top: 32%; left: 55%; animation-duration: 21s; }
.cube-7 { top: 58%; left: 64%; animation-duration: 15s; width: 20px; height: 20px; }
.cube-8 { top: 84%; left: 12%; animation-duration: 24s; width: 16px; height: 16px; }

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-panel {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 50px rgba(26, 54, 93, 0.12);
  backdrop-filter: blur(10px);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: -0.04em;
}

.auth-copy {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-submit {
  margin-top: 4px;
}

.auth-hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.hidden {
  display: none !important;
}

.app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
}

.brand,
.profile-panel {
  display: flex;
  align-items: center;
}

.profile-panel {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.brand-mark,
.profile-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a73e8, #5b9cff);
  color: #fff;
  font-weight: 800;
}

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

.profile-subline {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-title-only {
  margin: 0;
  font-size: 1.05rem;
}

.profile-view-card {
  display: grid;
  gap: 22px;
}

.profile-view-identity {
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-view-avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(135deg, #1a73e8, #5b9cff);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
}

.profile-view-head h2,
.profile-view-identity h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.profile-view-copy {
  margin: 8px 0 0;
  color: var(--muted);
}

.profile-view-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profile-info-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.98);
  padding: 18px;
}

.profile-info-card h3 {
  margin: 8px 0 0;
  font-size: 1.15rem;
}

.profile-info-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
}

.profile-info-list strong {
  color: var(--ink);
  margin-right: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #8e7d56;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.small-logout {
  min-height: 38px;
  padding: 0 14px;
}

.search-results {
  display: grid;
  gap: 6px;
  max-width: 720px;
  margin: 10px auto 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.global-search {
  flex: 1;
  max-width: 720px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  background: #eaf1fb;
  color: var(--muted);
}

.global-search input {
  border: 0;
  background: transparent;
  min-height: auto;
  padding: 0;
  box-shadow: none;
}

.global-search input:focus {
  box-shadow: none;
  border: 0;
}

.search-icon {
  font-size: 1.1rem;
  color: #5f6368;
}

.search-result {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-result:hover {
  background: #f1f6fe;
}

.search-result span,
.search-empty {
  color: var(--muted);
}

.session-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0 16px;
}

.nav-pill,
.button {
  border: 1px solid transparent;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.nav-pill {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-weight: 700;
}

.nav-pill:hover,
.button:hover {
  transform: translateY(-1px);
}

.nav-pill.active {
  background: #d3e3fd;
  border-color: transparent;
  color: #0b57d0;
}

.button {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.button:hover {
  background: var(--accent-dark);
}

.button.secondary {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line);
}

.button.danger {
  background: var(--danger);
}

.button.danger:hover {
  background: var(--danger-dark);
}

.view {
  display: block;
  animation: fade 180ms ease;
}

.card {
  background: var(--panel);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 245, 227, 1);
  color: #8e7d56;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.9fr);
  gap: 18px;
}

.home-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.intro-card,
.mail-card {
  min-height: 250px;
}

.intro-card {
  display: grid;
  align-content: center;
}

.intro-card h2,
.section-head h2,
.planning-intro h2,
.directory-hero h2,
.mail-card h2 {
  margin: 12px 0 0;
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  line-height: 0.94;
  letter-spacing: -0.06em;
}

.intro-card p,
.mail-card p,
.planning-intro p,
.directory-hero p,
.section-head p {
  color: var(--muted);
  line-height: 1.7;
}

.mail-card {
  display: grid;
  align-content: start;
  gap: 14px;
  background: linear-gradient(180deg, rgba(232, 240, 254, 1), rgba(245, 248, 255, 0.98));
}

.home-mail-preview {
  display: grid;
  gap: 10px;
}

.home-mail-row {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(26, 115, 232, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  text-align: left;
  cursor: pointer;
}

.home-mail-row:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(26, 115, 232, 0.18);
}

.home-mail-row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.home-mail-row-subject {
  font-weight: 700;
  color: var(--ink);
}

.home-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin: 18px 0 14px;
}

.shortcut-card {
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  padding: 18px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.shortcut-card:hover {
  transform: translateY(-1px);
  background: #f7faff;
  border-color: rgba(26, 115, 232, 0.16);
}

.shortcut-title {
  display: block;
  font-weight: 700;
  font-size: 1rem;
}

.shortcut-copy {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.news-strip {
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.page-footer {
  padding-top: 18px;
}

.news-track {
  display: flex;
  gap: 12px;
  width: max-content;
  animation: marquee 40s linear infinite;
  padding: 10px;
}

.news-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(248, 251, 253, 0.98);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.news-date {
  color: #0b57d0;
  font-size: 0.78rem;
  font-weight: 700;
}

.news-source {
  color: var(--muted);
  font-size: 0.78rem;
}

.section-head,
.directory-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.mail-head-actions {
  display: grid;
  gap: 12px;
  min-width: 260px;
}

.mail-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) minmax(320px, 0.92fr);
  gap: 16px;
  margin-top: 16px;
}

.mail-sidebar {
  display: grid;
  align-content: start;
  gap: 16px;
  background: transparent;
  box-shadow: none;
  border: 0;
  padding: 0;
}

.folder-list,
.mail-stats,
.stack,
.directory-grid {
  display: grid;
  gap: 12px;
}

.folder-button {
  border: 1px solid transparent;
  border-radius: 0 999px 999px 0;
  min-height: 40px;
  padding: 0 18px;
  text-align: left;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.folder-button.active {
  background: #d3e3fd;
  border-color: transparent;
  color: #0b57d0;
}

.compose-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  background: #c2e7ff;
  color: #0b57d0;
  font-weight: 700;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.compose-trigger:hover {
  background: #b4defc;
}

.mail-stat,
.entity-card,
.plan-summary-card,
.plan-card,
.replacement-card,
.directory-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  padding: 14px 16px;
}

.mail-stat strong,
.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.1rem;
}

.compose-form {
  display: grid;
  gap: 0;
  background: #ffffff;
  border-radius: 14px 14px 0 0;
  padding: 0;
  min-width: min(620px, calc(100vw - 32px));
}

.compose-head,
.block-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.compose-head {
  min-height: 48px;
  padding: 0 14px;
  align-items: center;
  background: #f2f6fc;
  border-bottom: 1px solid var(--line);
}

.compose-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.compose-window-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.compose-icon-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.compose-icon-button:hover {
  background: rgba(60, 64, 67, 0.08);
}

.compose-line {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(60, 64, 67, 0.12);
}

.compose-line:last-of-type {
  grid-template-columns: 1fr;
}

.compose-line input,
.compose-line select {
  min-height: auto;
  border: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.compose-line input:focus,
.compose-line select:focus {
  box-shadow: none;
  border: 0;
}

.compose-line-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.compose-editor {
  padding: 12px 14px 0;
}

.compose-editor textarea {
  min-height: 300px;
  border: 0;
  padding: 0;
  resize: none;
  box-shadow: none;
}

.compose-editor textarea:focus {
  box-shadow: none;
  border: 0;
}

.compose-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 0 14px 12px;
}

.compose-actions-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.compose-send {
  min-height: 40px;
  padding: 0 18px;
}

.compose-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compose-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.mail-row {
  display: grid;
  gap: 6px;
  width: 100%;
  border: 1px solid rgba(60, 64, 67, 0.08);
  border-radius: 14px;
  background: #ffffff;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
}

.mail-row.active {
  border-color: rgba(26, 115, 232, 0.16);
  background: #f2f6fc;
}

.mail-row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.mail-row-subject {
  font-weight: 700;
}

.mail-reader {
  min-height: 100%;
  line-height: 1.7;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.mail-center,
.mail-reader-wrap {
  background: transparent;
  box-shadow: none;
  border: 0;
  padding: 0;
}

.mail-reader h3 {
  margin: 0;
  font-size: 1.35rem;
}

.mail-reader-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.draft-status {
  color: var(--muted);
  font-size: 0.85rem;
}

#compose-dialog {
  position: fixed;
  right: 18px;
  bottom: 0;
  left: auto;
  top: auto;
  width: min(620px, calc(100vw - 24px));
  max-width: none;
  margin: 0;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 18px 48px rgba(24, 39, 59, 0.24);
}

#compose-dialog::backdrop {
  background: transparent;
}

.mail-row-preview,
.meta,
.empty-state,
.mail-reader-meta,
.directory-card span {
  color: var(--muted);
}

.mail-reader-meta {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.directory-card.detailed {
  display: grid;
  gap: 14px;
}

.compact-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.compact-card:hover {
  transform: translateY(-1px);
  border-color: rgba(26, 115, 232, 0.18);
  background: #f7faff;
}

.directory-card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.directory-card-head strong {
  display: block;
}

.directory-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3fd;
  color: #0b57d0;
  font-size: 0.8rem;
  font-weight: 700;
}

.directory-badge.is-warning {
  background: #fff1e6;
  color: #b85b00;
}

.directory-detail-list {
  display: grid;
  gap: 8px;
}

.directory-compact-list {
  display: grid;
  gap: 6px;
}

.directory-detail-list span strong {
  display: inline-block;
  min-width: 116px;
  color: var(--ink);
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}

.detail-head h3 {
  margin: 0;
  font-size: 1.45rem;
}

.detail-actions {
  display: flex;
  gap: 10px;
}

.mail-center {
  background: transparent;
  box-shadow: none;
  border: 0;
  padding: 0;
}

.directory-grid {
  margin-top: 16px;
  grid-template-columns: 1fr;
}

.directory-search-card {
  margin-top: 16px;
}

.directory-section {
  display: grid;
  gap: 14px;
}

.directory-section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.directory-section-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.directory-section-head h3 {
  margin: 0;
  font-size: 1.08rem;
}

.directory-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: #e8f0fe;
  color: #0b57d0;
  font-weight: 700;
}

.directory-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.planning-top {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.planning-intro {
  min-height: 180px;
}

.planning-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid rgba(60, 64, 67, 0.08);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  background: #ffffff;
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.planning-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.planning-side,
.planning-main {
  display: grid;
  gap: 16px;
}

.side-block {
  display: grid;
  gap: 12px;
}

.planning-form,
.settings-form,
.replacement-form {
  display: grid;
  gap: 14px;
}

.planning-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}

.replacement-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.planning-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.planning-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.planning-header h2 {
  margin: 8px 0 0;
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  letter-spacing: -0.05em;
  line-height: 1;
}

.planning-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
  max-width: 62ch;
}

.planning-metrics.compact {
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  min-width: min(100%, 360px);
}

.planning-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.82fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.planning-primary,
.planning-sidebar {
  display: grid;
  gap: 16px;
}

.plan-header {
  display: grid;
  gap: 10px;
}

.plan-header h2 {
  margin: 6px 0 0;
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  letter-spacing: -0.05em;
  line-height: 1;
}

.plan-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  max-width: 66ch;
}

.plan-floor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.plan-floor-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.plan-floor-pill.active {
  background: #d3e3fd;
  border-color: transparent;
  color: #0b57d0;
}

.plan-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.86fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.plan-map-card,
.plan-detail-card {
  padding: 18px;
}

.plan-frame-card {
  padding: 12px;
  margin-top: 16px;
}

.plan-embed {
  display: block;
  width: 100%;
  min-height: 960px;
  border: 0;
  border-radius: 22px;
  background: #f4f8fc;
}

.plan-launch-card {
  margin-top: 16px;
  padding: 32px;
}

.plan-launch-inner {
  display: grid;
  justify-items: start;
  gap: 14px;
  max-width: 640px;
}

.plan-launch-inner h3 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.05em;
}

.plan-launch-inner p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.plan-launch-button {
  min-height: 46px;
  padding: 0 20px;
}

.plan-map {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.plan-node {
  display: grid;
  gap: 6px;
  min-height: 112px;
  width: 100%;
  padding: 16px;
  border: 1px solid rgba(60, 64, 67, 0.12);
  border-radius: 18px;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.plan-node:hover {
  transform: translateY(-1px);
  border-color: rgba(26, 115, 232, 0.18);
  box-shadow: var(--shadow);
}

.plan-node.active {
  border-color: rgba(26, 115, 232, 0.3);
  background: #f4f8ff;
}

.plan-node.room {
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.96), rgba(255, 255, 255, 1));
}

.plan-node.station {
  background: linear-gradient(180deg, rgba(232, 240, 254, 0.96), rgba(255, 255, 255, 1));
}

.plan-node.common {
  background: linear-gradient(180deg, rgba(241, 248, 242, 0.96), rgba(255, 255, 255, 1));
}

.plan-node.service {
  background: linear-gradient(180deg, rgba(255, 246, 233, 0.96), rgba(255, 255, 255, 1));
}

.plan-node-label {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.plan-node-sub {
  color: var(--muted);
  line-height: 1.5;
}

.plan-detail-card {
  min-height: 100%;
}

.plan-detail {
  display: grid;
  gap: 14px;
}

.plan-detail h3 {
  margin: 0;
  font-size: 1.35rem;
}

.plan-detail-list {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.plan-detail-list strong {
  color: var(--ink);
  margin-right: 8px;
}

.planning-section-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 14px;
}

.planning-section-head h3 {
  margin: 0;
  font-size: 1.08rem;
}

.planning-generator-card,
.planning-output-card,
.planning-replacement-card,
.planning-data-card {
  padding: 18px;
}

.planning-form.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.planning-form.compact button {
  align-self: end;
}

.planning-inline-settings {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
}

.replacement-form.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.planning-data-card {
  display: grid;
  gap: 10px;
}

.planning-panel {
  border: 1px solid rgba(60, 64, 67, 0.08);
  border-radius: var(--radius-md);
  background: #ffffff;
  overflow: hidden;
}

.planning-panel summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

.planning-panel summary::-webkit-details-marker {
  display: none;
}

.planning-panel[open] summary {
  border-bottom: 1px solid var(--line);
}

.planning-panel > div {
  padding: 14px;
}

.planning-stack .entity-card {
  box-shadow: none;
  border-radius: var(--radius-sm);
}

.entity-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.entity-actions {
  display: flex;
  gap: 8px;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  color: var(--muted);
  cursor: pointer;
}

.small-button:hover {
  background: #f7faff;
  color: var(--ink);
}

.dialog-form {
  display: grid;
  gap: 14px;
  padding: 20px;
  background: #fff;
}

.dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.dialog-form h3 {
  margin: 0;
}

.form-error {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(219, 78, 93, 0.1);
  color: #a22838;
  font-weight: 700;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(720px, calc(100vw - 24px));
  box-shadow: 0 24px 60px rgba(24, 39, 59, 0.18);
}

dialog::backdrop {
  background: rgba(23, 33, 43, 0.3);
}

input,
select,
textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 10px 24px rgba(15, 23, 42, 0.04);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

textarea {
  min-height: 132px;
  padding: 14px 16px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(26, 115, 232, 0.34);
  background: #ffffff;
  box-shadow:
    0 0 0 4px rgba(26, 115, 232, 0.12),
    0 16px 30px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

select {
  appearance: none;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 16px center;
  background-size: auto, 18px;
  padding-right: 46px;
}

input[type="date"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"] {
  appearance: none;
}

input[type="date"] {
  position: relative;
  padding-right: 52px;
  letter-spacing: -0.01em;
  font-weight: 600;
  color: #0f172a;
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230b57d0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 16px center;
  background-size: auto, 18px;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  width: 42px;
  cursor: pointer;
}

input[type="date"]::-webkit-datetime-edit,
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="date"]::-webkit-datetime-edit-text,
input[type="date"]::-webkit-datetime-edit-month-field,
input[type="date"]::-webkit-datetime-edit-day-field,
input[type="date"]::-webkit-datetime-edit-year-field {
  color: #0f172a;
}

.planning-form label input,
.replacement-form label input,
.settings-form label input,
.planning-form label select,
.replacement-form label select,
.settings-form label select,
.directory-search-card input,
.global-search input,
.auth-form input {
  border-radius: 20px;
}

.planning-form label,
.replacement-form label,
.settings-form label {
  padding: 4px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.38);
}

@media (max-width: 1100px) {
  .home-grid,
  .mail-layout,
  .plan-layout,
  .planning-shell,
  .planning-top,
  .planning-layout,
  .planning-results,
  .directory-grid,
  .directory-cards {
    grid-template-columns: 1fr;
  }

  .planning-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .planning-metrics {
    grid-template-columns: 1fr;
  }

  .planning-header {
    flex-direction: column;
    align-items: start;
  }

  .planning-inline-settings {
    grid-template-columns: 1fr;
  }

  .global-search {
    max-width: none;
    order: 3;
    width: 100%;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 16px;
  }

  .topbar,
  .topbar-actions,
  .section-head,
  .block-head,
  .compose-head {
    flex-direction: column;
    align-items: start;
  }

  .mail-sidebar {
    gap: 10px;
  }

  .planning-form,
  .planning-form.compact,
  .replacement-form,
  .replacement-form.compact,
  .planning-inline-settings,
  .dialog-grid {
    grid-template-columns: 1fr;
  }

  .shortcut-card {
    width: 100%;
    min-width: 0;
  }

  .plan-map {
    grid-template-columns: 1fr;
  }
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  25% {
    transform: translate3d(24px, -18px, 0) rotate(12deg);
  }
  50% {
    transform: translate3d(-14px, 22px, 0) rotate(24deg);
  }
  75% {
    transform: translate3d(18px, -10px, 0) rotate(32deg);
  }
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
}
