* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #96a6b9 #d9e0e8;
}
*::-webkit-scrollbar { width: 13px; height: 13px; }
*::-webkit-scrollbar-track {
    background: linear-gradient(#eff3f7, #d8e0e8);
    border-left: 1px solid #b4c0cb;
    border-top: 1px solid #b4c0cb;
}
*::-webkit-scrollbar-thumb {
    background: linear-gradient(#c5d1dd, #93a6ba);
    border: 1px solid #73879a;
}
html, body { height: 100%; }
body {
    margin: 0;
    font-family: Tahoma, Verdana, Arial, sans-serif;
    font-size: 12px;
    color: #1e3553;
    background: #d8dde4;
    overflow: hidden;
}
.window {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-rows: 30px 26px 38px 1fr 24px;
    background: #d7dce3;
}
.titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    color: #ffffff;
    background: linear-gradient(#1f2833, #44586d 14%, #536d86 48%, #2d3945 49%, #11161b 100%);
    border-bottom: 1px solid #7c8ea0;
    font-weight: bold;
    text-shadow: 0 1px 0 rgba(0,0,0,.5);
}
.menubar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 10px;
    background: linear-gradient(#f7f8fa, #e4e9ef);
    border-bottom: 1px solid #b8c2cc;
    color: #344c67;
}
.toolbar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    background: linear-gradient(#f4f7fa, #dfe7ef);
    border-bottom: 1px solid #b3bfca;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
.tool-btn {
    min-width: 82px;
    padding: 6px 10px;
    text-align: center;
    border: 1px solid #b1bcc8;
    background: linear-gradient(#ffffff, #e0e8f1);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.95);
    cursor: pointer;
    user-select: none;
    color: #36536f;
    text-decoration: none;
    border-radius: 2px;
}
.tool-btn.active {
    border-color: #83a2bf;
    background: linear-gradient(#dff0ff, #bcd4ea);
    color: #1e4c7a;
    font-weight: bold;
}
.app-shell {
    min-height: 0;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    background: #d7dce3;
    overflow: hidden;
}
.panel {
    border: 1px solid #98a8b8;
    background: #d9dee5;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.85);
}
.panel-title {
    padding: 6px 10px;
    font-weight: bold;
    color: #1f3955;
    background: linear-gradient(#edf2f7, #cfd8e2);
    border-bottom: 1px solid #aebbc8;
}
.sidebar-panel, .quick-panel, .content-main { min-height: 0; }
.sidebar-scroll {
    overflow: auto;
    height: calc(100% - 31px);
}
.sidebar-group {
    margin: 8px;
    border: 1px solid #adb8c4;
    background: #eef2f6;
}
.sidebar-group h3 {
    margin: 0;
    padding: 5px 8px;
    font-size: 11px;
    color: #576e86;
    background: linear-gradient(#fbfcfd, #d7dfe8);
    border-bottom: 1px solid #b8c2cc;
}
.nav-link {
    display: block;
    width: 100%;
    padding: 6px 8px;
    color: #385673;
    text-align: left;
    border-top: 1px solid #f8fbfd;
    background: transparent;
    text-decoration: none;
}
.nav-link:hover, .nav-link.active {
    background: linear-gradient(#fbe887, #f0cc4e);
    color: #24384e;
    font-weight: bold;
}
.content-shell {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}
.flash {
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid;
    font-weight: bold;
}
.flash-success {
    border-color: #90b287;
    background: linear-gradient(#eef9ea, #d6efce);
}
.flash-error {
    border-color: #bf7e7e;
    background: linear-gradient(#fff1f1, #f3d5d5);
}
.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 235px;
    gap: 8px;
    min-height: 0;
    height: 100%;
}
.content-main {
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
    min-height: 0;
}
.status-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.stat {
    border: 1px solid #99a9b9;
    background: linear-gradient(#eef3f7, #d5dde6);
    padding: 10px 12px;
    min-width: 0;
}
.stat .label {
    color: #576d84;
    font-size: 11px;
    text-transform: none;
}
.stat .value {
    margin-top: 8px;
    font-size: 16px;
    font-weight: bold;
    color: #1c4c89;
}
.notice {
    padding: 9px 12px;
    border: 1px solid #d2b043;
    background: linear-gradient(#ffe792, #efc84b);
    color: #26374a;
    font-weight: bold;
}
.table-panel {
    background: #eef2f6;
    overflow: hidden;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}
.table-wrap {
    background: #eef2f6;
    overflow: auto;
    min-height: 0;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: #eef2f6;
}
th, td {
    border: 1px solid #c2ccd7;
    padding: 8px 8px;
    text-align: left;
    white-space: nowrap;
}
th {
    color: #1f3955;
    background: linear-gradient(#eef3f7, #d0d9e2);
    position: sticky;
    top: 0;
    z-index: 1;
}
tr:nth-child(even) td { background: #e3e8ee; }
tr.selected td { background: #7db5f7 !important; color: #fff; }
.status {
    display: inline-block;
    padding: 2px 7px;
    border: 1px solid #97aabc;
    background: linear-gradient(#f7fbff, #dfe9f2);
    font-size: 11px;
}
.quick-panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
}
.quick-panel-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: auto;
}
.info-box {
    padding: 10px;
    background: #edf1f5;
    border: 1px solid #b7c1cb;
}
.compact {
    font-size: 11px;
    line-height: 1.5;
}
.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 10px;
    border-top: 1px solid #bac4ce;
    background: linear-gradient(#ecf1f6, #d6dee7);
}
.actions-left {
    justify-content: flex-start;
    border-top: 0;
}
.btn {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid #90a4b8;
    background: linear-gradient(#ffffff, #dfe7ef);
    cursor: pointer;
    font: inherit;
    color: #274a6c;
    text-decoration: none;
    text-align: center;
    border-radius: 2px;
}
.btn.primary {
    border-color: #7fa1c4;
    background: linear-gradient(#fefefe, #c7dbee);
    font-weight: bold;
}
.btn.danger {
    border-color: #b59292;
    background: linear-gradient(#fffafb, #ecd7d7);
}
.btn:disabled, .btn.disabled {
    opacity: .48;
    cursor: not-allowed;
    pointer-events: none;
}
.footerbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 10px;
    border-top: 1px solid #aebbc8;
    background: linear-gradient(#f2f5f8, #dce3ea);
    color: #53697f;
}
.row-actions {
    display: flex;
    gap: 6px;
}
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(66, 79, 95, 0.46);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 2000;
}
.modal-window {
    width: min(760px, 100%);
    max-height: calc(100vh - 32px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    border: 1px solid #8fa0b1;
    background: #dbe1e8;
    box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.modal-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    color: #fff;
    background: linear-gradient(#294f87, #4879ba);
    font-weight: bold;
    text-shadow: 0 1px 0 rgba(0,0,0,.35);
}
.modal-body {
    padding: 12px;
    overflow: auto;
    background: #eef2f6;
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.field { min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: #556c82;
}
.field input, .field select, .field textarea {
    width: 100%;
    padding: 6px;
    border: 1px solid #98a9bb;
    background: #fdfefe;
    font: inherit;
}
.field textarea {
    min-height: 120px;
    resize: vertical;
}
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #d7dce3;
}
.login-panel {
    width: min(480px, calc(100vw - 32px));
    border: 1px solid #6b7785;
    background: #e5eaf0;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.login-panel .header {
    padding: 10px 12px;
    color: #fff;
    font-weight: bold;
    background: linear-gradient(#294f87, #4879ba);
}
.login-panel .body { padding: 16px; background: #eef2f6; }
.login-panel .body .field { margin-bottom: 12px; }
.error-box {
    margin-bottom: 12px;
    padding: 8px 10px;
    border: 1px solid #c55353;
    background: #fde9e9;
}
@media (max-width: 1100px) {
    .content-grid { grid-template-columns: minmax(0, 1fr); }
    .quick-panel { display: none; }
}
@media (max-width: 860px) {
    body { overflow: auto; }
    .window { height: auto; min-height: 100vh; }
    .app-shell { grid-template-columns: 1fr; }
    .content-grid { height: auto; }
    .status-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
}


.list-table {
    background: #f1f4f8;
}
.list-table th {
    font-size: 11px;
    padding: 5px 7px;
    color: #3a556f;
    background: linear-gradient(#f5f8fb, #d7dfe7);
}
.list-table td {
    padding: 5px 7px;
    border-color: #c7d0d9;
    background: #f6f8fb;
}
.list-table tr:nth-child(even) td {
    background: #edf2f6;
}
.list-table tbody tr {
    cursor: pointer;
}
.list-table tbody tr:hover td {
    background: #d8ebff !important;
}
.list-table tbody tr.selected td {
    background: #6daef4 !important;
    color: #ffffff;
}
.popup-body {
    overflow: auto;
    background: #d7dce3;
}
.popup-page-shell {
    min-height: 100vh;
    padding: 12px;
}
.popup-page-content {
    border: 1px solid #98a8b8;
    border-top: 0;
    background: #eef2f6;
    padding: 12px;
}
.detail-grid {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 8px 12px;
    align-items: start;
}
.detail-label {
    font-weight: bold;
    color: #385673;
}
.detail-value {
    background: #fbfcfd;
    border: 1px solid #bcc7d1;
    padding: 7px 8px;
}
.detail-wide {
    grid-column: 1 / -1;
}
@media (max-width: 760px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
}


.search-panel {
    min-height: auto;
}
.search-panel .actions {
    padding: 10px;
}
.search-panel input[type="text"] {
    min-width: 190px;
}


html, body, .window, .window * {
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, select, option, button {
    -webkit-user-select: none;
    user-select: none;
}
