:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-strong: #f0f4f8;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e1ea;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #0f8a5f;
  --amber: #b7791f;
  --red: #c24135;
  --teal: #0e7490;
  --shadow: 0 12px 30px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  background: #111827;
  color: #f9fafb;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #38bdf8;
  color: #082f49;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span:not(.brand-mark) {
  color: #a7b0c0;
  font-size: 0.82rem;
  margin-top: 2px;
}

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

.nav-item {
  border: 0;
  border-radius: 8px;
  color: #d5dae3;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #1f2937;
  color: #ffffff;
}

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

.panel-label,
.eyebrow {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.side-panel .panel-label {
  color: #93c5fd;
}

.side-panel p {
  color: #cbd5e1;
  line-height: 1.45;
  margin: 10px 0 0;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.api-notice {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-weight: 700;
}

.storage-status {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #344054;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 32px;
  padding: 0 10px;
}

.storage-status.database {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.storage-status.local {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

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

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

.icon-button {
  width: 40px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.primary-button {
  padding: 0 14px;
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.ghost-button {
  padding: 0 14px;
}

.danger-button {
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: var(--red);
  font-weight: 800;
  min-height: 40px;
  padding: 0 14px;
}

.danger-button:hover {
  background: #fee2e2;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.metrics article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.metrics span {
  color: var(--muted);
  display: block;
  font-size: 0.84rem;
}

.metrics strong {
  display: block;
  font-size: 1.65rem;
  margin-top: 4px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.search-box {
  min-width: min(420px, 100%);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  min-height: 42px;
}

.search-box input {
  border: 0;
  outline: 0;
  width: 100%;
}

.segmented {
  display: flex;
  background: #e8edf3;
  border-radius: 8px;
  padding: 4px;
}

.segmented button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  min-height: 34px;
  padding: 0 12px;
  color: #475467;
}

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

.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-weight: 600;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(230px, 1fr));
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 14px;
}

.column {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 520px;
  padding: 10px;
}

.column.drag-over {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px 12px;
}

.column-header h2 {
  font-size: 0.95rem;
  margin: 0;
}

.count-pill,
.tag,
.risk,
.status-pill {
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 700;
}

.count-pill {
  background: #dbe5f0;
  color: #314155;
}

.card-list {
  display: grid;
  gap: 10px;
}

.migration-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  box-shadow: 0 4px 14px rgba(22, 32, 42, 0.06);
}

.migration-card:hover,
.migration-card.selected {
  border-color: var(--blue);
}

.migration-card[draggable="true"] {
  cursor: grab;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.domain {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  overflow-wrap: anywhere;
}

.client {
  color: var(--muted);
  margin: 4px 0 10px;
  font-size: 0.88rem;
}

.card-meta,
.route {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.route {
  color: #475467;
  font-size: 0.78rem;
  margin-top: 10px;
}

.tag.cPanel {
  background: #dbeafe;
  color: #1e40af;
}

.tag.Plesk {
  background: #cffafe;
  color: #155e75;
}

.tag.Shared {
  background: #dcfce7;
  color: #166534;
}

.risk.Low {
  background: #e7f7ef;
  color: var(--green);
}

.risk.Medium {
  background: #fff4d8;
  color: var(--amber);
}

.risk.High {
  background: #fee2df;
  color: var(--red);
}

.progress {
  margin-top: 12px;
}

.progress-bar {
  height: 8px;
  background: #edf2f7;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.progress small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.drawer {
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 22px;
  overflow-y: auto;
}

.drawer-empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  color: #94a3b8;
  font-size: 2.2rem;
}

.detail-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.detail-header h2 {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.detail-grid div,
.note-panel,
.links-panel,
.note-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.detail-grid span,
.checklist span {
  color: var(--muted);
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.checklist {
  display: grid;
  gap: 9px;
  margin: 18px 0;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.check-item input {
  width: 18px;
  height: 18px;
}

.note-panel,
.links-panel,
.note-box {
  margin-top: 18px;
}

.note-panel textarea,
.note-box textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  min-height: 108px;
  width: 100%;
  background: #ffffff;
  outline: 0;
  margin-top: 10px;
  padding: 10px;
  line-height: 1.45;
}

.note-box {
  display: block;
}

.note-box > span {
  color: #344054;
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 10px;
}

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

.panel-title span,
.dialog-section strong {
  color: #344054;
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
}

.link-list,
.link-editor-list,
.dialog-links {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.profile-link {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  display: flex;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 10px;
  text-decoration: none;
}

.profile-link span {
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-text {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 10px 0 0;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(70px, 0.7fr) minmax(110px, 1fr) 34px;
  gap: 6px;
  width: 100%;
}

.link-row input {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 36px;
  min-width: 0;
  padding: 0 9px;
}

.compact-button {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.small-icon-button {
  width: 34px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--red);
}

.status-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 10px;
  background: #ffffff;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
  width: min(520px, calc(100vw - 28px));
}

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

.dialog-card {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.dialog-card header,
.dialog-card footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.dialog-card h2 {
  margin: 0;
}

.dialog-card label {
  color: #344054;
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.dialog-card input,
.dialog-card select {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 10px;
}

.dialog-section {
  display: grid;
  gap: 8px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar {
    padding: 18px 10px;
    align-items: center;
  }

  .brand div,
  .nav-item span:last-child,
  .side-panel {
    display: none;
  }

  .drawer {
    position: fixed;
    inset: auto 14px 14px 14px;
    max-height: 65vh;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 2;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

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

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .board {
    grid-template-columns: repeat(5, minmax(250px, 82vw));
  }

  .drawer {
    position: static;
    max-height: none;
    border-radius: 0;
    border-width: 1px 0 0;
  }
}
