*{box-sizing:border-box}html,body{height:100%;overflow:hidden}body{margin:0;font-family:Arial,sans-serif;background:#f5f6f8;color:#18202a;font-size:14px}header{background:#1f2937;padding:8px 16px;height:48px}nav{display:flex;gap:10px;align-items:center}nav a,.toolbar a,.toolbar button,button{border:0;border-radius:8px;padding:1px;background:#e7edf7;color:#111;text-decoration:none;cursor:pointer}nav a{background:#374151;color:white}main{height:calc(100vh - 48px);padding:10px 12px;overflow:hidden}.page-title{font-size:18px;margin-right:8px;white-space:nowrap}.toolbar{display:flex;gap:7px;align-items:center;margin-bottom:8px;flex-wrap:nowrap}.toolbar input{padding:7px;border:1px solid #cbd5e1;border-radius:8px;min-width:240px}.filters{margin-left:auto;display:flex;gap:7px;align-items:center}.filters select{width:auto;min-width:180px;padding:7px;border:1px solid #cbd5e1;border-radius:8px;background:white}.toolbar [disabled]{opacity:.35;cursor:not-allowed}.table-wrap{height:calc(100vh - 112px);overflow:auto;border:1px solid #cbd5e1;background:white;border-radius:10px}table{width:100%;border-collapse:collapse;font-size:87.5%}th,td{border-bottom:1px solid #e5e7eb;padding:2px 3px;vertical-align:top;text-align:left;line-height:1.25}thead th{position:sticky;top:0;background:#edf2f7;z-index:1;cursor:pointer;user-select:none}thead th.sort-asc::after{content:' ▲'}thead th.sort-desc::after{content:' ▼'}tr.selected{background:#dbeafe}.linkbtn{background:transparent;color:#075985;padding:0 3px;text-decoration:underline;font-size:inherit}.modal{position:fixed;inset:0;background:rgba(0,0,0,.35);display:grid;place-items:center;z-index:10}.hidden{display:none}.modal-box,dialog{max-width:820px;width:90%;max-height:92vh;overflow:auto;background:white;border:0;border-radius:14px;padding:16px;box-shadow:0 20px 60px rgba(0,0,0,.25)}.modal-close{float:right;background:#fee2e2}label{display:block;margin:6px 0}input,textarea,select{width:100%;padding:7px;border:1px solid #cbd5e1;border-radius:8px}textarea{min-height:58px}fieldset{max-height:180px;overflow:auto;border:1px solid #cbd5e1;border-radius:10px;margin:8px 0;padding:8px}.rel-filter{position:sticky;top:0;background:white;margin-bottom:6px;z-index:1}.check{display:inline-block;margin:3px 10px 3px 0}.check input{width:auto}menu{display:flex;justify-content:flex-end;gap:8px;padding:0;margin-bottom:0}.login{max-width:360px;margin:10vh auto;background:white;padding:24px;border-radius:14px}.hint{color:#64748b}.card{background:white;padding:12px;border-radius:12px;margin-bottom:12px}.grid{display:grid;grid-template-columns:1fr 1fr auto auto;gap:8px}.inline{display:inline-flex;gap:6px;align-items:center}.inline input{width:auto}.flash{background:#fee2e2;padding:10px;border-radius:8px;margin-bottom:10px}
@media(max-width:900px){.toolbar{flex-wrap:wrap}.filters{margin-left:0;width:100%;flex-wrap:wrap}.toolbar input{width:100%}.table-wrap{height:calc(100vh - 150px)}}

nav a,.toolbar a,.toolbar button,button{min-width:28px;display:inline-flex;align-items:center;justify-content:center;line-height:1;font-size:20px}

/* Объемные кнопки */
nav a, .toolbar a, .toolbar button, button {
    border: 1px solid #aeb8c6;
    border-radius: 8px;
    padding: 1px;
    background: linear-gradient(#ffffff, #d7e0ec);
    color: #111827;
    text-decoration: none;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 4px rgba(15,23,42,.25);
    transition: background .12s ease, box-shadow .12s ease, transform .12s ease, filter .12s ease;
}
nav a {
    background: linear-gradient(#4b5563, #1f2937);
    color: #fff;
    border-color: #111827;
}
nav a:hover, .toolbar a:hover, .toolbar button:hover, button:hover {
    background: linear-gradient(#f8fbff, #c7d4e5);
    filter: brightness(1.04);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.95), 0 3px 7px rgba(15,23,42,.32);
}
nav a:hover {
    background: linear-gradient(#5b6675, #273244);
}
nav a:active, .toolbar a:active, .toolbar button:active, button:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(15,23,42,.18), 0 1px 2px rgba(15,23,42,.22);
}
.toolbar [disabled], button:disabled {
    opacity: .35;
    cursor: not-allowed;
    filter: grayscale(.35);
    transform: none;
    box-shadow: none;
}


/* Компактные формы добавления/редактирования */
dialog form {
    font-size: 96%;
}
dialog h2 {
    margin: 4px 0 6px;
    font-size: 1.05em;
}
dialog label {
    margin: 2px 0;
}
dialog input,
dialog textarea,
dialog select {
    padding: 3px;
    border-radius: 5px;
    font-size: 0.96em;
}
dialog textarea {
    min-height: 32px;
}
dialog fieldset {
    margin: 3px 0;
    padding: 3px;
    border-radius: 6px;
    max-height: 120px;
}
dialog legend {
    padding: 0 3px;
}
dialog .rel-filter {
    margin-bottom: 2px;
}
dialog .check {
    margin: 1px 4px 1px 0;
}
dialog menu {
    gap: 3px;
    margin-top: 3px;
}
dialog .form-checkbox {
    width: auto;
    display: inline-flex;
    flex-direction: row;
    gap: 4px;
    align-items: center;
}
dialog .form-checkbox input {
    width: auto;
}
.ext-link.is-general {
    font-weight: 700;
}

/* Тулбарные чекбоксы рядом с текстом, без растягивания */
.toolbar .toolbar-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
    white-space: nowrap;
    margin: 0;
    padding: 0;
    line-height: 1;
}
.toolbar .toolbar-check input[type="checkbox"] {
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    flex: 0 0 auto;
}
.toolbar .toolbar-check span {
    display: inline-block;
}
