:root {
  color-scheme: light;
  --ink: #17332e;
  --muted: #657972;
  --primary: #176b5b;
  --primary-strong: #0f5448;
  --primary-soft: #dff2ec;
  --accent: #e8b76b;
  --danger: #b44747;
  --warning: #a86a16;
  --success: #1b7b56;
  --canvas: #f3f7f5;
  --surface: #ffffff;
  --surface-soft: #f8fbf9;
  --border: #dce7e2;
  --shadow: 0 18px 48px rgba(28, 67, 58, 0.09);
  --radius: 18px;
  --sidebar: 252px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.boot,
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.boot {
  align-content: center;
  gap: 12px;
  color: var(--muted);
}

.login-page {
  grid-template-columns: minmax(320px, 0.9fr) minmax(440px, 1.1fr);
  padding: 28px;
  background:
    radial-gradient(circle at 12% 12%, rgba(232, 183, 107, 0.25), transparent 28%),
    linear-gradient(145deg, #e7f2ed 0%, #f7faf8 50%, #e8f0ed 100%);
}

.login-story {
  height: min(760px, calc(100vh - 56px));
  border-radius: 32px;
  padding: clamp(38px, 7vw, 86px);
  background:
    linear-gradient(160deg, rgba(9, 63, 53, 0.96), rgba(21, 105, 90, 0.9)),
    radial-gradient(circle, #247c6b, #0b4d42);
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.login-story::after {
  content: "";
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  position: absolute;
  right: -160px;
  bottom: -170px;
  box-shadow:
    0 0 0 48px rgba(255, 255, 255, 0.04),
    0 0 0 96px rgba(255, 255, 255, 0.025);
}

.login-story h1 {
  max-width: 620px;
  margin: 20px 0 18px;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.login-story p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
  font-size: 17px;
}

.story-points {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.story-points span {
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.login-panel {
  width: min(470px, 100%);
  justify-self: center;
  padding: 36px;
}

.brand,
.brand-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand {
  font-size: 20px;
}

.brand-inline {
  font-size: 19px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: var(--primary);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(23, 107, 91, 0.22);
}

.login-story .brand-mark {
  background: white;
  color: var(--primary);
}

.login-panel h2 {
  margin: 56px 0 8px;
  font-size: 32px;
  letter-spacing: -0.04em;
}

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

.login-panel form {
  margin-top: 30px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span,
.field label {
  color: #425a53;
  font-weight: 680;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  padding: 11px 13px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #55a391;
  box-shadow: 0 0 0 4px rgba(23, 107, 91, 0.1);
}

.btn {
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-weight: 750;
  color: var(--ink);
  background: #eef3f1;
  transition:
    transform 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 22px rgba(23, 107, 91, 0.2);
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-secondary {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.btn-danger {
  color: white;
  background: var(--danger);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.btn-block {
  width: 100%;
}

.login-note {
  margin-top: 22px;
  padding: 14px;
  background: #edf5f2;
  border-radius: 12px;
  color: #47645c;
  font-size: 12px;
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: #103d35;
  color: white;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebar .brand-inline {
  padding: 0 8px 24px;
}

.sidebar .brand-mark {
  width: 38px;
  height: 38px;
  background: #f8fffc;
  color: var(--primary);
  border-radius: 12px;
}

.nav {
  display: grid;
  gap: 5px;
  margin-top: 16px;
}

.nav-label {
  margin: 18px 12px 5px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 11px 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
}

.nav button:hover,
.nav button.active {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
  display: grid;
  place-items: center;
  font-size: 12px;
}

.sidebar-user {
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user strong {
  display: block;
  font-size: 13px;
}

.sidebar-user span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 11px;
}

.sidebar-user button {
  margin-top: 12px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: white;
  padding: 8px;
  border-radius: 10px;
}

.main {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  background: rgba(243, 247, 245, 0.88);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid rgba(220, 231, 226, 0.72);
}

.page-title h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.035em;
}

.page-title p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.menu-toggle {
  display: none;
}

.content {
  padding: 30px clamp(20px, 4vw, 48px) 56px;
  max-width: 1600px;
  margin: 0 auto;
}

.hero {
  min-height: 186px;
  padding: 28px 30px;
  border-radius: 24px;
  background:
    linear-gradient(120deg, rgba(15, 84, 72, 0.98), rgba(30, 128, 108, 0.92)),
    var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  right: -70px;
  top: -80px;
  border: 40px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(25px, 3vw, 38px);
  letter-spacing: -0.04em;
}

.hero p {
  margin: 0;
  max-width: 650px;
  color: rgba(255, 255, 255, 0.73);
  line-height: 1.55;
}

.hero-badge {
  position: relative;
  z-index: 1;
  min-width: 126px;
  text-align: center;
  padding: 18px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
}

.hero-badge strong {
  display: block;
  font-size: 28px;
}

.hero-badge span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.stat-card,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(24, 72, 61, 0.045);
}

.stat-card {
  padding: 20px;
}

.stat-card .label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.stat-card .value {
  margin-top: 14px;
  font-size: 28px;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.stat-card .trend {
  margin-top: 7px;
  color: var(--success);
  font-size: 11px;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.8fr);
  gap: 20px;
}

.card {
  padding: 21px;
}

.card-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-header {
  margin-bottom: 16px;
}

.card-header h3,
.section-header h2 {
  margin: 0;
  letter-spacing: -0.025em;
}

.card-header h3 {
  font-size: 16px;
}

.section-header {
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 24px;
}

.section-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 13px;
  border: 1px solid #e4ece8;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 13px 14px;
  text-align: left;
  border-bottom: 1px solid #edf2ef;
  font-size: 13px;
  vertical-align: middle;
}

th {
  color: var(--muted);
  background: #f8faf9;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fbfdfc;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  background: #edf2f0;
  color: #557068;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-success {
  background: #e4f5ec;
  color: #237a58;
}

.badge-warning {
  background: #fff2dd;
  color: #a96c20;
}

.badge-danger {
  background: #fbe8e8;
  color: #b84c4c;
}

.badge-info {
  background: #e5f0fb;
  color: #346c9f;
}

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

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px;
  border: 1px solid #e6eeea;
  border-radius: 13px;
  background: #fcfefd;
}

.list-item strong {
  display: block;
  font-size: 13px;
}

.list-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 850;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
}

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.empty strong {
  color: var(--ink);
  display: block;
  margin-bottom: 5px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar .search {
  width: min(360px, 100%);
}

.timeline {
  display: grid;
  gap: 15px;
}

.timeline-item {
  position: relative;
  padding: 18px 18px 18px 46px;
  background: #fbfdfc;
  border: 1px solid var(--border);
  border-radius: 15px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 23px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 5px var(--primary-soft);
}

.timeline-item h4 {
  margin: 0 0 6px;
}

.timeline-item p {
  margin: 6px 0;
  color: #445e57;
  line-height: 1.55;
  white-space: pre-wrap;
}

.timeline-meta {
  color: var(--muted);
  font-size: 11px;
}

.ai-panel {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
}

.draft-editor {
  min-height: 430px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
}

.notice {
  margin: 14px 0;
  padding: 13px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: #fff9ee;
  color: #6e593b;
  font-size: 12px;
  line-height: 1.55;
}

.notice-secure {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: #335b51;
}

.video-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.video-stage {
  min-height: 540px;
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: #0c2420;
  box-shadow: var(--shadow);
}

.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  background: #0c2420;
}

.video-local {
  width: 180px !important;
  height: 132px !important;
  inset: auto 16px 16px auto !important;
  z-index: 2;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.65);
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  text-align: center;
}

.call-controls {
  position: absolute;
  z-index: 3;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}

.call-controls button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-weight: 900;
}

.call-controls .end {
  background: #c44e4e;
  color: white;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 0;
  border-radius: 20px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(11, 44, 37, 0.28);
}

dialog::backdrop {
  background: rgba(12, 40, 34, 0.5);
  backdrop-filter: blur(4px);
}

.dialog-head,
.dialog-body,
.dialog-foot {
  padding: 20px 24px;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.dialog-head h2 {
  margin: 0;
  font-size: 19px;
}

.dialog-head button {
  border: 0;
  background: #eef3f1;
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 9px;
}

.toast {
  width: min(380px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 13px;
  background: #163f37;
  color: white;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease-out;
  font-size: 13px;
}

.toast.error {
  background: #993f3f;
}

.loading {
  padding: 50px;
  text-align: center;
  color: var(--muted);
}

@keyframes toast-in {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
}

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2,
  .ai-panel,
  .video-layout {
    grid-template-columns: 1fr;
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-story {
    display: none;
  }

  .login-panel {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    box-shadow: var(--shadow);
  }
}

@media (max-width: 780px) {
  :root {
    --sidebar: 270px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.18);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    display: block;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar {
    padding: 10px 14px;
  }

  .content {
    padding: 20px 14px 42px;
  }

  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 15px;
  }

  .stat-card .value {
    font-size: 22px;
  }

  .hero {
    padding: 23px;
    min-height: 160px;
  }

  .hero-badge {
    display: none;
  }

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

  .form-grid .wide {
    grid-column: auto;
  }

  .video-stage {
    min-height: 420px;
  }

  .video-local {
    width: 118px !important;
    height: 90px !important;
  }
}

@media (max-width: 470px) {
  .login-page {
    padding: 0;
  }

  .login-panel {
    min-height: 100vh;
    width: 100%;
    border: 0;
    border-radius: 0;
    padding: 28px 22px;
  }

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

  .top-actions .btn-secondary {
    display: none;
  }
}

.public-page {
  min-height: 100vh;
  padding: 40px 18px;
  display: grid;
  place-items: start center;
  background:
    radial-gradient(circle at top left, rgba(23, 107, 91, 0.14), transparent 34%),
    var(--canvas);
}

.public-card {
  width: min(880px, 100%);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.public-card.compact {
  width: min(560px, 100%);
}

.public-card > .brand-inline {
  margin-bottom: 28px;
}

.public-card h1 {
  margin: 0 0 8px;
  color: var(--ink);
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.slot-option {
  position: relative;
  cursor: pointer;
}

.slot-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.slot-option span {
  display: block;
  padding: 11px 12px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  font-weight: 700;
  transition: 160ms ease;
}

.slot-option input:checked + span {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: 0 6px 18px rgba(23, 107, 91, 0.2);
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding-top: 8px;
}

.check-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.check-row input {
  width: auto;
  min-height: auto;
}

.summary-box {
  display: grid;
  gap: 8px;
  margin: 24px 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}

.success-panel {
  min-height: 300px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-size: 2rem;
  font-weight: 800;
}

@media (max-width: 640px) {
  .public-page {
    padding: 16px 10px;
  }

  .public-card {
    padding: 20px;
    border-radius: 18px;
  }

  .public-card .section-header {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
