:root {
  color-scheme: light;
  --ink: #16302c;
  --muted: #657a76;
  --line: #dce8e4;
  --soft: #f2f8f5;
  --paper: #ffffff;
  --forest: #143f3a;
  --forest-2: #1e5d53;
  --mint: #65d7b0;
  --mint-soft: #dff7ed;
  --blue: #3278a8;
  --blue-soft: #e6f2fa;
  --amber: #a46713;
  --amber-soft: #fff1d6;
  --red: #a7443d;
  --red-soft: #fdebea;
  --shadow: 0 18px 50px rgba(31, 68, 60, .10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -8%, rgba(101, 215, 176, .17), transparent 34rem),
    linear-gradient(180deg, #f8fbfa 0, #eef5f2 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(50, 120, 168, .32);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: -80px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #fff;
  background: var(--forest);
}
.skip-link:focus { top: 12px; }

.portal-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 48px; }

.topbar {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  grid-auto-flow: column;
  align-content: center;
  justify-content: center;
  border-radius: 13px;
  color: #fff;
  background: var(--forest);
  box-shadow: 0 8px 18px rgba(20, 63, 58, .18);
  font-weight: 800;
  letter-spacing: -.08em;
}
.brand-mark span:last-child { color: var(--mint); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-size: 19px; letter-spacing: -.02em; }
.brand-copy small { margin-top: 5px; color: var(--muted); font-size: 12px; letter-spacing: .17em; text-transform: uppercase; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.environment-badge { padding: 6px 10px; border-radius: 999px; color: var(--forest-2); background: var(--mint-soft); font-size: 13px; font-weight: 700; }
.profile-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--forest-2), var(--blue));
  font-weight: 800;
}

.state-panel {
  min-height: min(680px, calc(100vh - 116px));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 44px 20px;
}
.state-panel h1 { margin: 10px 0 8px; font-size: clamp(30px, 5vw, 54px); letter-spacing: -.045em; }
.state-panel p { max-width: 590px; color: var(--muted); }
.state-icon { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; color: #fff; background: var(--forest); font-size: 34px; font-weight: 800; box-shadow: var(--shadow); }
.state-symbol { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--forest-2); border-radius: 50%; }
.pulse { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.state-copy { margin: 0 0 24px; }

.primary-button, .secondary-button, .hero-action {
  min-height: 46px;
  border-radius: 12px;
  font-weight: 750;
}
.primary-button { border: 0; padding: 0 22px; color: #fff; background: var(--forest-2); }
.primary-button:disabled { cursor: not-allowed; opacity: .58; }
.secondary-button { padding: 0 16px; border: 1px solid var(--line); color: var(--forest); background: var(--paper); }
.text-link { margin-top: 20px; color: var(--forest-2); }

.preview-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px dashed #9ccabc;
  border-radius: 12px;
  color: var(--forest-2);
  background: rgba(223, 247, 237, .7);
  font-size: 13px;
}
.preview-controls label { font-weight: 800; }
.preview-controls select { min-height: 38px; border: 1px solid #b9d9cf; border-radius: 9px; padding: 0 30px 0 10px; color: var(--ink); background: #fff; }
.preview-controls span { color: var(--muted); }

.hero {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: clamp(28px, 5vw, 54px);
  border-radius: 30px;
  color: #f4fffb;
  background:
    linear-gradient(118deg, rgba(20, 63, 58, .98), rgba(29, 92, 82, .92)),
    var(--forest);
  box-shadow: 0 24px 60px rgba(20, 63, 58, .18);
}
.hero::after {
  content: "";
  position: absolute;
  right: -100px;
  top: -170px;
  width: 420px;
  height: 420px;
  border: 70px solid rgba(101, 215, 176, .10);
  border-radius: 50%;
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { margin: 4px 0 12px; font-size: clamp(36px, 6vw, 64px); line-height: 1.05; letter-spacing: -.055em; }
.hero .eyebrow { color: #a9e7d1; }
.hero-copy { max-width: 620px; margin: 0; color: #cfe8e0; }
.hero-action {
  flex: 0 0 210px;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 14px 18px;
  border: 1px solid rgba(255,255,255,.18);
  color: var(--forest);
  background: var(--mint);
  text-align: left;
}
.hero-action span { font-size: 17px; font-weight: 850; }
.hero-action small { margin-top: 3px; opacity: .72; }

.eyebrow { margin: 0; color: var(--forest-2); font-size: 12px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 16px 0 36px; }
.summary-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.88); box-shadow: 0 10px 30px rgba(31,68,60,.05); }
.summary-card small { display: block; color: var(--muted); }
.summary-card strong { display: block; margin-top: 5px; color: var(--forest); font-size: 20px; letter-spacing: -.02em; }

.content-section { margin-top: 36px; }
.section-heading, .page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 16px; }
.section-heading h2, .page-heading h1 { margin: 4px 0 0; letter-spacing: -.035em; }
.section-heading h2 { font-size: 28px; }
.page-heading h1 { font-size: clamp(34px, 5vw, 54px); }
.section-heading > p, .page-heading p { margin: 0; color: var(--muted); }
.page-heading { align-items: center; margin: 26px 0; }
.page-heading > div > p:last-child { margin-top: 8px; }

.module-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.module-card {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  background: rgba(255,255,255,.92);
  box-shadow: 0 12px 34px rgba(31,68,60,.055);
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.module-card:hover { transform: translateY(-3px); border-color: #afd5c8; box-shadow: var(--shadow); }
.module-card:active { transform: translateY(-1px); }
.module-card[disabled] { cursor: default; opacity: .68; }
.module-card[disabled]:hover { transform: none; box-shadow: 0 12px 34px rgba(31,68,60,.055); }
.module-icon { width: 43px; height: 43px; display: grid; place-items: center; margin-bottom: auto; border-radius: 13px; color: var(--forest-2); background: var(--mint-soft); font-size: 20px; font-weight: 800; }
.module-card[data-tone="blue"] .module-icon { color: var(--blue); background: var(--blue-soft); }
.module-card[data-tone="amber"] .module-icon { color: var(--amber); background: var(--amber-soft); }
.module-card h3 { margin: 18px 0 3px; font-size: 18px; letter-spacing: -.02em; }
.module-card p { margin: 0; color: var(--muted); font-size: 13px; }
.module-card .module-state { margin-top: 10px; color: var(--forest-2); font-size: 12px; font-weight: 800; }

.activity-list, .booking-list { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.9); }
.activity-item, .booking-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.activity-item:last-child, .booking-item:last-child { border-bottom: 0; }
.activity-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 5px var(--mint-soft); }
.activity-dot.amber { background: #e3a33e; box-shadow: 0 0 0 5px var(--amber-soft); }
.activity-copy strong, .booking-copy strong { display: block; }
.activity-copy small, .booking-copy small { color: var(--muted); }
.activity-time { color: var(--muted); font-size: 13px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.search-box { flex: 1 1 360px; display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.search-box span { color: var(--muted); font-size: 24px; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { min-height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; }
.filter-chip.active { border-color: var(--forest-2); color: #fff; background: var(--forest-2); }

.instrument-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.instrument-card { overflow: hidden; border: 1px solid var(--line); border-radius: 21px; background: #fff; box-shadow: 0 12px 36px rgba(31,68,60,.06); }
.instrument-visual { position: relative; height: 138px; padding: 18px; background: linear-gradient(145deg, #dff7ed, #eef7f5); }
.instrument-visual::after { content: ""; position: absolute; right: 24px; bottom: -45px; width: 120px; height: 120px; border: 24px solid rgba(30,93,83,.07); border-radius: 50%; }
.instrument-code { display: inline-flex; padding: 6px 9px; border-radius: 8px; color: var(--forest-2); background: rgba(255,255,255,.72); font-size: 12px; font-weight: 850; }
.instrument-body { padding: 18px; }
.instrument-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.instrument-head h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.status-pill { flex: none; padding: 5px 9px; border-radius: 999px; color: var(--forest-2); background: var(--mint-soft); font-size: 12px; font-weight: 800; }
.status-pill.training { color: var(--amber); background: var(--amber-soft); }
.status-pill.planning { color: var(--blue); background: var(--blue-soft); }
.instrument-meta { display: flex; gap: 12px; margin: 9px 0; color: var(--muted); font-size: 13px; }
.instrument-description { min-height: 48px; margin: 0; color: var(--muted); font-size: 14px; }
.instrument-actions { display: flex; gap: 8px; margin-top: 16px; }
.instrument-actions button { flex: 1; min-height: 42px; border: 1px solid var(--line); border-radius: 11px; color: var(--forest); background: #fff; font-weight: 750; }
.instrument-actions .book-button { border-color: var(--forest-2); color: #fff; background: var(--forest-2); }
.instrument-actions button:disabled { cursor: not-allowed; opacity: .55; }
.empty-state { padding: 40px 20px; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); text-align: center; }

.booking-item { grid-template-columns: 68px 1fr auto; }
.booking-date { padding: 9px 6px; border-radius: 13px; color: var(--forest-2); background: var(--mint-soft); text-align: center; }
.booking-date strong, .booking-date small { display: block; }
.booking-date strong { font-size: 22px; line-height: 1; }
.booking-state { padding: 6px 10px; border-radius: 999px; color: var(--forest-2); background: var(--mint-soft); font-size: 12px; font-weight: 800; }

.profile-content { display: grid; grid-template-columns: minmax(260px, .75fr) 1.25fr; gap: 18px; }
.profile-card { padding: 24px; border: 1px solid var(--line); border-radius: 21px; background: #fff; }
.profile-card h2 { margin: 0 0 14px; font-size: 21px; }
.profile-identity { display: flex; align-items: center; gap: 14px; }
.profile-avatar { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: #fff; background: var(--forest); font-size: 20px; font-weight: 850; }
.profile-identity strong, .profile-identity small { display: block; }
.profile-identity small { color: var(--muted); }
.permission-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.permission-list li { padding: 7px 10px; border-radius: 9px; color: var(--forest-2); background: var(--mint-soft); font-size: 13px; }

.bottom-nav { display: none; }

@media (max-width: 900px) {
  .module-grid { grid-template-columns: repeat(3, 1fr); }
  .instrument-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-box { flex-basis: auto; }
}

@media (max-width: 680px) {
  body { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .portal-shell { width: min(100% - 22px, 1180px); padding-bottom: 24px; }
  .topbar { min-height: 70px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .environment-badge { display: none; }
  .hero { min-height: 0; align-items: flex-start; flex-direction: column; padding: 28px 22px; border-radius: 23px; }
  .hero h1 { font-size: 38px; }
  .hero-action { width: 100%; min-height: 72px; flex-basis: auto; }
  .summary-grid { grid-template-columns: 1fr; gap: 8px; margin-bottom: 30px; }
  .summary-card { padding: 14px 16px; }
  .summary-card strong { font-size: 17px; }
  .section-heading { align-items: flex-start; }
  .section-heading > p { display: none; }
  .module-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .module-card { min-height: 154px; padding: 15px; border-radius: 17px; }
  .module-card h3 { font-size: 17px; }
  .module-card p { line-height: 1.45; }
  .activity-item { grid-template-columns: auto 1fr; }
  .activity-time { display: none; }
  .page-heading { align-items: flex-start; }
  .page-heading .secondary-button { display: none; }
  .filter-row { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
  .filter-chip { flex: none; }
  .instrument-grid { grid-template-columns: 1fr; }
  .instrument-visual { height: 112px; }
  .booking-item { grid-template-columns: 60px 1fr; }
  .booking-state { grid-column: 2; justify-self: start; }
  .profile-content { grid-template-columns: 1fr; }
  .preview-controls { align-items: flex-start; flex-wrap: wrap; }
  .preview-controls span { flex-basis: 100%; }
  .bottom-nav {
    position: fixed;
    z-index: 60;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: min(100%, 680px);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(220,232,228,.9);
    background: rgba(255,255,255,.94);
    box-shadow: 0 -12px 30px rgba(31,68,60,.08);
    backdrop-filter: blur(18px);
  }
  .bottom-nav button { min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: 12px; color: var(--muted); background: transparent; }
  .bottom-nav button span { font-size: 20px; line-height: 1; }
  .bottom-nav button small { font-size: 11px; }
  .bottom-nav button.active { color: var(--forest-2); background: var(--mint-soft); }
}

@media (max-width: 390px) {
  .brand-copy strong { font-size: 17px; }
  .brand-copy small { font-size: 10px; }
  .module-grid { grid-template-columns: 1fr 1fr; }
  .module-card { min-height: 150px; }
  .module-card p { font-size: 12px; }
}

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