/* =========================================================================
   АДМИН ПАНЕЛ  (/admin)

   Отделен файл от site.css — тук интерфейсът е по-плътен и работен.
   Ползва същите променливи от :root, дефинирани в site.css.
   ========================================================================= */

.admin { min-height: 100vh; background: var(--surface); }

/* ---------- Вход -------------------------------------------------------- */

.alogin {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(900px 500px at 50% -10%, var(--tint), transparent 65%),
        var(--surface);
}
.alogin__card {
    width: min(100%, 420px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2.2rem;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
}
.alogin__logo { width: 190px; margin: 0 auto .5rem; }
.alogin__title { font-size: 1.4rem; margin: 0; text-align: center; }
.alogin__sub { margin: -.4rem 0 .6rem; text-align: center; color: var(--muted); font-size: .9rem; }
.alogin__back { margin-top: .4rem; text-align: center; font-size: .85rem; color: var(--muted); }
.alogin__back:hover { color: var(--navy-3); }

/* ---------- Лента отгоре ------------------------------------------------ */

.abar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1.5rem; flex-wrap: wrap;
    padding: .8rem clamp(1rem, 3vw, 2rem);
    background: var(--white);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-xs);
}
.abar__left { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.abar__logo { width: 150px; height: auto; }
.abar__title {
    font-family: var(--display); font-size: .8rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2);
    padding-left: 1rem; border-left: 1px solid var(--line);
}
.abar__right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.abar__langs {
    display: flex; gap: 2px; padding: 3px;
    background: var(--surface); border-radius: var(--r-pill);
}
.abar__lang {
    padding: .42rem .8rem;
    border: 0; border-radius: var(--r-pill);
    background: transparent;
    font-family: var(--display); font-size: .76rem; font-weight: 700;
    letter-spacing: .04em; color: var(--muted);
    cursor: pointer;
    transition: background .2s var(--ease), color .2s var(--ease);
}
.abar__lang:hover { color: var(--navy); }
.abar__lang.is-active { background: var(--navy); color: var(--white); }

.abadge {
    padding: .38rem .8rem; border-radius: var(--r-pill);
    background: var(--surface-2); color: var(--muted);
    font-family: var(--display); font-size: .74rem; font-weight: 700;
    white-space: nowrap;
}
.abadge--warn { background: #fdf3e3; color: #8a5f2b; }
.abadge--ok   { background: #e8f4ec; color: #2c6b45; }

/* ---------- Бутони ------------------------------------------------------ */

.abtn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .58rem 1rem;
    background: var(--white);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    font-family: var(--display); font-size: .84rem; font-weight: 600;
    color: var(--navy);
    cursor: pointer; white-space: nowrap;
    transition: border-color .2s var(--ease), background .2s var(--ease), color .2s var(--ease);
}
.abtn:hover { border-color: var(--navy-3); background: var(--surface); }
.abtn--primary { background: var(--navy); border-color: var(--navy); color: var(--white); }
.abtn--primary:hover { background: var(--navy-2); border-color: var(--navy-2); color: var(--white); }
.abtn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.abtn--ghost:hover { color: #9a3029; background: #fdf1f0; border-color: transparent; }
.abtn--sm { padding: .42rem .8rem; font-size: .78rem; }
.abtn--block { width: 100%; justify-content: center; padding: .8rem 1rem; }
.abtn[disabled] { opacity: .5; cursor: not-allowed; }

.aicon {
    display: grid; place-items: center;
    min-width: 30px; height: 30px; padding: 0 .5rem;
    background: var(--white);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    font-family: var(--display); font-size: .8rem; font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.aicon:hover { border-color: var(--navy-3); color: var(--navy); }
.aicon[disabled] { opacity: .35; cursor: not-allowed; }
.aicon--danger:hover { border-color: #c0554c; color: #9a3029; background: #fdf1f0; }

/* ---------- Табове ------------------------------------------------------ */

.atabs {
    position: sticky; top: 65px; z-index: 40;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}
.atabs__inner {
    display: flex; gap: .25rem;
    width: min(100% - 2rem, 1100px);
    margin-inline: auto;
}
.atab {
    position: relative;
    padding: .95rem 1.1rem;
    background: none; border: 0;
    font-family: var(--display); font-size: .88rem; font-weight: 600;
    color: var(--muted);
    cursor: pointer; white-space: nowrap;
    transition: color .2s var(--ease);
}
.atab::after {
    content: ""; position: absolute;
    left: .6rem; right: .6rem; bottom: 0; height: 2px;
    background: var(--navy);
    transform: scaleX(0);
    transition: transform .3s var(--ease-out);
}
.atab:hover { color: var(--navy); }
.atab.is-active { color: var(--navy); }
.atab.is-active::after { transform: scaleX(1); }
.atab__badge {
    display: inline-grid; place-items: center;
    min-width: 1.35rem; height: 1.35rem; margin-left: .4rem;
    padding: 0 .35rem; border-radius: 999px;
    background: var(--gold-soft, #e8cfa0); color: var(--navy-deep, #0a2f42);
    font-size: .72rem; font-weight: 700; line-height: 1;
    vertical-align: middle;
}

/* ---------- Работно поле ------------------------------------------------ */

.apanel {
    width: min(100% - 2rem, 1100px);
    margin-inline: auto;
    padding: 1.8rem 0 5rem;
    display: flex; flex-direction: column; gap: 1rem;
}
.apanel__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
}

.acard {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 1.5rem;
}
.acard__title {
    font-size: .8rem; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted-2);
    margin: 1.6rem 0 1rem;
}
.acard__title:first-child { margin-top: 0; }

.acard--item { padding: 0; overflow: hidden; }
.acard--item > *:not(summary) { margin-inline: 1.5rem; }
.acard--item > *:last-child { margin-bottom: 1.5rem; }

.acard__summary {
    display: flex; align-items: center; gap: .9rem;
    padding: 1rem 1.5rem;
    cursor: pointer;
    list-style: none;
    transition: background .2s var(--ease);
}
.acard__summary::-webkit-details-marker { display: none; }
.acard__summary:hover { background: var(--surface); }
.acard--item[open] .acard__summary { border-bottom: 1px solid var(--line); background: var(--surface); }

.acard__num {
    flex: none; min-width: 2.2rem;
    font-family: var(--display); font-size: .78rem; font-weight: 700;
    color: var(--muted-2);
}
.acard__name {
    font-family: var(--display); font-weight: 700; color: var(--navy);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.acard__id { margin-left: auto; font-size: .76rem; color: var(--muted-2); white-space: nowrap; }
.acard__tools { display: flex; gap: .35rem; justify-content: flex-end; margin-top: 1rem; }

.acard--nested {
    background: var(--surface);
    border: 0;
    border-radius: var(--r-sm);
    padding: 1.1rem;
    margin-top: .8rem;
}
.acard__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .8rem; }

/* ---------- Админ календар (график) ------------------------------------ */

.awdays {
    display: flex; flex-wrap: wrap; gap: .45rem;
}
.awdays__chip {
    min-height: 40px; min-width: 3.2rem;
    padding: .45rem .75rem;
    border-radius: 999px;
    border: 1px solid var(--line-2);
    background: var(--white);
    font-family: var(--display); font-size: .82rem; font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}
.awdays__chip.is-on {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--white);
}
.awdays__chip:disabled { opacity: .5; cursor: not-allowed; }

.acal-legend {
    display: flex; flex-wrap: wrap; gap: .7rem 1.2rem;
    margin: 0 0 1rem;
    font-size: .78rem; color: var(--muted);
}
.acal-legend__i { display: inline-flex; align-items: center; gap: .4rem; }
.acal-legend__swatch {
    width: 12px; height: 12px; border-radius: 3px;
    border: 1px solid var(--line-2);
    display: inline-block;
}
.acal-legend__swatch--work { background: #e8f3f1; border-color: #9ec9be; }
.acal-legend__swatch--off { background: var(--surface); }
.acal-legend__swatch--holiday { background: #fdecea; border-color: #e0a8a2; }
.acal-legend__swatch--busy { background: #f7efd8; border-color: #d9b880; }

.acal {
    max-width: 520px;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
}
.acal__nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: .8rem; margin-bottom: .9rem;
}
.acal__month {
    margin: 0;
    font-family: var(--display); font-size: 1.15rem; font-weight: 700;
    color: var(--navy); text-transform: capitalize;
}
.acal__weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem;
    margin-bottom: .35rem;
    text-align: center;
    font-family: var(--display); font-size: .7rem; font-weight: 700;
    letter-spacing: .04em; text-transform: uppercase; color: var(--muted-2);
}
.acal__grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem;
}
.acal__cell {
    position: relative;
    min-height: 48px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    background: transparent;
    font-family: var(--ui); font-size: .9rem; font-weight: 600;
    color: var(--muted-2);
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .1rem;
}
.acal__cell--empty { visibility: hidden; }
.acal__cell--work {
    background: #e8f3f1; border-color: #c5ddd6; color: var(--navy);
}
.acal__cell--off {
    background: var(--white); border-color: var(--line); color: var(--muted-2);
}
.acal__cell--holiday {
    background: #fdecea; border-color: #ecc4bf; color: #9a3029;
    text-decoration: line-through;
}
.acal__cell--busy {
    background: #f7efd8; border-color: #e2c994; color: var(--navy);
}
.acal__cell.is-selected {
    outline: 2px solid var(--navy);
    outline-offset: 1px;
}
.acal__cell:disabled { opacity: .55; cursor: not-allowed; }
.acal__day { line-height: 1; }
.acal__dot {
    min-width: 1.1rem; height: 1.1rem; padding: 0 .25rem;
    border-radius: 999px;
    background: var(--navy); color: var(--white);
    font-size: .65rem; font-weight: 700; line-height: 1.1rem;
}

.acal-daypanel {
    margin-top: 1.2rem;
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--white);
}
.acal-daypanel__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: .8rem; flex-wrap: wrap;
}

/* ---------- Полета ------------------------------------------------------ */

.agrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: .9rem 1.1rem;
    margin-bottom: 1rem;
}
.agrid--tight { gap: .7rem; margin: 0; }

.afield { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.afield--wide { grid-column: 1 / -1; }
.afield__label {
    display: flex; align-items: center; gap: .4rem;
    font-family: var(--display); font-size: .74rem; font-weight: 700;
    color: var(--muted);
}
.afield__hint {
    display: grid; place-items: center;
    width: 15px; height: 15px; border-radius: 50%;
    background: var(--surface-2); color: var(--muted-2);
    font-size: .62rem; cursor: help;
}
.afield__note { font-size: .76rem; color: var(--muted-2); margin: .1rem 0 0; line-height: 1.5; }

.afield__input {
    width: 100%;
    padding: .6rem .75rem;
    font-family: var(--sans); font-size: .92rem; color: var(--text);
    background: var(--white);
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.afield__input:focus {
    outline: none;
    border-color: var(--navy-3);
    box-shadow: 0 0 0 3px rgba(29, 84, 116, .12);
}
.afield__input--area { resize: vertical; line-height: 1.6; min-height: 70px; }

.acheck {
    display: flex; align-items: center; gap: .6rem;
    margin: .6rem 0 1rem;
    font-size: .88rem; color: var(--muted);
}
.acheck input { width: 17px; height: 17px; accent-color: var(--navy); }

/* ---------- Списъци ----------------------------------------------------- */

.alist { margin: 1.2rem 0; }
.alist__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: .6rem;
}
.alist__row {
    display: flex; align-items: flex-start; gap: .5rem;
    margin-bottom: .5rem;
}
.alist__row > .afield__input { flex: 1; min-width: 0; }
.alist__row--pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
    gap: .7rem;
    align-items: end;
}
.alist__tools { display: flex; gap: .3rem; flex: none; }
.alist__empty { color: var(--muted-2); font-size: .88rem; font-style: italic; margin: .4rem 0 1rem; }

/* ---------- Снимка ------------------------------------------------------ */

.aimage { display: flex; gap: .9rem; align-items: flex-start; }
.aimage__preview {
    width: 76px; height: 76px; flex: none;
    object-fit: cover;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
}
.aimage__placeholder {
    display: grid; place-items: center;
    width: 76px; height: 76px; flex: none;
    border: 1px dashed var(--line-2);
    border-radius: var(--r-sm);
    color: var(--muted-2);
}
.aimage__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .5rem; }
.aimage__tools { display: flex; gap: .4rem; align-items: center; }

/* ---------- Грешки ------------------------------------------------------ */

.aerror {
    margin: .2rem 0 0;
    padding: .7rem .9rem;
    background: #fdf1f0;
    border: 1px solid #f2d5d2;
    border-radius: var(--r-sm);
    color: #9a3029;
    font-size: .86rem;
    line-height: 1.5;
}
.aerror--bar { margin-bottom: 1rem; }

/* ---------- Адаптивност ------------------------------------------------- */

@media (max-width: 720px) {
    .abar { gap: .8rem; }
    .abar__title { display: none; }
    .atabs { top: 0; }
    .acard--item > *:not(summary) { margin-inline: 1rem; }
    .acard__summary { padding: .9rem 1rem; }
    .alist__row--pair { grid-template-columns: 1fr; }
}
