/* Malenka Pro Cleaning — CRM base styles.
   Brand tokens mirror the public site (see vault brand/Дизайн-система.md). */

:root {
  --color-primary: #2A6466;
  --color-primary-dark: #1F4C4E;
  --color-secondary: #A7C4C2;
  --color-accent: #FECA80;
  --color-cream: #D6CAB2;
  --color-ink: #222222;
  --color-muted-bg: #F9F9F9;
  --color-white: #FFFFFF;
  --color-border: #E4E0D6;

  --font-sans: "Helvetica Neue", Arial, "Open Sans", Helvetica, sans-serif;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .07);
  --container: 1120px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-ink);
  background: var(--color-muted-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---- Header / navbar ---- */
.site-header {
  background: var(--color-cream);
  border-bottom: 1px solid var(--color-border);
}
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 0;
}
.navbar__brand { display: flex; align-items: center; }
.navbar__brand img { height: 44px; width: auto; display: block; }
.menu { position: relative; }
.menu__details { position: relative; }
.menu__toggle {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .8rem;
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  color: var(--color-primary-dark);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.menu__toggle::-webkit-details-marker { display: none; }
.menu__toggle:hover,
.menu__toggle:focus-visible {
  background: var(--color-primary);
  color: var(--color-white);
  outline: none;
}
.menu__icon {
  display: flex;
  flex-direction: column;
  width: 20px;
  gap: 4px;
}
.menu__icon span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform .15s ease, opacity .15s ease;
}
.menu__details[open] .menu__icon span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu__details[open] .menu__icon span:nth-child(2) { opacity: 0; }
.menu__details[open] .menu__icon span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.menu__panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + .55rem);
  right: 0;
  width: min(240px, calc(100vw - 2.5rem));
  margin: 0;
  padding: .45rem;
  list-style: none;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.menu__panel a {
  display: block;
  padding: .65rem .75rem;
  border-radius: 7px;
  color: var(--color-ink);
  font-weight: 600;
}
.menu__action {
  display: block;
  width: 100%;
  padding: .65rem .75rem;
  border: 0;
  border-radius: 7px;
  color: var(--color-ink);
  background: transparent;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.menu__panel a:hover,
.menu__panel a:focus-visible,
.menu__action:hover,
.menu__action:focus-visible {
  color: var(--color-primary-dark);
  background: var(--color-secondary);
  text-decoration: none;
  outline: none;
}

.auth-card { max-width: 520px; margin: 2rem auto; }
.auth-card .form-field { margin-bottom: 1rem; }
.auth-card input:not([type="checkbox"]) {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font: inherit;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(42, 100, 102, .12);
}
.auth-links { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }

/* ---- Team & Access ---- */
.generated-link-card { margin-bottom: 1.25rem; border-color: var(--color-accent); }
.alert--warning { background: #fff3df; color: #6a4a12; border: 1px solid var(--color-accent); }
.copy-field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .65rem; font-weight: 600; }
.copy-field .form-control { width: 100%; padding: .55rem .65rem; border: 1px solid var(--color-border); border-radius: 8px; font: inherit; }
.access-grid .form-field { margin-bottom: 1rem; }
.access-heading { margin-top: 2rem; }
.access-table-wrap { padding: 0; overflow-x: auto; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.inline-actions form { margin: 0; }
.inline-actions .btn { padding: .4rem .65rem; white-space: nowrap; }
.employee-picker-preview { display: flex; align-items: center; gap: .8rem; padding: .8rem; margin: .7rem 0 1rem; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-muted-bg); }
.employee-picker-preview[hidden] { display: none; }

/* ---- Employees ---- */
.employee-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.employee-card { display: flex; gap: 1rem; align-items: center; color: var(--color-ink); padding: 1.25rem; }
.employee-card:hover { text-decoration: none; border-color: var(--color-secondary); }
.employee-avatar { width: 56px; height: 56px; flex: 0 0 auto; border-radius: 50%; background: var(--color-secondary); color: var(--color-primary-dark); display: grid; place-items: center; font-weight: 800; overflow: hidden; }
.employee-avatar img { width: 100%; height: 100%; object-fit: cover; }
.employee-avatar--large { width: 84px; height: 84px; font-size: 1.35rem; }
.employee-identity { display: flex; align-items: center; gap: 1rem; }
.employee-detail-head { align-items: flex-start; }
.related-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .75rem; padding: 1.15rem 1.35rem; }

@media (max-width: 720px) {
  .employee-grid { grid-template-columns: 1fr; }
  .employee-detail-head, .related-card { align-items: flex-start; }
}
.menu__divider {
  margin-top: .35rem;
  padding-top: .35rem;
  border-top: 1px solid var(--color-border);
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: .6rem 1.15rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.btn--primary { background: var(--color-primary); color: var(--color-white); }
.btn--primary:hover { background: var(--color-primary-dark); text-decoration: none; color: #fff; }
.btn--secondary { background: var(--color-secondary); color: var(--color-primary-dark); }
.btn--secondary:hover { filter: brightness(.96); text-decoration: none; }
.btn--ghost { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.btn--ghost:hover { background: var(--color-primary); color: #fff; text-decoration: none; }

/* ---- Main / content ---- */
.site-main { flex: 1 0 auto; padding: 2rem 0; }

.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.page-title { color: var(--color-primary); margin: 0 0 .5rem; }
.text-muted { color: #6b6b6b; }

/* Status badges (used from M2 onward) */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--color-secondary);
  color: var(--color-primary-dark);
}
.badge--accent { background: var(--color-accent); color: #6a4a12; }

/* ---- Client list (M4) ---- */
.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.list-header .page-title { margin: 0; }

.filter-bar { padding: 1rem 1.25rem; }
.filter-bar__fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .8rem;
  font-weight: 600;
  color: #5a5a5a;
}
.filter-bar input,
.filter-bar select {
  font: inherit;
  padding: .45rem .6rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  min-width: 150px;
}
.filter-bar input:focus,
.filter-bar select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(42, 100, 102, .12);
}
.filter-bar__actions {
  display: flex;
  gap: .5rem;
  margin-top: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
}
.data-table thead th {
  text-align: left;
  padding: .85rem 1rem;
  background: var(--color-cream);
  color: var(--color-ink);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--color-muted-bg); }

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

/* ---- Client detail (M5) ---- */
.section-title {
  color: var(--color-primary);
  font-size: 1.05rem;
  margin: 0 0 .85rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--color-secondary);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}
.kv {
  display: grid;
  grid-template-columns: minmax(120px, 40%) 1fr;
  gap: .4rem .75rem;
  margin: 0;
}
.kv--wide { grid-template-columns: minmax(90px, 22%) 1fr; }
.kv dt { color: #6b6b6b; font-size: .85rem; font-weight: 600; }
.kv dd { margin: 0; }
.stars { color: var(--color-accent); letter-spacing: 2px; font-size: 1rem; }

.property-card { margin-top: 1rem; }
.property-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}
.property-card__flags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .85rem;
}

a.client-link { font-weight: 600; }

@media (max-width: 720px) {
  .detail-grid { grid-template-columns: 1fr; }
}

/* ---- Forms (M6) ---- */
.messages { list-style: none; margin: 0 0 1rem; padding: 0; }
.alert {
  padding: .7rem 1rem;
  border-radius: 8px;
  margin-bottom: .5rem;
  font-size: .95rem;
}
.alert--success { background: #e3f0ec; color: #1f4c4e; border: 1px solid #bcdcd4; }
.alert--error { background: #fbe4d8; color: #8a3b1a; border: 1px solid #f3c3aa; }

.form-section { margin-bottom: 1.25rem; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}
.form-field { display: flex; flex-direction: column; gap: .3rem; }
.form-field > label { font-size: .85rem; font-weight: 600; color: #5a5a5a; }
.form-field .form-control {
  font: inherit;
  padding: .5rem .65rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}
.form-field .form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(42, 100, 102, .12);
}
.form-field textarea.form-control { resize: vertical; }
.form-field--check {
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: .5rem;
}
.form-field--check label { font-weight: 500; color: var(--color-ink); }
.form-field.has-error .form-control { border-color: #c0442a; }
.field-error { color: #c0442a; font-size: .8rem; }

.form-actions {
  display: flex;
  gap: .5rem;
  margin-top: 1.25rem;
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---- Footer ---- */
.site-footer {
  background: var(--color-primary);
  color: #dfeceb;
  padding: 1.25rem 0;
  font-size: .9rem;
}
.site-footer a { color: #fff; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .navbar { padding-inline: 1.25rem; }
  .navbar__brand img { height: 36px; }
  .menu__label { display: none; }
}
