:root {
  color-scheme: light;
  --canvas: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fd;
  --ink: #20243a;
  --muted: #81869c;
  --line: #e9ebf2;
  --purple: #665cf4;
  --purple-dark: #5549e6;
  --purple-soft: #efedff;
  --green: #22976b;
  --green-soft: #e6f7ef;
  --orange: #bf741d;
  --orange-soft: #fff3e4;
  --blue: #4386d9;
  --blue-soft: #e9f2ff;
  --red: #d45461;
  --shadow: 0 8px 24px rgba(34, 39, 67, .045);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: 248px;
  padding: 27px 16px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 7px 38px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark, .sidebar-bottom-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 12px;
  background: linear-gradient(145deg, #8279ff, #574be3);
  box-shadow: 0 5px 12px rgba(102, 92, 244, .22);
  color: white;
  font-size: 19px;
  font-weight: 750;
}

.brand-copy { display: grid; line-height: 1.15; }
.brand-copy b { font-size: 12px; letter-spacing: 1.25px; }
.brand-copy span { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 2.5px; }

.nav-label {
  margin: 0 12px 9px;
  color: #a4a8b8;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.15px;
}

.nav-label-lower { margin-top: 29px; }
.sidebar nav { display: grid; gap: 5px; }

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #686e83;
  text-align: left;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.nav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.nav:hover { background: #f7f7fc; color: var(--purple); }
.nav.active { border-color: #e9e7ff; background: var(--purple-soft); color: var(--purple-dark); font-weight: 650; }

.sidebar-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 13px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.sidebar-bottom-icon { width: 31px; height: 31px; border-radius: 9px; font-size: 14px; }
.sidebar-bottom div:nth-child(2) { display: grid; min-width: 0; }
.sidebar-bottom strong { font-size: 11px; font-weight: 650; }
.sidebar-bottom span:not(.online-indicator) { color: var(--muted); font-size: 10px; }
.online-indicator { width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: #e3a343; box-shadow: 0 0 0 3px #fff3e4; }
.online-indicator.online { background: #44bd88; box-shadow: 0 0 0 3px #e1f6eb; }

main { min-height: 100vh; margin-left: 248px; }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  min-height: 82px;
  padding: 14px clamp(22px, 4vw, 56px);
  border-bottom: 1px solid rgba(233, 235, 242, .9);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
}

.page-heading h1 { margin: 1px 0 0; font-size: 19px; font-weight: 680; letter-spacing: -.35px; }
.eyebrow, .dialog-kicker { color: var(--purple); font-size: 9px; font-weight: 750; letter-spacing: 1.4px; }
.topbar-right { display: flex; align-items: center; gap: 24px; margin-left: auto; }
.current-date { color: #73788d; font-size: 12px; }
.status { display: flex; align-items: center; gap: 8px; color: #74798c; font-size: 11px; }
.status span:first-child { width: 7px; height: 7px; border-radius: 50%; background: #e3a343; }
.status.online span:first-child { background: #43b781; box-shadow: 0 0 0 3px #e4f6ed; }

.content { width: min(100%, 1520px); margin: 0 auto; padding: 34px clamp(22px, 4vw, 56px) 56px; }
.dashboard-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 24px; }
.intro-copy h2 { margin: 6px 0 4px; font-size: clamp(24px, 3vw, 31px); font-weight: 680; letter-spacing: -1px; line-height: 1.2; }
.intro-copy p { margin: 0; color: var(--muted); font-size: 13px; }

.primary, .secondary, .actions button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.primary { background: var(--purple); box-shadow: 0 4px 10px rgba(102, 92, 244, .18); color: white; }
.primary:hover { transform: translateY(-1px); background: var(--purple-dark); }
.primary svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2; }
.secondary, .actions button { border-color: var(--line); background: var(--surface); color: #656b80; }
.secondary:hover, .actions button:hover { border-color: #c9c5ff; background: #faf9ff; color: var(--purple-dark); }
.text-button { min-height: 30px; padding: 0 5px; background: transparent; color: var(--purple-dark); }
.text-button:hover { color: #3930c5; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.stat-card {
  position: relative;
  min-height: 134px;
  padding: 19px 19px 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { color: #777c90; font-size: 11px; font-weight: 550; }
.stat-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-size: 14px; font-weight: 700; }
.stat-icon-purple { background: var(--purple-soft); color: var(--purple); }
.stat-icon-orange { background: var(--orange-soft); color: var(--orange); }
.stat-icon-green { background: var(--green-soft); color: var(--green); }
.stat-icon-blue { background: var(--blue-soft); color: var(--blue); }
.metric { margin-top: 10px; color: var(--ink); font-size: 27px; font-weight: 700; letter-spacing: -.9px; line-height: 1.1; }
.stat-note { margin-top: 7px; color: #9a9eae; font-size: 10px; }
.metric-word { font-size: 19px; letter-spacing: -.45px; }

.overview-layout { display: grid; grid-template-columns: minmax(0, 1fr) 286px; align-items: start; gap: 18px; margin-top: 20px; }
.surface-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.list-card { padding: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-heading h2, .toolbar h2 { margin: 0; font-size: 15px; font-weight: 680; letter-spacing: -.2px; }
.section-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.list { display: grid; gap: 9px; margin-top: 16px; }
.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #eff0f5;
  border-radius: 9px;
  background: #fff;
  transition: border-color .16s ease, background .16s ease;
}
.item:hover { border-color: #dfdcff; background: #fdfdff; }
.item > div:first-child { min-width: 0; }
.item h3 { margin: 0 0 3px; overflow: hidden; color: #30344a; font-size: 12px; font-weight: 650; text-overflow: ellipsis; }
.item p { margin: 0; overflow-wrap: anywhere; color: #9095a7; font-size: 10px; }
.actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.actions button { min-height: 30px; padding: 0 9px; font-size: 10px; }
.empty { padding: 25px 16px; border: 1px dashed #dedfeb; border-radius: 9px; color: #858a9d; text-align: center; font-size: 12px; }

.overview-aside { display: grid; gap: 14px; }
.welcome-card {
  position: relative;
  padding: 20px;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, #7067f5, #5147cf);
  box-shadow: 0 10px 24px rgba(86, 77, 213, .19);
  color: white;
}
.welcome-card::after { position: absolute; top: -34px; right: -34px; width: 130px; height: 130px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 18px rgba(255,255,255,.04), 0 0 0 38px rgba(255,255,255,.035); content: ""; }
.welcome-card .eyebrow { color: #d8d5ff; }
.welcome-card h3 { position: relative; z-index: 1; margin: 9px 0 6px; font-size: 16px; font-weight: 680; }
.welcome-card p { position: relative; z-index: 1; max-width: 230px; margin: 0 0 17px; color: rgba(255,255,255,.78); font-size: 11px; }
.welcome-card .primary { position: relative; z-index: 1; min-height: 34px; border-color: rgba(255,255,255,.18); background: white; box-shadow: none; color: #5147cf; font-size: 11px; }
.welcome-card .primary:hover { background: #f3f2ff; }
.workspace-card { padding: 17px; }
.workspace-card h3 { margin: 0; font-size: 12px; font-weight: 680; }
.workspace-card p { margin: 4px 0 13px; color: var(--muted); font-size: 10px; }
.workspace-state { display: flex; align-items: center; gap: 8px; padding: 10px 11px; border-radius: 8px; background: #f5f7fb; color: #73798c; font-size: 10px; }
.workspace-state span { width: 7px; height: 7px; border-radius: 50%; background: #e3a343; }
.workspace-state.online span { background: #43b781; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.view-description { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.view-panel { padding: 21px; }
.view-panel > .list { margin-top: 0; }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 8px; color: #777c90; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }
.panel p { margin: 0; color: #74798c; font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.menu {
  display: none;
  place-items: center;
  width: 37px;
  height: 37px;
  margin-right: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--ink);
  cursor: pointer;
}
.menu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }

dialog {
  width: min(490px, calc(100vw - 28px));
  max-height: min(90vh, 760px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(31, 35, 58, .2);
  color: var(--ink);
}
dialog::backdrop { background: rgba(34, 37, 57, .38); backdrop-filter: blur(3px); }
.dialog-form { display: grid; gap: 14px; padding: 28px; }
.dialog-form h2 { margin: -7px 0 -12px; font-size: 21px; letter-spacing: -.5px; }
.dialog-description { margin: 0; color: var(--muted); font-size: 12px; }
label { display: grid; gap: 6px; color: #5f6479; font-size: 11px; font-weight: 600; }
input, textarea, select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid #e3e5ee;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 400;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 82px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #adb1bf; }
input:focus, textarea:focus, select:focus { border-color: #9a93ff; box-shadow: 0 0 0 3px rgba(102, 92, 244, .1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialog-submit { width: 100%; margin-top: 3px; }
.error { min-height: 0; margin: 0; color: var(--red); font-size: 11px; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .overview-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-105%); box-shadow: 14px 0 34px rgba(31, 35, 58, .12); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  main { margin-left: 0; }
  .menu { display: grid; }
  .overview-layout { grid-template-columns: minmax(0, 1fr) 250px; }
}

@media (max-width: 620px) {
  .topbar { min-height: 72px; padding: 12px 17px; }
  .topbar-right { gap: 12px; }
  .current-date { display: none; }
  .content { padding: 25px 17px 40px; }
  .dashboard-intro { align-items: flex-start; flex-direction: column; }
  .overview-layout { grid-template-columns: minmax(0, 1fr); }
  .overview-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .welcome-card, .workspace-card { min-height: 100%; }
  .toolbar { align-items: flex-start; }
  .view-panel { padding: 14px; }
  .actions { justify-content: flex-start; }
  .item { align-items: flex-start; flex-direction: column; gap: 11px; }
}

@media (max-width: 420px) {
  .stats-grid, .grid, .overview-aside { grid-template-columns: minmax(0, 1fr); }
  .stat-card { min-height: 120px; }
  .topbar { padding-right: 13px; padding-left: 13px; }
  .status { gap: 6px; font-size: 10px; }
  .dialog-form { padding: 22px 18px; }
  .form-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
