@charset "UTF-8";

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
    --primary:        #2d6a4f;
    --primary-hover:  #245c43;
    --primary-light:  #52b788;
    --primary-bg:     #eaf5ee;
    --sidebar-width:  220px;
    --header-height:  60px;
    --radius:         10px;
    --radius-sm:      6px;
    --shadow-sm:      0 1px 4px rgba(0,0,0,.06);
    --shadow-md:      0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:      0 8px 32px rgba(0,0,0,.12);
    --text-primary:   #111827;
    --text-secondary: #6b7280;
    --text-muted:     #9ca3af;
    --bg-page:        #f3f4f6;
    --bg-white:       #ffffff;
    --border:         #e5e7eb;
    --border-light:   #f3f4f6;
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
}

ul, ol { margin: 0; padding: 0; list-style: none; }
textarea { resize: none; }
a { color: inherit; text-decoration: none; }

/* ============================================================
   Layout — Sidebar
   ============================================================ */
.ui-vnav {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-white);
    z-index: 100;
    box-shadow: var(--shadow-md);
    border-right: 1px solid var(--border-light);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.ui-vnav::-webkit-scrollbar { width: 4px; }
.ui-vnav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Logo — first li inside ui-nav-inner */
.ui-vnav .nav-logo-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 0 14px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-light);
}

.ui-vnav .nav-logo-item img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    border: 2px solid var(--border);
    animation: spin 12s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Group heading */
.ui-vnav .ui-group {
    padding: 20px 16px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* First group heading sits right below the logo — reduce top gap */
.ui-vnav .nav-logo-item + .ui-group {
    padding-top: 10px;
}

/* Nav item */
.ui-nav-inner { padding: 0 10px 24px; }

.ui-vnav .ui-item {
    border-radius: var(--radius-sm);
    margin: 2px 0;
    cursor: pointer;
    transition: background .15s ease;
}

.ui-vnav .ui-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: color .15s;
    white-space: nowrap;
    overflow: hidden;
}

.ui-vnav .ui-item a img {
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0;
    opacity: .75;
    object-fit: contain;
}

.ui-vnav .ui-item:hover a {
    color: var(--text-primary);
    background: var(--bg-page);
}

.ui-vnav .ui-item:hover a img { opacity: 1; }

.ui-vnav .current a,
.ui-vnav .current:hover a {
    color: var(--primary);
    background: var(--primary-bg);
    font-weight: 600;
}

.ui-vnav .current a img,
.ui-vnav .current:hover a img { opacity: 1; }

/* ============================================================
   Layout — Header
   ============================================================ */
.header {
    position: fixed;
    top: 8px;
    left: calc(var(--sidebar-width) + 10px);
    right: 10px;
    height: var(--header-height);
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    z-index: 99;
    padding: 0 16px;
}

#main-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

/* ============================================================
   Layout — Main content
   ============================================================ */
#mainWrapper {
    position: fixed;
    left: calc(var(--sidebar-width) + 10px);
    right: 10px;
    top: calc(var(--header-height) + 18px);
    bottom: 10px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: auto;
    padding: 20px;
    /* display: block — avoid flex min-width issue that hides horizontal scrollbar */
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    transition: all .15s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    line-height: 1.5;
}

.btn i { font-size: 14px; }

.btn-success {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-success:hover, .btn-success:focus {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}

.btn-primary {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}
.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.btn-danger {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.btn-warning {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}
.btn-warning:hover {
    background: #d97706;
    border-color: #d97706;
    color: #fff;
}

.btn-info {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #fff;
}
.btn-info:hover {
    background: #0284c7;
    border-color: #0284c7;
    color: #fff;
}

.btn-default, .btn-secondary, .bar-button {
    background: var(--bg-white);
    border-color: var(--border);
    color: var(--text-primary);
}
.btn-default:hover, .btn-secondary:hover, .bar-button:hover {
    background: var(--bg-page);
    border-color: #d1d5db;
    color: var(--text-primary);
}

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; }
.btn:focus, button:focus { outline: none; box-shadow: none; }

/* ============================================================
   Forms
   ============================================================ */
.form-control {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: border-color .15s, box-shadow .15s;
    height: 36px;
    padding: 6px 10px;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(82,183,136,.15);
    outline: none;
}

.form-group label {
    width: 75px;
    text-align: right;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 0;
    flex: 1;
    min-width: 0;
}

.input-group .form-control:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .form-control:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.input-group-addon, .input-group-text {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.input-group-addon + .form-control { border-left: none; }

.input-required {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239,68,68,.15) !important;
}

select.form-control, select.form-select {
    appearance: auto;
    cursor: pointer;
}

textarea.form-control { height: auto; min-height: 80px; }

/* ============================================================
   Tables
   ============================================================ */
table {
    width: max-content;  /* 让表格根据内容撑开，不强制 100% */
    min-width: 100%;     /* 但至少撑满容器 */
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 13px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    /* table-layout: auto — 让浏览器根据内容自动分配列宽 */
}

table th {
    background: #f9fafb;
    height: 44px;
    padding: 0 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: .03em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

table tr {
    border-bottom: 1px solid var(--border-light);
    transition: background .1s;
}

table tr:last-child { border-bottom: none; }

table tr:hover { background: #f9fafb; }

table tr td {
    padding: 0 12px;
    height: 52px;
    text-align: center;
    color: var(--text-primary);
    font-size: 13px;
    vertical-align: middle;
    white-space: nowrap;
}

table select {
    text-align: center;
    text-align-last: center;
}

/* Search row inside thead */
table thead tr:not(.tableHeader) th,
table thead tr:not(.tableHeader) td {
    background: var(--bg-white);
    padding: 6px 6px;
    height: auto;
}

table thead tr:not(.tableHeader) .form-control {
    height: 30px;
    font-size: 12px;
    padding: 3px 6px;
}

/* ============================================================
   Modals
   ============================================================ */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    background: var(--bg-white);
}

.modal-footer {
    background: #f9fafb;
    border-top: 1px solid var(--border);
    padding: 12px 20px;
}

.modal-dialog { margin: 60px auto; }

.btn-close:focus { box-shadow: none; outline: none; }

/* Draggable modal */
.gdialog .modal-header { cursor: move; }

/* ============================================================
   Toast Notifications
   ============================================================ */
.tip_blue,
.tip_red,
.tip_green,
.tip_process {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    height: 46px;
    min-width: 260px;
    max-width: 420px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
}

.tip_green  { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.tip_red    { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.tip_blue   { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.tip_process {
    background: var(--bg-white);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.icon_loading_small {
    background: url(/resource/image/icon_loading_small.gif) no-repeat center;
    background-size: contain;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ============================================================
   Dialog toolbar
   ============================================================ */
.dialog-toolbar {
    height: 56px;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
    flex-shrink: 0;
}

.toolbar-action { display: none; }

/* ============================================================
   Misc
   ============================================================ */
.toolbar_menu:hover {
    background: var(--bg-page);
    border-radius: var(--radius-sm);
}

.nav-menu-divider {
    border-top: 1px solid var(--border-light);
    margin: 4px 10px;
}

.input-pagenumber {
    width: 54px;
    display: inline-block;
    height: 30px;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

/* Global mask */
#global_mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 9990;
    backdrop-filter: blur(1px);
}

/* Pagination */
.pagination {
    margin: 16px 0 0;
    gap: 4px;
    display: flex;
    justify-content: center;
}

.pagination .page-item .page-link {
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary);
    border: 1px solid var(--border);
    font-size: 13px;
    padding: 5px 10px;
    margin: 0 2px;
    min-width: 32px;
    text-align: center;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination .page-item.disabled .page-link {
    color: var(--text-muted);
    background: var(--bg-page);
}

/* Badges / Tags */
.badge {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 20px;
}

/* Dropdown menu */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 6px;
    font-size: 13px;
}

.dropdown-menu a,
.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background .12s;
}

.dropdown-menu a:hover,
.dropdown-item:hover {
    background: var(--bg-page);
    color: var(--text-primary);
}

/* User avatar in header */
.header-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}
