
#header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #1a365d 100%);
    border-bottom: 1px solid #3d6b9e;
    box-shadow: 0 2px 8px rgba(0, 40, 80, 0.4);
}

.branding {
    display: flex;
    align-items: center;
    padding: 8px 0;
}

.logo-container {
    display: flex;
    align-items: center;
    text-decoration: none !important;
    gap: 15px;
}

.site-logo {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.site-title {
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
    letter-spacing: 1.5px;
}

#branding h1 {
    display: none;
}

#branding {
    width: auto;
}

div.breadcrumbs {
    background: #2d5a87;
    color: #e8f4fc;
    border-bottom: 1px solid #3d7ab0;
}

div.breadcrumbs a {
    color: #e8f4fc;
}

.module {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.module h2 {
    background: #f7fafc;
    border-radius: 8px 8px 0 0;
    color: #2d3748;
    padding: 12px 20px;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

.module table {
    border-radius: 0 0 8px 8px;
}

button[type="submit"] {
    background: #4a5568;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    color: white;
    transition: all 0.2s ease;
    font-weight: 500;
}

button[type="submit"]:hover {
    background: #2d3748;
}

a:link, a:visited {
    color: #4a5568;
}

.object-tools a:link, .object-tools a:visited {
    background: #ed8936;
    border-radius: 6px;
    font-weight: 500;
}

#content-main .app-section {
    margin-bottom: 24px;
}

#content-main .app-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.app-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    border: 1px solid #e2e8f0;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.app-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2d3748;
}

.app-card .app-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    background: #f0f0f0;
}

.app-card ul {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
}

.app-card li {
    padding: 6px 0;
}

.app-card li a {
    color: #4a5568;
    text-decoration: none;
    display: block;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.15s;
}

.app-card li a:hover {
    background: #f7fafc;
    color: #2d3748;
}

/* ============ 紧凑表单行样式 - 覆盖 Django Admin 默认样式 ============ */

body {
    line-height: 1.4 !important;
}

/* 核心：表单行压缩 */
fieldset.module .form-row,
.aligned .form-row,
.form-row {
    padding: 3px 10px !important;
    margin: 0 !important;
    border-bottom: 1px solid #eee !important;
    line-height: 1.3 !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden !important;
}

.form-row p,
.form-row > div,
.form-row div.field-box {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.3 !important;
    min-height: 0 !important;
}

.field-box {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    display: inline-block !important;
}

.form-row:last-child {
    border-bottom: none !important;
}

/* 标签压缩 */
.aligned label,
form .aligned label,
.aligned .form-row label,
fieldset.aligned .form-row label {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    padding-left: 0 !important;
    padding-right: 10px !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    min-height: 0 !important;
    width: 160px !important;
    font-size: 13px !important;
}

/* 输入框压缩 */
.aligned input[type="text"],
.aligned input[type="password"],
.aligned input[type="email"],
.aligned input[type="number"],
.aligned input[type="url"],
.aligned select,
.aligned textarea,
form .aligned input[type="text"],
form .aligned input[type="password"],
form .aligned input[type="email"],
form .aligned input[type="number"],
form .aligned input[type="url"],
form .aligned select,
form .aligned textarea,
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], select, textarea {
    border: 1px solid #ccc !important;
    border-radius: 2px !important;
    padding: 3px 8px !important;
    min-height: 24px !important;
    height: 24px !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    vertical-align: middle !important;
    box-sizing: content-box !important;
}

select {
    padding: 2px 8px !important;
    min-height: 24px !important;
    height: 28px !important;
    line-height: 1.3 !important;
    cursor: pointer;
    box-sizing: border-box !important;
    font-size: 13px !important;
}

select option {
    padding: 2px 6px;
    line-height: 1;
    min-height: 16px;
}

textarea {
    height: auto !important;
    min-height: 40px !important;
}

/* 合同模板条款文本框高度 */
#id_custom_clauses_before,
#id_custom_clauses_after {
    min-height: 200px !important;
    height: 200px !important;
    max-height: none !important;
    width: 1000px !important;
    max-width: none !important;
    padding: 6px 10px !important;
    line-height: 1.5 !important;
    vertical-align: top !important;
}

fieldset.contract-clauses .form-row,
.contract-clauses fieldset .form-row {
    overflow: visible !important;
    height: auto !important;
    min-height: 220px !important;
    max-width: none !important;
}

fieldset.contract-clauses {
    max-width: none !important;
}

/* 输入框聚焦 */
input[type="text"]:focus, input[type="password"]:focus,
input[type="email"]:focus, input[type="number"]:focus,
select:focus, textarea:focus {
    border-color: #4a5568 !important;
    outline: none !important;
}

/* fieldset 分组压缩 */
fieldset {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

fieldset.module {
    margin-bottom: 8px !important;
    border: 1px solid #e2e8f0 !important;
    padding: 0 !important;
}

fieldset.module > .form-row:first-child {
    border-top: none !important;
}

fieldset.module h2 {
    padding: 6px 12px !important;
    font-size: 13px !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

/* 通用表单内元素间距清零 */
form .aligned p,
form .aligned ul,
form .aligned div,
.aligned p,
.aligned ul,
.aligned div {
    margin: 0 !important;
    padding: 0 !important;
}

/* 提交按钮行 */
.submit-row {
    padding: 5px 10px !important;
    margin: 5px 0 !important;
    border-top: 1px solid #eee !important;
}

/* ============ 列表页面紧凑样式 ============ */

.change-list .results {
    border-radius: 8px;
    overflow: hidden;
}

.change-list .results th,
.change-list table tbody th,
.change-list table thead th {
    background: #f7fafc;
    color: #2d3748;
    padding: 5px 10px !important;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px !important;
    line-height: 1.4 !important;
    height: auto !important;
}

.change-list .results td,
.change-list table tbody td {
    padding: 4px 10px !important;
    border-bottom: 1px solid #eee !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    height: auto !important;
    vertical-align: middle !important;
}

.change-list .results tr:hover {
    background: #f7fafc;
}

.change-list .action-checkbox {
    width: 18px;
    padding: 4px !important;
    text-align: center;
}

/* 分页器 */
.paginator {
    border-radius: 6px;
    padding: 8px !important;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    font-size: 11px !important;
}

/* ============ 页面整体布局压缩 ============ */

.module ul.actionlist {
    padding: 6px 12px !important;
}

#content {
    padding: 12px 20px !important;
}

#content h1 {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 10px !important;
    font-size: 18px !important;
}

#user-tools {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#user-tools a {
    color: #ffffff !important;
    font-weight: 500;
}

/* 权限选择列表框 - 加大高度 */
#id_permissions_from,
#id_permissions_to,
#id_user_permissions_from,
#id_user_permissions_to,
#id_groups_from,
#id_groups_to {
    height: 400px !important;
    min-height: 400px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
}

.messagelist li {
    border-radius: 6px;
    padding: 8px 14px !important;
    font-size: 12px !important;
}

/* 登录页面保留原始较大样式 */
.login #container {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.login .form-row {
    padding: 6px 0 !important;
}

.login #header {
    border-radius: 12px 12px 0 0;
}

/* ============ 侧边栏 ============ */

#nav-sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
}

#nav-sidebar .app-section {
    margin-bottom: 0;
}

#nav-sidebar .section-title {
    padding: 10px 16px !important;
    font-weight: 600;
    color: #718096;
    font-size: 13px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0;
    line-height: 1.5 !important;
}

#nav-sidebar .model-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#nav-sidebar .model-list li {
    margin: 0;
}

#nav-sidebar .model-list li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px !important;
    color: #4a5568;
    text-decoration: none;
    font-size: 13px !important;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    line-height: 1.5 !important;
}

#nav-sidebar .model-list li a:hover {
    background: #f7fafc;
    border-left-color: #4a5568;
}

#nav-sidebar .model-list li a:focus {
    background: #f7fafc;
}

#nav-sidebar .model-list li a.active {
    background: #f0f4f8;
    border-left-color: #4a5568;
    font-weight: 500;
}

#nav-sidebar .model-list li a .app-icon {
    font-size: 14px;
    width: auto;
    height: auto;
    min-width: auto;
    background: none;
    border-radius: 0;
    display: inline;
}
