:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f0f3f6;
  --ink: #111318;
  --muted: #606978;
  --line: #dfe4ea;
  --accent: #0c5c75;
  --accent-strong: #083e50;
  --success: #0f7a4f;
  --danger: #b42318;
  --shadow: 0 22px 70px rgba(18, 28, 45, 0.12);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

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

.brand-logo-shell {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #111318;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.brand-logo-shell img {
  display: none;
}

.brand-logo-shell::before,
.brand-logo-shell::after {
  content: "";
  position: absolute;
  left: 12px;
  width: 20px;
  height: 3px;
  border-radius: 99px;
  background: #ffffff;
  transform: rotate(-28deg);
}

.brand-logo-shell::before {
  top: 16px;
}

.brand-logo-shell::after {
  top: 25px;
  width: 14px;
  background: #7bdff2;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  font-size: 1rem;
}

.brand-lockup small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.auth-page {
  background:
    linear-gradient(135deg, rgba(12, 92, 117, 0.06), transparent 34%),
    linear-gradient(180deg, #fff 0%, #f5f7f9 100%);
}

.auth-layout {
  min-height: 100vh;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 64px;
  align-items: center;
  padding: 42px 0;
}

.auth-brand-panel {
  min-width: 0;
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 0;
}

.auth-copy {
  width: 100%;
  max-width: 640px;
  min-width: 0;
}

.auth-copy h1 {
  margin: 0;
  max-width: 620px;
  font-size: clamp(2.5rem, 4.4vw, 4.4rem);
  line-height: 1.06;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.auth-copy p:last-child {
  max-width: 540px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.ops-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ops-list div {
  min-height: 116px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
}

.ops-list span {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 900;
}

.ops-list strong {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
}

.ops-list small {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.auth-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card-head h2 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0;
}

.auth-card-head p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 18px;
  margin-top: 30px;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  outline: 0;
  background: #fff;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(12, 92, 117, 0.12);
}

.checkbox-row {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 10px !important;
  color: var(--muted) !important;
  font-size: 0.92rem;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.primary-button,
.secondary-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius);
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent-strong);
  color: #fff;
  background: var(--accent-strong);
}

.primary-button:hover {
  background: #062f3d;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  padding: 0 16px;
}

.secondary-button:hover {
  border-color: var(--ink);
}

.primary-button svg,
.secondary-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-message.error {
  color: var(--danger);
}

.auth-note {
  margin-top: 24px;
  padding: 14px;
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.9rem;
  line-height: 1.5;
}

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

.crm-sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 26px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

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

.crm-nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: #2e3642;
  font-weight: 700;
}

.crm-nav a span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--accent-strong);
  background: rgba(12, 92, 117, 0.09);
  font-size: 0.72rem;
  font-weight: 900;
}

.crm-nav a.active,
.crm-nav a:hover {
  background: var(--surface-soft);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.crm-main {
  min-width: 0;
}

.crm-topbar {
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
}

.crm-topbar h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0;
}

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

.session-pill {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 0.9rem;
}

.crm-content {
  display: grid;
  gap: 24px;
  padding: 30px 34px 44px;
}

.status-panel {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #fff;
}

.status-panel.ok {
  color: var(--success);
  border-color: rgba(15, 122, 79, 0.26);
  background: rgba(15, 122, 79, 0.06);
}

.status-panel.error {
  color: var(--danger);
  border-color: rgba(180, 35, 24, 0.26);
  background: rgba(180, 35, 24, 0.06);
}

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

.metric-card {
  min-height: 190px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.metric-card span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 1.55rem;
}

.metric-card p,
.work-panel p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.work-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.work-panel h2 {
  margin: 0;
  font-size: 2rem;
}

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

.workflow-list div {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: #2e3642;
  font-weight: 700;
}

.workflow-list span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--accent-strong);
}

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

  .auth-brand-panel {
    min-height: auto;
    gap: 44px;
    padding: 24px 0 0;
  }

  .ops-list,
  .metric-grid,
  .work-panel {
    grid-template-columns: 1fr;
  }

  .crm-app {
    grid-template-columns: 1fr;
  }

  .crm-sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .crm-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .auth-layout {
    width: min(100% - 28px, 1180px);
    padding: 24px 0;
    overflow-x: hidden;
  }

  .brand-lockup {
    gap: 12px;
  }

  .brand-logo-shell {
    width: 44px;
    height: 44px;
  }

  .auth-brand-panel {
    gap: 30px;
  }

  .auth-copy h1 {
    max-width: 340px;
    font-size: 2rem;
    line-height: 1.1;
  }

  .auth-copy p:last-child {
    max-width: 320px;
    font-size: 0.96rem;
  }

  .auth-card,
  .work-panel {
    padding: 22px;
  }

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

  .crm-content,
  .crm-topbar {
    padding-left: 18px;
    padding-right: 18px;
  }

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