:root {
  --ink: #17212f;
  --muted: #647184;
  --line: #d9e0ea;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --nav: #111827;
  --accent: #0f766e;
  --accent-2: #2563eb;
  --warn: #b45309;
  --danger: #be123c;
  --success: #15803d;
  --shadow: 0 16px 40px rgba(17, 24, 39, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface-2);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  color: #eef4ff;
  background: var(--nav);
}

.brand,
.sidebar-panel {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
}

.brand strong,
.sidebar-panel strong {
  display: block;
}

.brand-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.developer-credit {
  color: #cdd7e5;
  font-size: 12px;
  line-height: 1.35;
}

.developer-credit a {
  color: #9ee7dc;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.japan-flag {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 14px;
  margin: 0 2px;
  vertical-align: -2px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: #ffffff;
}

.japan-flag::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: #bc002d;
  transform: translate(-50%, -50%);
}

.brand span,
.sidebar-panel p {
  display: block;
  margin: 2px 0 0;
  color: #a9b6c9;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #cdd7e5;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.14);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 940px;
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.topbar-actions,
.segmented {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  color: var(--ink);
  background: var(--surface);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  white-space: nowrap;
}

.primary-button {
  border-color: #0b5f59;
  color: #ffffff;
  background: var(--accent);
}

.secondary-button:hover,
.icon-button:hover {
  border-color: #aeb9c8;
}

.icon-button {
  display: grid;
  width: 42px;
  place-items: center;
}

.icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.calendar-icon,
.clock-icon,
.pipeline-icon,
.pulse-icon,
.refresh-icon,
.plus-icon,
.close-icon {
  border: 2px solid currentColor;
  border-radius: 5px;
}

.clock-icon {
  border-radius: 50%;
}

.clock-icon::before,
.pulse-icon::before,
.refresh-icon::before,
.plus-icon::before,
.plus-icon::after,
.close-icon::before,
.close-icon::after {
  position: absolute;
  content: "";
  background: currentColor;
}

.clock-icon::before {
  width: 2px;
  height: 7px;
  top: 3px;
  left: 8px;
  box-shadow: 4px 6px 0 currentColor;
}

.pipeline-icon::before {
  position: absolute;
  inset: 3px;
  content: "";
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.pulse-icon {
  border-radius: 50%;
}

.pulse-icon::before {
  width: 10px;
  height: 2px;
  top: 8px;
  left: 4px;
  box-shadow: 4px -4px 0 currentColor, 8px 0 0 currentColor;
}

.refresh-icon {
  border-left-color: transparent;
  border-radius: 50%;
}

.refresh-icon::before {
  width: 6px;
  height: 6px;
  right: -1px;
  top: 1px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.plus-icon,
.close-icon {
  border: 0;
}

.plus-icon::before,
.plus-icon::after,
.close-icon::before,
.close-icon::after {
  width: 14px;
  height: 2px;
  top: 8px;
  left: 2px;
}

.plus-icon::after {
  transform: rotate(90deg);
}

.close-icon::before {
  transform: rotate(45deg);
}

.close-icon::after {
  transform: rotate(-45deg);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-strip article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-strip article {
  padding: 16px;
}

.metric-strip span,
.metric-strip small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-strip strong {
  display: block;
  margin: 6px 0;
  font-size: 30px;
  line-height: 1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(330px, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.schedule-panel {
  grid-row: span 2;
}

.timeline,
.action-stack,
.account-list,
.automation-list,
.playbook {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.appointment,
.action-item,
.account-row,
.deal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.appointment {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
}

.time-chip {
  padding: 8px 10px;
  border-radius: 8px;
  color: #0f172a;
  background: #e7eef8;
  font-weight: 800;
  text-align: center;
}

.appointment p,
.action-item p,
.account-row p,
.deal-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.confirmed {
  color: #075e45;
  background: #d9f7ea;
}

.badge.pending {
  color: #7a4a08;
  background: #fff1d5;
}

.badge.risk,
.badge.blocked {
  color: #9f1239;
  background: #ffe4e6;
}

.badge.vip {
  color: #1d4ed8;
  background: #dbeafe;
}

select,
input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.panel-heading select {
  max-width: 180px;
}

.visual-panel canvas {
  width: 100%;
  height: auto;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.action-item {
  display: flex;
  gap: 12px;
  padding: 14px;
}

.action-index {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent-2);
  font-weight: 800;
}

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

.segmented {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segmented button {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.segmented button.active {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.12);
}

.calendar-grid {
  display: grid;
  grid-template-columns: 90px repeat(3, minmax(120px, 1fr));
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.calendar-cell {
  min-height: 72px;
  padding: 10px;
  background: #ffffff;
}

.calendar-cell.header {
  min-height: auto;
  color: var(--muted);
  background: #f0f4fa;
  font-weight: 800;
}

.calendar-cell.slot {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.calendar-event {
  display: block;
  min-height: 48px;
  padding: 9px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #ecfdf5;
  color: #064e3b;
  font-size: 13px;
  font-weight: 800;
}

.automation-list label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.automation-list input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 18px;
  overflow-x: auto;
}

.pipeline-column {
  min-width: 180px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fc;
}

.pipeline-column h3 {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.deal-card {
  padding: 12px;
  margin-bottom: 10px;
}

.deal-value {
  display: block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 800;
}

.account-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.health-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.health-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--success);
}

.health-meter.warn span {
  background: var(--warn);
}

.health-meter.danger span {
  background: var(--danger);
}

.playbook-step {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.playbook-step.complete {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.playbook-step.active {
  border-color: #bfdbfe;
  background: #eff6ff;
}

dialog {
  width: min(460px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(17, 24, 39, 0.28);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.44);
}

.booking-form {
  display: grid;
  gap: 14px;
}

.booking-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .sidebar-panel {
    display: none;
  }

  .dashboard-grid,
  .workspace-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .panel-heading select,
  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .metric-strip {
    grid-template-columns: 1fr 1fr;
  }

  .appointment,
  .account-row {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    grid-template-columns: 72px repeat(3, minmax(140px, 1fr));
    overflow-x: auto;
  }
}

@media (max-width: 500px) {
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }
}
