/* ============================================================================
   AutoService — современный минималистичный стиль
   ============================================================================ */

:root {
    --bg:           #f5f7fa;
    --surface:      #ffffff;
    --surface-2:    #f0f3f8;
    --text:         #1a2330;
    --muted:        #6b7785;
    --border:       #e3e8ef;
    --accent:       #0f62fe;
    --accent-dark:  #0a4abf;
    --success:      #1e9e6a;
    --warning:      #f0a020;
    --error:        #d23f3f;
    --radius:       12px;
    --shadow:       0 1px 2px rgba(20, 30, 50, .04),
                    0 6px 16px -8px rgba(20, 30, 50, .08);
    --shadow-hover: 0 1px 2px rgba(20, 30, 50, .06),
                    0 8px 24px -10px rgba(20, 30, 50, .15);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* hidden сильнее display у .btn и т.п. */

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a       { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; line-height: 1.25; }
h2 { margin: 1.2rem 0 .6rem; }
code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; }
pre.pre { background: var(--surface-2); padding: .8rem; border-radius: 8px;
          white-space: pre-wrap; word-wrap: break-word; }
.muted        { color: var(--muted); }
.small        { font-size: .85em; }

/* ----------------- Layout ----------------- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 1.2rem; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.topbar__inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem 1.2rem; gap: 1rem;
}
.brand { font-weight: 600; font-size: 1.05rem; color: var(--text); display: inline-flex; gap: .4rem; align-items: center; }
.brand:hover { text-decoration: none; }
.brand__mark { color: var(--accent); font-size: 1.3rem; }

.nav { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.nav__link {
    padding: .35rem .7rem; border-radius: 8px; color: var(--text);
    font-size: .92rem;
}
.nav__link:hover            { background: var(--surface-2); text-decoration: none; }
.nav__link--active          { background: var(--surface-2); color: var(--accent); }
.nav__user                  { color: var(--muted); padding: 0 .6rem; font-size: .88rem; }

main.container { padding-top: 1.4rem; padding-bottom: 4rem; }

.page-title { margin: 0 0 1rem; font-size: 1.5rem; }

.footer {
    margin-top: 3rem; padding: 1.2rem 0; border-top: 1px solid var(--border);
    font-size: .85rem;
}

/* ----------------- Cards / grid ----------------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem;
    box-shadow: var(--shadow); margin-bottom: 1rem;
}
.card--narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.card--empty  { text-align: center; padding: 2rem; }

.grid             { display: grid; gap: 1rem; }
.grid--cards      { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid--2          { grid-template-columns: 1fr 1fr; }
.grid--3          { grid-template-columns: 1fr 1fr 1fr; }
.grid--2-1        { grid-template-columns: 2fr 1fr; align-items: start; }
@media (max-width: 760px) {
    .grid--2, .grid--3, .grid--2-1 { grid-template-columns: 1fr; }
}

.car-card { display: block; color: var(--text); transition: box-shadow .15s, transform .15s; }
.car-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); text-decoration: none; }
.car-card__title  { font-weight: 600; font-size: 1.05rem; }
.car-card__meta   { margin-top: .3rem; font-size: .9rem; }

.car-summary__grid {
    display: grid; gap: .8rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.car-summary__grid > div { font-size: .95rem; }

/* ----------------- Tabs ----------------- */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab  {
    padding: .55rem 1rem; border-radius: 8px 8px 0 0; color: var(--muted);
    border: 1px solid transparent; border-bottom: none;
}
.tab:hover           { background: var(--surface-2); text-decoration: none; color: var(--text); }
.tab--active         { background: var(--surface); color: var(--text);
                       border-color: var(--border); position: relative; top: 1px; }

/* ----------------- Forms ----------------- */
.form           { display: grid; gap: .9rem; }
.form--wide     { max-width: 760px; }
.form--inline   { display: flex; align-items: flex-end; gap: .5rem;
                  flex-wrap: wrap; margin-bottom: 1rem; }
/* внутри карточек, таблиц и блока .actions фильтры/мини-формы идут «впритык» — сбрасываем */
.card .form--inline,
.actions .form--inline,
.table .form--inline { margin-bottom: 0; }
.field          { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.field > span, .field > legend { font-size: .85rem; color: var(--muted); }
.field--inline  { display: inline-flex; min-width: 0; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=number], input[type=date], input[type=datetime-local], input[type=file],
input:not([type]), textarea, select {
    width: 100%; padding: .55rem .7rem; border: 1px solid var(--border);
    border-radius: 8px; background: var(--surface); color: var(--text); font: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 98, 254, .12);
}
textarea { resize: vertical; min-height: 70px; }
fieldset.field { border: 1px solid var(--border); border-radius: 8px; padding: .8rem; }
fieldset.field legend { padding: 0 .4rem; }

.check { display: inline-flex; align-items: center; gap: .35rem; margin-right: 1rem; }
.check input { width: auto; }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: .4rem 0 1rem; }
/* внутри карточек/форм .actions завершает содержимое — нижний отступ не нужен */
.card .actions, .form .actions { margin-bottom: 0; }

/* ----------------- Buttons ----------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .55rem 1rem; border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    border-radius: 8px; cursor: pointer; font: inherit;
    transition: background .12s, border-color .12s, color .12s;
    text-decoration: none;
}
.btn:hover      { background: var(--surface-2); text-decoration: none; }
.btn--primary   { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.btn--small     { padding: .3rem .6rem; font-size: .85rem; }

/* ----------------- Flash ----------------- */
.flash {
    padding: .6rem .9rem; border-radius: 8px; margin-bottom: .8rem; font-size: .94rem;
    border: 1px solid var(--border); background: var(--surface);
}
.flash--success { background: #e8f5ee; border-color: #b9e3cc; color: #105e3f; }
.flash--error   { background: #fdecec; border-color: #f3b8b8; color: #861f1f; }
.flash--info    { background: #eaf2ff; border-color: #b6cdf6; color: #11357a; }

/* ----------------- Tables ----------------- */
.table          { width: 100%; border-collapse: collapse; background: var(--surface);
                  border: 1px solid var(--border); border-radius: var(--radius);
                  overflow: hidden; }
.table th, .table td { padding: .6rem .8rem; text-align: left; vertical-align: top;
                       border-bottom: 1px solid var(--border); }
.table tbody tr:nth-child(odd) td { background: rgba(0,0,0,.015); }
.table tbody tr:hover td { background: var(--surface-2); }
.table th       { font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.table--inner   { margin: .6rem 0; }
.table tfoot th { font-weight: 600; }

/* ----------------- Visit (history) ----------------- */
.visit         { padding: .8rem 0; border-bottom: 1px solid var(--border); }
.visit:last-child { border-bottom: none; }
.visit__head   { display: flex; justify-content: space-between; align-items: baseline;
                 gap: 1rem; flex-wrap: wrap; }
.visit__title  { margin: 0; font-size: 1.05rem; }
.visit__desc   { white-space: pre-wrap; }
.visit__photos { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.visit__photos img { width: 100px; height: 100px; object-fit: cover; border-radius: 8px;
                     border: 1px solid var(--border); }

/* ----------------- Timeline ----------------- */
.timeline      { position: relative; padding: 1.5rem 0 2rem; }
.timeline__axis { position: relative; height: 32px; }
.timeline__tick { position: absolute; top: 0; transform: translateX(-50%);
                  font-size: .8rem; color: var(--muted);
                  border-left: 1px dashed var(--border); padding-left: .3rem; }
.timeline__lane { position: relative; height: 36px; background: var(--surface-2);
                  border-radius: 999px; margin-top: .4rem; }
.timeline__dot  { position: absolute; top: 50%; transform: translate(-50%, -50%);
                  width: 14px; height: 14px; border-radius: 50%;
                  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.timeline__dot--green  { background: var(--success); }
.timeline__dot--yellow { background: var(--warning); }
.timeline__dot--red    { background: var(--error); }

.view-switch     { display: flex; gap: .3rem; margin-bottom: .8rem; }
.view-switch__btn--active,
.view-switch__btn--active:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%;
       margin-right: .3rem; vertical-align: middle; }
.dot--green  { background: var(--success); }
.dot--yellow { background: var(--warning); }
.dot--red    { background: var(--error);   }

/* ----------------- Stats / dashboard ----------------- */
.stat              { display: flex; flex-direction: column; gap: .2rem; }
.stat__num         { font-size: 2rem; font-weight: 600; color: var(--text); }
.stat__label       { color: var(--muted); font-size: .9rem; }

/* ----------------- Comments ----------------- */
.comments         { list-style: none; padding: 0; margin: 0; }
.comment          { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment__head    { font-size: .9rem; }
.comment__body    { margin-top: .25rem; }
.comment--private { background: #fff8e6; border-left: 3px solid var(--warning);
                    padding-left: .6rem; border-radius: 4px; }
.badge {
    display: inline-block; padding: .1rem .5rem; border-radius: 999px;
    background: var(--warning); color: #fff; font-size: .75rem; margin-left: .4rem;
    vertical-align: middle;
}
.badge--client { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* ----------------- Контакты в подвале ----------------- */
.footer__contacts { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin-bottom: .6rem; }
.footer__label    { opacity: .75; }

/* ----------------- Запись на обслуживание ----------------- */
.form__step { font-size: 1.05rem; margin: 1.2rem 0 .5rem; }
.form__step:first-of-type { margin-top: 0; }
.forecast {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem;
    background: var(--surface-2); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .8rem;
}
.reco { display: flex; align-items: flex-start; margin-right: 0; padding: .35rem 0; }
.reco input { margin-top: .25rem; }
.reco__body { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; }
.reco__meta { flex-basis: 100%; }
.reco__badge--red    { background: #fdecec; color: #861f1f; }
.reco__badge--yellow { background: #fff4d6; color: #7a5600; }
.reco__badge--soon   { background: #eaf2ff; color: #1d4f9c; }
.reco__badge--green  { background: #e8f6ec; color: #1d6b34; }
.banner {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
    background: #fff4d6; border-color: #f0d48a;
}

/* Форма машины: список каталога над полем ручного ввода (script.js) */
.car-pick .field > select + input,
.car-pick .field > select + select { margin-top: .35rem; }

/* ----------------- Справочник регламентов ТО ----------------- */
.nowrap { white-space: nowrap; }
.reg-index { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.reg-index__make h2 { margin: 0 0 .5rem; font-size: 1.15rem; }
.reg-index__list { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; margin: 0; }
.reg-index__list dt { font-weight: 600; }
.reg-index__list dd { margin: 0; display: flex; flex-wrap: wrap; gap: .2rem .6rem; }
.reg-filter { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.reg-filter .field:first-of-type { flex: 1 1 280px; }
.reg-cond { font-size: .8rem; color: var(--accent-dark); margin-top: .15rem; }
.reg-basis { font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; white-space: nowrap; }
.reg-basis--oem    { background: #e6f4ee; color: #146c48; }
.reg-basis--advice { background: var(--surface-2); color: var(--muted); }
.reg-map { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.reg-map__table { width: auto; min-width: 100%; }
.reg-map__table th, .reg-map__table td { padding: .4rem .45rem; }
.reg-map__name { position: sticky; left: 0; background: var(--surface); z-index: 1;
                 min-width: 13rem; max-width: 18rem; font-weight: 500; text-align: left; }
.reg-map__col { white-space: nowrap; }
.reg-map__col, .reg-map__cell { text-align: center; min-width: 2.6rem; font-variant-numeric: tabular-nums; }
.reg-map__cell span { color: var(--accent); }
.reg-map__hint { text-align: left; font-weight: 400; }
.reg-map__advice th, .reg-map__advice .reg-map__cell span { color: var(--muted); }
@media (max-width: 600px) {
    .reg-map__name { min-width: 9rem; }
}

/* ----------------- Форма машины по шагам ----------------- */
.car-step { margin: 0 0 1rem; }
.car-step__title { font-size: 1rem; margin: 1rem 0 .5rem; }
.car-step:first-of-type .car-step__title { margin-top: 0; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.wizard-steps__btn { border: 1px solid var(--border); background: var(--surface); color: var(--muted);
                     border-radius: 999px; padding: .3rem .8rem; font: inherit; font-size: .85rem; cursor: pointer; }
.wizard-steps__btn:disabled { cursor: default; opacity: .55; }
.wizard-steps__btn--active { background: var(--accent); border-color: var(--accent); color: #fff; opacity: 1; }
.vin-summary { background: var(--surface-2); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem;
               font-size: .92rem; }
.vin-summary ul { margin: .3rem 0 .2rem; padding-left: 1.2rem; }
.car-candidates { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .8rem; }
.checkbox { display: flex; gap: .4rem; align-items: center; margin-top: .35rem; }
.engine-manual { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem; margin-top: .35rem; }
