*:focus {
  outline: none !important;
}

* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@import url('https://fonts.googleapis.com/css2?family=Advent+Pro:wght@300;400;500;600;700&family=Ysabeau+Infant:wght@300;400;500;600;700&family=Roboto+Mono:wght@300;400;500;600;700&family=Nunito:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-ui: "Ysabeau Infant", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-heading: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --font-paragraph: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --primary: #1cb7ff;
  --primary-dim: rgba(28, 183, 255, 0.1);
  --accent: #2EC4B6;
  --success: #27AE60;
  --warn: #F2994A;
  --danger: #EB5757;

  --bg-body: #F4F6F8;
  --bg-gradient: radial-gradient(circle at 50% 0%, #eef2f3 0%, #F4F6F8 60%);
  --surface: #FFFFFF;
  --surface-highlight: #F0F2F5;
  --border: rgba(0, 0, 0, 0.08);

  --text-main: #111111;
  --text-sec: #666666;

  --nav-bg: rgba(255, 255, 255, 0.9);
  --nav-blur: 20px;
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.05);

  --font-main: var(--font-ui);
  --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
}

[data-theme="dark"] {
  --bg-body: #050505;
  --bg-gradient: radial-gradient(circle at 50% 0%, #1c1812 0%, #050505 60%);
  --surface: #141414;
  --surface-highlight: #1F1F1F;
  --border: rgba(255, 255, 255, 0.08);

  --text-main: #FFFFFF;
  --text-sec: #999999;

  --nav-bg: rgba(20, 20, 20, 0.9);
  --shadow-card: none;
}

html,
body {
  height: 100%;
  font-family: var(--font-main);
  background: var(--bg-body);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

.h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  font-family: var(--font-heading);
}

.h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  font-family: var(--font-heading);
}

.h3 {
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-heading);
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
}

p {
  font-family: var(--font-paragraph);
}

.txt-sm {
  font-size: 13px;
  color: var(--text-sec);
  font-weight: 500;
}

.txt-xs {
  font-size: 11px;
  color: var(--text-sec);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.app-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px 120px 20px;
  position: relative;
  min-height: 100vh;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s var(--ease-out);
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  margin-bottom: 10px;
}

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

.menu-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-btn svg {
  width: 24px;
  height: 24px;
  stroke-width: 2px;
}

.hero {
  margin-bottom: 20px;
}

.greeting {
  margin-bottom: 20px;
}

.greeting .sub {
  opacity: 0.7;
  font-weight: 500;
}

.prog-track {
  height: 4px;
  width: 100%;
  background: var(--surface-highlight);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 1s var(--ease-out);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  margin-top: 32px;
}

.link-btn {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.card {
  background: var(--surface);
  border-radius: 24px;
  padding: 20px;
  position: relative;
  transition: transform 0.2s;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.card:active {
  transform: scale(0.99);
}

.next-card {
  background: linear-gradient(145deg, var(--surface) 0%, var(--surface-highlight) 100%);
}

.tag {
  display: inline-flex;
  padding: 6px 12px;
  background: rgba(255, 159, 28, 0.15);
  color: var(--primary);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 12px;
}

.cta-btn {
  margin-top: 16px;
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  background: var(--text-main);
  color: var(--bg-body);
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  transition: opacity 0.2s;
}

.cta-btn:active {
  opacity: 0.8;
}

.cta-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.ent-card {
  background: radial-gradient(circle at 100% 0%, rgba(46, 196, 182, 0.15) 0%, rgba(0, 0, 0, 0) 50%), var(--surface);
  border: 1px solid rgba(46, 196, 182, 0.3);
  margin-bottom: 24px;
  overflow: hidden;
}

.ent-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 100px;
  height: 100px;
  background: var(--accent);
  filter: blur(60px);
  opacity: 0.4;
}

.ent-btn {
  background: var(--accent);
  color: #000;
}

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

.sub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  aspect-ratio: 1/1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
  box-shadow: var(--shadow-card);
}

.sub-card:active {
  background: var(--surface-highlight);
}

.sub-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  color: var(--text-main);
}

.sub-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.sub-icon.active {
  background: var(--primary);
  color: #fff;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--surface);
  border-radius: 18px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.deadline {
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.deadline.urgent {
  color: var(--warn);
}

/* Order status colors */
.deadline.st-new {
  color: var(--primary);
}

.deadline.st-in_progress {
  color: var(--success);
}

.deadline.st-completed {
  color: var(--danger);
}

.deadline.st-cancelled {
  color: var(--warn);
}

.status-text {
  font-weight: 800;
}

.status-text.st-new {
  color: var(--primary);
}

.status-text.st-in_progress {
  color: var(--success);
}

.status-text.st-completed {
  color: var(--danger);
}

.status-text.st-cancelled {
  color: var(--warn);
}

/* AI FLOAT BTN */
.ai-float-btn {
  position: fixed;
  bottom: 110px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #00d2ff 100%);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(28, 183, 255, 0.4);
  z-index: 98;
  cursor: pointer;
  transition: transform 0.2s;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.ai-float-btn:active {
  transform: scale(0.9);
}

.ai-float-btn svg {
  width: 28px;
  height: 28px;
}

/* AI MODAL */
.ai-modal {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  height: 85vh;
  background: var(--surface);
  border-radius: 30px 30px 0 0;
  z-index: 2000;
  transition: bottom 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.ai-modal.active {
  bottom: 0;
}

.ai-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.ai-close {
  background: var(--surface-highlight);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-sec);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* CHAT INSIDE MODAL */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-ai {
  background: var(--surface-highlight);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  color: var(--text-main);
}

.chat-user {
  background: var(--primary);
  color: #000;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  font-weight: 700;
}

.modal-input-area {
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  padding-bottom: 30px;
}

.chat-input {
  flex: 1;
  background: var(--surface-highlight);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 14px;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  cursor: pointer;
}

/* NAV */
.nav-island {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  background: var(--nav-bg);
  backdrop-filter: blur(var(--nav-blur));
  -webkit-backdrop-filter: blur(var(--nav-blur));
  padding: 8px 12px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
  z-index: 100;
}

.nav-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sec);
  cursor: pointer;
  transition: 0.2s;
}

.nav-btn.active {
  color: var(--text-main);
  background: var(--surface-highlight);
}

.nav-btn.active svg {
  stroke: var(--primary);
}

.nav-btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 8px;
  box-shadow: 0 10px 20px rgba(28, 183, 255, 0.3);
  cursor: pointer;
  transition: transform 0.2s;
}

.nav-fab:active {
  transform: scale(0.92);
}

.nav-fab svg {
  width: 26px;
  height: 26px;
  stroke: currentColor;
  stroke-width: 2px;
}

/* SIDEBAR */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
  backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--surface);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.4s var(--ease-out);
  padding: 30px 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

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

.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s;
  color: var(--text-sec);
  font-weight: 600;
  font-size: 14px;
}

.menu-item:active {
  transform: scale(0.98);
  background: var(--surface-highlight);
}

.menu-item:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.03);
}

.icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-highlight);
  color: inherit;
  transition: 0.2s;
}

.menu-item:hover .icon-box {
  background: var(--primary);
  color: #000;
}

.menu-item svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Typing */
.typing-dots span {
  animation: blink 1.4s infinite both;
  font-size: 24px;
  line-height: 10px;
  margin: 0 1px;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0% {
    opacity: 0.2;
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0.2;
  }
}

.chat-ai b {
  color: var(--primary);
  font-weight: 700;
}

/* TOAST + SERVICES + PROFILE UI */
.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: white;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s var(--ease-out);
  z-index: 3000;
  max-width: calc(100% - 40px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.course-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.course-search {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 14px;
  position: sticky;
  top: 10px;
  z-index: 2;
}

.course-accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.acc-head {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.acc-head .left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.acc-head .right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.acc-body {
  padding: 0 16px 14px 16px;
  display: none;
}

.course-accordion.open .acc-body {
  display: block;
}

.chev {
  width: 18px;
  height: 18px;
  opacity: 0.75;
  transition: transform 0.2s var(--ease-out);
}

.course-accordion.open .chev {
  transform: rotate(180deg);
}

.course-item {
  padding: 12px 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.course-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.course-title {
  font-size: 14px;
  font-weight: 700;
}

.course-meta {
  font-size: 12px;
  color: var(--text-sec);
  font-weight: 600;
}

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

.course-btn {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-highlight);
  color: var(--text-main);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.course-btn.primary {
  background: var(--primary);
  color: #000;
  border-color: transparent;
}

.mini-track {
  height: 6px;
  width: 100%;
  background: var(--surface-highlight);
  border-radius: 999px;
  overflow: hidden;
}

.mini-fill {
  height: 100%;
  width: 0%;
  background: var(--success);
  border-radius: 999px;
  transition: width 0.5s var(--ease-out);
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
  margin-top: 14px;
  box-shadow: var(--shadow-card);
}

.profile-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--surface-highlight);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 20px;
  color: var(--primary);
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.pstat {
  background: var(--surface-highlight);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
}

.pstat .v {
  font-size: 18px;
  font-weight: 900;
}

.pstat .l {
  font-size: 11px;
  color: var(--text-sec);
  font-weight: 700;
  text-transform: uppercase;
}

/* AUTH (login / register) */
.auth-card {
  margin-top: 14px;
}

.auth-switch {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: var(--surface-highlight);
  border: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-main);
  font-weight: 800;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-card);
}

.auth-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form.hidden {
  display: none;
}

.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 600;
}

.auth-input::placeholder {
  color: var(--text-sec);
  opacity: 0.85;
}

.auth-select {
  appearance: none;
}

@media (max-width: 420px) {
  .auth-row {
    grid-template-columns: 1fr;
  }
}

/* MESSAGES TAB */
.msg-item {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border-radius: 20px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  transition: background 0.2s;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.msg-item:active {
  background: var(--surface-highlight);
}

.msg-av {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #333;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.msg-content {
  flex: 1;
  min-width: 0;
}

.msg-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.msg-name {
  font-weight: 700;
  font-size: 14px;
}

.msg-time {
  font-size: 11px;
  color: var(--text-sec);
}

.msg-text {
  font-size: 13px;
  color: var(--text-sec);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-badge {
  background: var(--primary);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
}

/* SETTINGS UI */
.setting-group {
  background: var(--surface);
  border-radius: 20px;
  padding: 6px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 12px;
}

.setting-row:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.setting-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.setting-icon {
  color: var(--text-sec);
}

/* TOGGLE SWITCH */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface-highlight);
  border: 1px solid var(--border);
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
  background-color: var(--primary);
  border-color: transparent;
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* LANGUAGE SEGMENTED CONTROL */
.lang-switch {
  background: var(--surface-highlight);
  padding: 4px;
  border-radius: 12px;
  display: flex;
  border: 1px solid var(--border);
}

.lang-opt {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-sec);
  transition: 0.2s;
}

.lang-opt.active {
  background: var(--surface);
  color: var(--text-main);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* ORDER CREATE SHEET */
.sheet-modal {
  position: fixed;
  bottom: -120%;
  left: 0;
  right: 0;
  height: 78vh;
  background: var(--surface);
  border-radius: 30px 30px 0 0;
  z-index: 2200;
  transition: bottom 0.35s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.sheet-modal.active {
  bottom: 0;
}

.sheet-header {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.sheet-body {
  padding: 18px 20px;
  overflow: auto;
}

/* =============================
   Subscription (master) page
   ============================= */

/* Theme-aware tokens for subscription UI */
:root {
  --sub-icon-border: var(--border);
  --sub-icon-bg: var(--surface);
  --sub-card-bg: var(--surface);
  --sub-card-border: var(--border);
  --sub-track-bg: var(--surface-highlight);
  --sub-track-border: var(--border);
  --sub-feature-text: var(--text-sec);
  --sub-foot-bg: var(--surface-highlight);
  --sub-foot-border: var(--border);
  --sub-foot-text: var(--text-sec);
  --sub-error-bg: rgba(239, 68, 68, .08);
  --sub-error-border: rgba(239, 68, 68, .35);
  --sub-error-text: var(--text-main);
}

[data-theme="dark"] {
  --sub-icon-border: rgba(255, 255, 255, .12);
  --sub-icon-bg: rgba(255, 255, 255, .05);
  --sub-card-bg: rgba(255, 255, 255, .03);
  --sub-card-border: rgba(255, 255, 255, .10);
  --sub-track-bg: rgba(255, 255, 255, .15);
  --sub-track-border: rgba(255, 255, 255, .14);
  --sub-feature-text: rgba(255, 255, 255, .78);
  --sub-foot-bg: rgba(255, 255, 255, .06);
  --sub-foot-border: rgba(255, 255, 255, .10);
  --sub-foot-text: rgba(255, 255, 255, .75);
  --sub-error-bg: rgba(239, 68, 68, .08);
  --sub-error-border: rgba(239, 68, 68, .35);
  --sub-error-text: rgba(255, 255, 255, .92);
}

.sub-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 18px 40px 18px;
}

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

.sub-appbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sub-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--sub-icon-border);
  background: var(--sub-icon-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  text-decoration: none;
}

.sub-title {
  font-size: 18px;
  font-weight: 800;
  font-family: var(--font-heading);
}

.sub-card {
  background: var(--sub-card-bg);
  border: 1px solid var(--sub-card-border);
  border-radius: 18px;
  padding: 16px;

  /* reset generic .sub-card (used elsewhere as square tiles) */
  aspect-ratio: auto;
  text-align: left;
  cursor: default;
  display: block;
  box-shadow: none;
}

.sub-autorenew {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.sub-autorenew .sub-autorenew-label {
  font-weight: 800;
  font-family: var(--font-heading);
}

.sub-autorenew .sub-autorenew-desc {
  margin-top: 2px;
  color: var(--text-sec);
  font-size: 12px;
  font-family: var(--font-paragraph);
}

.sub-switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
}

.sub-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.sub-switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--sub-track-bg);
  border: 1px solid var(--sub-track-border);
  transition: all .18s ease;
}

.sub-switch .thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  transition: transform .18s ease;
}

.sub-switch input:checked+.track {
  background: rgba(59, 130, 246, .85);
  border-color: rgba(59, 130, 246, .95);
}

.sub-switch input:checked+.track .thumb {
  transform: translateX(20px);
}

.sub-plans {
  display: grid;
  gap: 14px;
}

.sub-plan {
  position: relative;
  padding: 18px 18px 16px 18px;
}

.sub-plan.is-current {
  border-color: rgba(34, 211, 238, .8);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, .25) inset;
}

.sub-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 211, 238, .9);
  color: #061018;
  font-size: 11px;
  font-weight: 800;
}

.sub-plan-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.sub-plan-title {
  font-size: 15px;
  font-weight: 900;
  font-family: var(--font-heading);
}

.sub-price {
  margin-top: 4px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.sub-price .val {
  font-size: 26px;
  font-weight: 900;
  font-family: var(--font-heading);
}

.sub-price .per {
  color: var(--text-sec);
  font-size: 12px;
  font-family: var(--font-paragraph);
}

.sub-features {
  margin: 12px 0 14px 0;
  display: grid;
  gap: 8px;
}

.sub-feature {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--sub-feature-text);
  font-size: 12px;
  font-family: var(--font-paragraph);
}

.sub-feature::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: rgba(34, 211, 238, .16);
  border: 1px solid rgba(34, 211, 238, .28);
  margin-top: 1px;
  flex: 0 0 auto;
}

.sub-plan-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 900;
  font-family: var(--font-heading);
  cursor: pointer;
  background: #ffffff;
  color: #0b0d10;
}

.sub-plan-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
}

.sub-plan-foot {
  margin-top: 12px;
  height: 38px;
  border-radius: 14px;
  background: var(--sub-foot-bg);
  border: 1px solid var(--sub-foot-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sub-foot-text);
  font-size: 12px;
  font-family: var(--font-paragraph);
}

.sub-error {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--sub-error-border);
  background: var(--sub-error-bg);
  color: var(--sub-error-text);
  font-size: 13px;
  font-family: var(--font-paragraph);
}

/* ORDER CHAT MODAL */
.order-modal {
  position: fixed;
  bottom: -110%;
  left: 0;
  right: 0;
  height: 88vh;
  background: var(--surface);
  border-radius: 30px 30px 0 0;
  z-index: 2300;
  transition: bottom 0.35s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.55);
}

.order-modal.active {
  bottom: 0;
}

.order-header {
  padding: 14px 14px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.order-back {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-highlight);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.order-title {
  font-weight: 900;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-sub {
  font-size: 11px;
  color: var(--text-sec);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-action {
  padding: 10px 12px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: #000;
  font-weight: 900;
  cursor: pointer;
}

.order-action:active {
  opacity: 0.85;
}

/* Make order list items look clickable */
.msg-item .msg-text {
  max-width: 360px;
}

/* Review box inside order chat */
.reviewBox {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.reviewTitle {
  font-weight: 700;
  margin-bottom: 10px;
}

.reviewRow {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.reviewSelect {
  flex: 0 0 90px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
}

.reviewBtn {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: var(--primary);
  color: #061018;
  font-weight: 700;
}

.reviewBtn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.reviewText {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  resize: vertical;
}

/* ===== PROFILE EDIT BUTTON ===== */
.profile-edit-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-highlight);
  color: var(--text-sec);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.profile-edit-btn:hover {
  background: var(--primary);
  color: #000;
}

.profile-edit-btn:active {
  transform: scale(0.93);
}

/* ===== PROFILE BIO ===== */
.profile-bio {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-sec);
  background: var(--surface-highlight);
  border-radius: 14px;
  padding: 10px 14px;
}

/* ===== PROFILE EDIT MODAL FORM ===== */
.prof-edit-section {
  margin-bottom: 16px;
}

.prof-edit-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* ===== AVATAR COLOR PICKER ===== */
.avatar-picker-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.av-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.25s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.av-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.av-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.av-dot:hover {
  transform: scale(1.18);
}

.av-dot.selected {
  border-color: var(--text-main);
  transform: scale(1.22);
  box-shadow: 0 0 0 3px var(--bg-body), 0 0 0 5px currentColor;
}

/* ===== SHEET OVERLAY (переиспользуем для profile edit) ===== */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2399;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===== PROFILE EDIT BUTTON ===== */
.profile-edit-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-highlight);
  color: var(--text-sec);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.profile-edit-btn:hover {
  background: var(--primary);
  color: #000;
}

.profile-edit-btn:active {
  transform: scale(0.93);
}

/* ===== PROFILE BIO ===== */
.profile-bio {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-sec);
  background: var(--surface-highlight);
  border-radius: 14px;
  padding: 10px 14px;
}

/* ===== PROFILE EDIT MODAL FORM ===== */
.prof-edit-section {
  margin-bottom: 16px;
}

.prof-edit-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* ===== AVATAR COLOR PICKER ===== */
.avatar-picker-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.av-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  transition: background 0.25s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.av-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.av-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.av-dot:hover {
  transform: scale(1.18);
}

.av-dot.selected {
  border-color: var(--text-main);
  transform: scale(1.22);
  box-shadow: 0 0 0 3px var(--bg-body), 0 0 0 5px currentColor;
}

/* ===== SHEET OVERLAY (переиспользуем для profile edit) ===== */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2399;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ===== SHEET MODAL (profile edit, order create, etc.) ===== */
.sheet-modal {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
  z-index: 2400;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.sheet-modal.active {
  transform: translateY(0);
  pointer-events: auto;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sheet-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* ===== PROFILE EDIT BUTTON ===== */
.profile-edit-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-highlight);
  color: var(--text-sec);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}

.profile-edit-btn:hover {
  background: var(--primary);
  color: #000;
}

.profile-edit-btn:active {
  transform: scale(0.93);
}