/* ERP · дизайн-система Замечатели (zamechately.ru) · пилот v1 */
@import url("https://fonts.googleapis.com/css2?family=Libre+Franklin:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");

:root {
  --dark: #0e0e0e;
  --white: #ffffff;
  --coral: #e94666;
  --coral-hover: #ff6180;
  --coral-soft: #fff2f5;
  --coral-ring: rgba(233, 70, 102, 0.2);
  --page-bg: #ffffff;
  --surface: #ffffff;
  --muted: rgba(14, 14, 14, 0.55);
  --border: rgba(14, 14, 14, 0.12);
  --border-strong: #d8d8d8;
  --ok: #1a7f4b;
  --warn: #b36b00;
  --bad: #b00020;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 40px;
  --radius-pill: 999px;
  --shadow-card: 0 10px 50px rgba(0, 0, 0, 0.08);
  --shadow-header: 0 0 20px rgba(0, 0, 0, 0.1);
  --font: "Libre Franklin", Arial, sans-serif;
  --header-max: 1120px;
  --content-max: 960px;
  --nav-drop-radius: 14px;
  --nav-drop-shadow: 0 8px 24px rgba(14, 14, 14, 0.08);
  --nav-drop-border: rgba(14, 14, 14, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--dark);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

/* ——— Shell ——— */
.erp-shell {
  min-height: 100vh;
  padding: 10px 26px 40px;
}

@media (min-width: 852px) {
  .erp-shell {
    padding: 10px 50px 48px;
  }
}

.erp-header {
  position: sticky;
  top: 10px;
  z-index: 100;
  max-width: var(--header-max);
  margin: 0 auto 24px;
  padding: 8px 16px;
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-header);
  overflow: visible;
}

@media (min-width: 852px) {
  .erp-header {
    padding: 10px 32px;
  }
}

.erp-header-brand {
  grid-column: 1;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.erp-header--solo {
  justify-content: flex-start;
}

.erp-header-brand:hover {
  opacity: 0.85;
}

.erp-logo {
  width: 56px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

.erp-header-title {
  min-width: 0;
}

.erp-header-title h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.erp-header-title .erp-sub {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}

.erp-badge {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--coral-soft);
  color: var(--coral);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.erp-badge.pilot {
  background: var(--coral-soft);
  color: var(--coral);
}

.erp-nav {
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  overflow: visible;
}

.erp-nav-group {
  position: relative;
  flex-shrink: 0;
}

.erp-nav-drop {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  margin-top: 8px;
  padding: 8px;
  background: var(--white);
  border: 1px solid var(--nav-drop-border);
  border-radius: var(--nav-drop-radius);
  box-shadow: var(--nav-drop-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 200;
}

/* Невидимый мост: без него курсор теряет hover в зазоре 8px между кнопкой и меню */
.erp-nav-drop::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 8px;
}

.erp-nav-group.is-open .erp-nav-drop,
.erp-nav-group:focus-within .erp-nav-drop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.erp-nav-drop-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--dark);
  white-space: nowrap;
  text-transform: none;
  transition: background 0.15s, color 0.15s;
}

.erp-nav-drop-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
  flex-shrink: 0;
}

.erp-nav-drop-link:hover,
.erp-nav-drop-link.active {
  background: rgba(233, 70, 102, 0.08);
  color: var(--coral);
}

.erp-nav-drop-link.active {
  font-weight: 600;
}

.erp-nav-drop-sep {
  height: 1px;
  margin: 6px 12px;
  background: rgba(0, 0, 0, 0.08);
}

.erp-header-actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 6px 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.erp-header-actions .erp-who {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0;
}

.erp-header-actions .erp-btn {
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
}

.erp-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 6px;
  background: transparent;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--dark);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.erp-nav-label {
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

.erp-nav-trigger .erp-nav-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.erp-nav-group.is-open .erp-nav-chevron,
.erp-nav-group:focus-within .erp-nav-chevron {
  transform: rotate(180deg);
}

.erp-nav-link:hover,
.erp-nav-group.is-open > .erp-nav-trigger {
  color: var(--coral);
}

.erp-nav-link.active,
.erp-nav-group.is-active > .erp-nav-link,
.erp-nav-group.is-active > .erp-nav-trigger {
  color: var(--coral);
}

.erp-nav-group > span.erp-nav-trigger {
  cursor: default;
}

@media (max-width: 480px) {
  .erp-header {
    padding: 6px 8px;
    gap: 4px 6px;
  }

  .erp-nav {
    gap: 4px;
    max-width: 100%;
    overflow-x: hidden;
    flex-wrap: wrap;
    justify-content: center;
  }

  .erp-nav-link {
    padding: 4px 6px;
    font-size: 10px;
    min-height: 26px;
  }

  .erp-header-actions .erp-who {
    max-width: 72px;
    font-size: 10px;
  }

  .erp-header-actions .erp-btn {
    padding: 4px 8px;
    font-size: 10px;
  }
}

.erp-who {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 0 4px;
}

.erp-who:empty {
  display: none;
}

.erp-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ——— Cards ——— */
.erp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.erp-card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
  letter-spacing: -0.01em;
}

.erp-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.erp-err {
  color: var(--bad);
  font-size: 13px;
  margin-top: 8px;
  font-weight: 600;
}

/* ——— Forms ——— */
.erp-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--dark);
}

.erp-input,
.erp-select,
.erp-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 14px;
  color: var(--dark);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.erp-input:focus,
.erp-select:focus,
.erp-textarea:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral-ring);
}

.erp-textarea {
  min-height: 72px;
  resize: vertical;
}

/* ——— Buttons ——— */
.erp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.erp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}

.erp-btn:active {
  transform: translateY(1px);
}

.erp-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.erp-btn-primary {
  background: var(--coral);
  color: #fff;
}

.erp-btn-primary:hover:not(:disabled) {
  background: var(--coral-hover);
}

.erp-btn-secondary {
  background: transparent;
  color: var(--coral);
  border: 1px solid var(--coral);
}

.erp-btn-secondary:hover:not(:disabled) {
  background: var(--coral-soft);
}

.erp-btn-outline {
  background: transparent;
  color: var(--coral);
  border: 1px solid var(--coral);
}

.erp-btn-outline:hover:not(:disabled) {
  background: var(--coral-soft);
}

.erp-btn-ghost {
  background: var(--white);
  color: var(--dark);
  border: 1px solid var(--border-strong);
}

.erp-btn-ghost:hover:not(:disabled) {
  border-color: var(--coral);
  color: var(--coral);
}

.erp-btn-pill {
  border-radius: var(--radius-pill);
  padding: 10px 20px;
}

/* ——— Tasks page ——— */
.erp-task {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.erp-task:hover {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
}

.erp-task.urgent {
  border-color: rgba(176, 0, 32, 0.35);
  background: #fff8f9;
}

.erp-task.high {
  border-color: rgba(179, 107, 0, 0.35);
  background: #fffbf5;
}

.erp-task-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.erp-task-head b {
  font-size: 15px;
  font-weight: 600;
}

.erp-task-type {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-weight: 600;
}

.erp-prio {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.erp-prio.urgent {
  background: #fde8ec;
  color: var(--bad);
}

.erp-prio.high {
  background: #fff4e0;
  color: var(--warn);
}

.erp-prio.normal {
  background: #f1f1f1;
  color: #666;
}

.erp-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.erp-summary-box {
  background: var(--coral-soft);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.erp-summary-box .num {
  font-size: 28px;
  font-weight: 800;
  color: var(--coral);
  line-height: 1;
}

.erp-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.erp-card-head h2 {
  margin: 0;
}

.erp-login-wrap {
  max-width: 440px;
  margin: 10vh auto 0;
}

.erp-login-card {
  border-radius: var(--radius-xl);
}

.erp-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--muted, #666);
  cursor: pointer;
  user-select: none;
}

.erp-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--coral, #e94666);
}

.hidden {
  display: none !important;
}

#login,
#app {
  display: none;
}

#login.show,
#app.show {
  display: block;
}

/* ——— List head + month navigation (orders, pnl, dashboard) ——— */

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.list-head h2 {
  margin: 0;
}

.erp-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.erp-month-nav__btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  border-radius: var(--radius-pill, 999px);
  box-sizing: border-box;
}

.erp-month-nav__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.erp-month-nav__select {
  height: 40px;
  min-width: 150px;
  max-width: 220px;
  padding: 0 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  box-sizing: border-box;
}

