:root {
  --bg: #07111f;
  --surface: #0e1b2d;
  --surface-2: #14253b;
  --surface-3: #1a2f49;
  --text: #f7fbff;
  --muted: #95a9c2;
  --accent: #46d6a9;
  --accent-2: #66a9ff;
  --danger: #ff6f7d;
  --warning: #ffc767;
  --success: #58d68d;
  --line: rgba(255,255,255,.09);
  --shadow: 0 20px 50px rgba(0,0,0,.28);
  --radius: 22px;
  --radius-sm: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 5%, rgba(102,169,255,.12), transparent 28rem),
    radial-gradient(circle at 95% 20%, rgba(70,214,169,.1), transparent 24rem),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, label, .material-card { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.app-shell { min-height: 100vh; padding-bottom: calc(96px + var(--safe-bottom)); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 18px 12px;
  background: linear-gradient(180deg, rgba(7,17,31,.96), rgba(7,17,31,.76));
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  cursor: pointer;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #051018;
  font-weight: 950;
  box-shadow: 0 8px 24px rgba(70,214,169,.22);
}
.brand strong { display: block; font-size: 18px; letter-spacing: -.02em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn, .avatar-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.045);
  cursor: pointer;
}

.main-content { width: min(1120px, 100%); margin: 0 auto; padding: 18px; outline: none; }
.screen { animation: screenIn .22s ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } }

.hero {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(20,37,59,.96), rgba(10,25,42,.92));
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -100px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(70,214,169,.22), transparent 65%);
  pointer-events: none;
}
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 6vw, 48px); line-height: 1.04; letter-spacing: -.045em; }
h2 { margin-bottom: 8px; font-size: clamp(22px, 4vw, 32px); letter-spacing: -.03em; }
h3 { margin-bottom: 6px; font-size: 17px; }
.lead { max-width: 700px; margin-bottom: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }

.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.section-title { margin: 0; }

.service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.service-card {
  position: relative;
  min-height: 150px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(20,37,59,.95), rgba(13,27,45,.95));
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.service-card:active { transform: scale(.985); }
.service-card:hover { border-color: rgba(70,214,169,.4); }
.service-icon { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 18px; border-radius: 18px; background: rgba(255,255,255,.07); font-size: 29px; }
.service-card strong { display: block; font-size: 17px; }
.service-card small { display: block; margin-top: 4px; color: var(--muted); }
.service-card .arrow { position: absolute; right: 16px; bottom: 16px; color: var(--accent); font-size: 20px; }

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.04);
}
.quick-card strong { display: block; font-size: 24px; }
.quick-card span { color: var(--muted); font-size: 12px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14,27,45,.84);
  box-shadow: var(--shadow);
}
.panel-body { padding: 18px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.05);
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn-primary { border-color: transparent; background: linear-gradient(135deg, var(--accent), #39bfa6); color: #04120f; }
.btn-secondary { background: rgba(102,169,255,.12); border-color: rgba(102,169,255,.22); color: #ddebff; }
.btn-danger { background: rgba(255,111,125,.1); border-color: rgba(255,111,125,.25); color: #ffd7db; }
.btn-ghost { background: transparent; }
.btn-small { min-height: 36px; padding: 0 12px; border-radius: 11px; font-size: 13px; }
.btn-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }

.job-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.job-title-wrap { display: flex; align-items: center; gap: 13px; }
.job-title-wrap .service-icon { flex: 0 0 auto; margin: 0; }
.progress-wrap { margin: 18px 0 6px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.progress-track { height: 10px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.06); }
.progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s ease; }
.material-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.material-card {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer;
  transition: .18s ease;
}
.material-card.checked { border-color: rgba(70,214,169,.7); transform: translateY(-1px); }
.material-card.checked::after {
  content: "✓";
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #06110f;
  font-weight: 950;
  box-shadow: 0 8px 20px rgba(70,214,169,.25);
}
.material-image { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #12253a; }
.material-card.checked .material-image { opacity: .48; filter: grayscale(.6); }
.material-info { padding: 12px; }
.material-info strong { display: block; line-height: 1.2; }
.material-info small { display: block; margin-top: 4px; color: var(--muted); }

.empty-state { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 70px; height: 70px; margin: 0 auto 16px; border-radius: 22px; background: rgba(255,255,255,.05); font-size: 34px; }

.task-toolbar { display: flex; gap: 10px; margin: 14px 0; }
.task-toolbar input { flex: 1; }
.task-list { display: grid; gap: 10px; }
.task-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255,255,255,.035);
}
.task-check {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(70,214,169,.42);
  background: rgba(70,214,169,.08);
  cursor: pointer;
}
.task-type { display: inline-flex; margin-top: 6px; padding: 3px 8px; border-radius: 999px; background: rgba(102,169,255,.1); color: #cfe3ff; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.task-actions { display: flex; gap: 6px; }
.mini-btn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.04); cursor: pointer; }

.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.week-nav { display: flex; align-items: center; gap: 8px; }
.week-label { min-width: 170px; text-align: center; font-weight: 800; }
.calendar-scroller { overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(132px, 1fr)); min-width: 924px; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: rgba(255,255,255,.025); }
.day-column { min-height: 430px; border-right: 1px solid var(--line); background: rgba(255,255,255,.012); }
.day-column:last-child { border-right: 0; }
.day-column.today { background: rgba(70,214,169,.045); }
.day-head { position: sticky; top: 0; z-index: 1; padding: 12px; border-bottom: 1px solid var(--line); background: rgba(14,27,45,.96); text-align: center; }
.day-head strong { display: block; font-size: 13px; text-transform: capitalize; }
.day-head span { display: inline-grid; place-items: center; width: 34px; height: 34px; margin-top: 5px; border-radius: 50%; font-size: 16px; font-weight: 850; }
.day-column.today .day-head span { background: var(--accent); color: #06110f; }
.day-body { display: grid; gap: 8px; padding: 9px; }
.appointment-card { padding: 10px; border-left: 3px solid var(--accent-2); border-radius: 11px; background: rgba(102,169,255,.1); cursor: pointer; }
.appointment-card strong { display: block; font-size: 12px; }
.appointment-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.add-slot { min-height: 38px; border: 1px dashed rgba(255,255,255,.13); border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }

.settings-grid { display: grid; gap: 16px; }
.settings-card { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: rgba(14,27,45,.82); }
.settings-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.settings-card-body { padding: 16px; }
.form-grid { display: grid; gap: 13px; }
.form-row { display: grid; gap: 6px; }
.form-row label { color: #c8d7e8; font-size: 12px; font-weight: 750; }
input, textarea, select {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 13px;
  background: rgba(4,12,22,.55);
  color: var(--text);
  outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: rgba(70,214,169,.58); box-shadow: 0 0 0 3px rgba(70,214,169,.08); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.switch { position: relative; width: 50px; height: 28px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; border-radius: 999px; background: #33445a; transition: .2s; }
.slider::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%; background: white; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(22px); }
.service-settings-list, .material-settings-list { display: grid; gap: 9px; }
.manage-row { display: flex; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.manage-icon { display: grid; place-items: center; width: 45px; height: 45px; flex: 0 0 auto; border-radius: 14px; background: rgba(255,255,255,.06); font-size: 23px; overflow: hidden; }
.manage-icon img { width: 100%; height: 100%; object-fit: cover; }
.manage-copy { min-width: 0; flex: 1; }
.manage-copy strong, .manage-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-copy small { margin-top: 3px; color: var(--muted); }
.manage-actions { display: flex; gap: 5px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(10px, var(--safe-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(560px, calc(100% - 20px));
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 23px;
  background: rgba(9,20,34,.92);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.nav-item { display: grid; place-items: center; gap: 3px; min-height: 56px; border: 0; border-radius: 17px; background: transparent; color: var(--muted); cursor: pointer; }
.nav-item span { font-size: 20px; }
.nav-item small { font-size: 10px; font-weight: 800; }
.nav-item.active { background: rgba(70,214,169,.11); color: var(--accent); }

.voice-fab {
  position: fixed;
  right: 18px;
  bottom: calc(94px + var(--safe-bottom));
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 17px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #42c4bf);
  color: #04120f;
  font-weight: 900;
  box-shadow: 0 15px 35px rgba(70,214,169,.28);
  cursor: pointer;
}
.voice-fab.listening { background: linear-gradient(135deg, #ff8f9a, #ff6f7d); }
.voice-fab.listening .voice-pulse { display: block; }
.voice-pulse { display: none; position: absolute; inset: -6px; border: 2px solid rgba(255,111,125,.6); border-radius: inherit; animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1.18); opacity: 0; } }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; align-items: end; padding: 14px; background: rgba(0,0,0,.62); backdrop-filter: blur(8px); animation: fadeIn .18s ease; }
.modal { width: min(620px, 100%); max-height: min(88vh, 900px); margin: 0 auto; overflow: auto; border: 1px solid var(--line); border-radius: 25px; background: #0e1b2d; box-shadow: 0 24px 70px rgba(0,0,0,.5); animation: modalUp .22s ease; }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px; border-bottom: 1px solid var(--line); background: rgba(14,27,45,.96); backdrop-filter: blur(12px); }
.modal-head h2 { margin: 0; font-size: 21px; }
.modal-body { padding: 18px; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.close-btn { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.04); cursor: pointer; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalUp { from { transform: translateY(20px); opacity: 0; } }

.voice-sheet { text-align: center; }
.voice-orb { display: grid; place-items: center; width: 112px; height: 112px; margin: 10px auto 18px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #86f2d3, var(--accent) 45%, #188d79); color: #06120f; font-size: 42px; box-shadow: 0 0 0 12px rgba(70,214,169,.07), 0 0 0 24px rgba(70,214,169,.035); }
.voice-orb.listening { animation: breathe 1.2s infinite alternate; }
@keyframes breathe { to { transform: scale(1.06); box-shadow: 0 0 0 16px rgba(255,111,125,.1), 0 0 0 30px rgba(255,111,125,.04); } }
.transcript-box { min-height: 68px; margin: 14px 0; padding: 14px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: left; }
.intent-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 13px; }
.intent-option { min-height: 52px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.035); cursor: pointer; }
.intent-option.selected { border-color: var(--accent); background: rgba(70,214,169,.1); }

.image-drop { display: grid; place-items: center; min-height: 180px; padding: 15px; border: 1px dashed rgba(255,255,255,.18); border-radius: 18px; background: rgba(255,255,255,.025); text-align: center; cursor: pointer; }
.image-preview { width: 100%; max-height: 260px; object-fit: cover; border-radius: 15px; }
.help { color: var(--muted); font-size: 12px; line-height: 1.5; }
.warning-box { padding: 13px; border: 1px solid rgba(255,199,103,.22); border-radius: 14px; background: rgba(255,199,103,.07); color: #ffe1ad; font-size: 12px; line-height: 1.5; }
.success-box { padding: 14px; border: 1px solid rgba(70,214,169,.26); border-radius: 15px; background: rgba(70,214,169,.08); color: #caffef; }

.toast-root { position: fixed; left: 50%; bottom: calc(170px + var(--safe-bottom)); z-index: 200; width: min(420px, calc(100% - 30px)); transform: translateX(-50%); pointer-events: none; }
.toast { margin-top: 8px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(16,32,51,.96); box-shadow: 0 14px 35px rgba(0,0,0,.35); animation: toastIn .25s ease both; }
.toast.error { border-color: rgba(255,111,125,.3); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

@media (min-width: 760px) {
  .main-content { padding: 28px; }
  .service-grid { grid-template-columns: repeat(4, 1fr); }
  .material-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .modal-backdrop { align-items: center; }
  .voice-fab { right: max(28px, calc((100vw - 1120px)/2 + 20px)); }
}

@media (min-width: 1040px) {
  .material-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 460px) {
  .main-content { padding: 14px; }
  .hero { padding: 22px; }
  .service-card { min-height: 138px; padding: 15px; }
  .service-icon { width: 48px; height: 48px; margin-bottom: 15px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .voice-label { display: none; }
  .voice-fab { width: 58px; padding: 0; justify-content: center; }
  .task-toolbar { flex-direction: column; }
  .button-row .btn { flex: 1; }
}
