/* Dashboard layout and base controls. Certificate document styles remain in cert.css. */
:root {
    --primary:#25805c;
    --primary-dark:#176343;
    --bg-main:#f3f6f3;
    --bg-sidebar:#123a30;
    --text-main:#263b33;
    --text-muted:#77867d;
    --danger:#dc5353;
    --success:#25805c;
    --shadow:0 4px 24px #233d2e05;
    --radius:15px;
    --transition-speed:.18s;
    --sidebar-min:244px;
    --sidebar-max:244px;
    --mint-main:#25805c;
    --mint-dark:#176343;
    --mint-light:#edf6ef;
    --mint-border:#d7e8db
}
body {
    margin:0;
    font-family:"Segoe UI","Microsoft YaHei",system-ui,sans-serif;
    background:var(--bg-main);
    color:var(--text-main);
    display:flex;
    height:100vh;
    height:100dvh;
    overflow:hidden
}
.sidebar,.content,.top-bar,.card,.modal-box {
    box-sizing:border-box
}
.sidebar {
    width:244px;
    flex:0 0 244px;
    padding:30px 18px 22px;
    background:var(--bg-sidebar);
    color:#d9e8df;
    display:flex;
    flex-direction:column;
    overflow-y:auto;
    z-index:100
}
.logo {
    display:flex;
    align-items:center;
    gap:12px;
    margin:0 8px 36px
}
.logo img {
    width:43px;
    height:43px;
    object-fit:contain;
    background:#fff;
    border-radius:12px;
    padding:6px;
    box-sizing:border-box
}
.logo-text {
    font-size:23px;
    letter-spacing:2px;
    font-weight:700;
    color:#fff
}
.logo-text small {
    display:block;
    font-size:10px;
    font-weight:400;
    letter-spacing:2px;
    color:#a6c6b5;
    margin-top:4px
}
.nav-group {
    margin-bottom:24px
}
.nav-label {
    font-size:10px;
    letter-spacing:2px;
    color:#8ab09b;
    padding-left:14px;
    margin:0 0 12px
}
.nav-btn {
    width:100%;
    padding:12px;
    margin:3px 0;
    border:1px solid transparent;
    background:transparent;
    border-radius:9px;
    text-align:left;
    font-size:12px;
    color:#c4dbce;
    cursor:pointer;
    display:flex;
    align-items:center;
    gap:11px;
    font-family:inherit;
    min-height:43px
}
.btn-text {
    white-space:nowrap
}
.nav-icon {
    flex-shrink:0;
    opacity:.85
}
.nav-btn:hover {
    background:#ffffff0b;
    color:#fff
}
.nav-btn.active {
    background:#e2f0dd;
    color:#214e35;
    font-weight:650;
    box-shadow:0 3px 12px #001e1510
}
.export-btn {
    border-color:#ffffff18
}
.export-btn.highlight {
    background:#ffffff08;
    color:#cbe2b9;
    border-color:#ffffff25
}
.sidebar-footer {
    margin-top:auto;
    padding:22px 6px 0;
    border-top:1px solid #ffffff16;
    display:flex;
    align-items:center;
    gap:10px;
    font-size:11px;
    color:#c1d7ca
}
.sidebar-footer small {
    display:block;
    margin-top:5px;
    color:#89ae9a;
    font-size:10px
}
.account-mark {
    display:grid;
    place-items:center;
    width:32px;
    height:32px;
    border-radius:50%;
    background:#ffffff12;
    color:#b7d2a8;
    font-weight:650
}
.content {
    flex:1;
    min-width:0;
    padding:32px 36px 40px;
    overflow:auto
}
.workspace-heading {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    margin-bottom:26px
}
.workspace-eyebrow {
    font-size:10px;
    font-weight:650;
    letter-spacing:2px;
    color:#84968b;
    margin:0 0 10px
}
.workspace-heading h1 {
    font-size:24px;
    font-weight:650;
    letter-spacing:.5px;
    margin:0
}
.workspace-description {
    font-size:12px;
    color:var(--text-muted);
    margin:10px 0 0
}
.workspace-badge {
    font-size:11px;
    white-space:nowrap;
    padding:8px 12px;
    border:1px solid #d9e5da;
    border-radius:30px;
    color:#548064;
    background:#edf4eb
}
.top-bar {
    display:flex;
    justify-content:space-between;
    align-items:flex-end;
    gap:20px;
    padding:18px 22px;
    background:#fff;
    border:1px solid #e4eae3;
    border-radius:var(--radius);
    margin-bottom:20px
}
.selector-container {
    display:flex;
    gap:16px;
    flex:1;
    min-width:0
}
.selector-field {
    display:flex;
    flex-direction:column;
    gap:8px;
    min-width:0;
    flex:0 1 280px
}
.selector-field>label {
    font-size:11px;
    font-weight:600;
    color:#829087
}
.selector-field .custom-select,.selector-field select {
    width:100%;
    min-width:0
}
.selector-field .custom-select-trigger {
    min-width:0
}
.view-controls {
    flex-shrink:0
}
.card {
    border:1px solid #e4eae3;
    min-height:430px
}
.card-header h3 {
    font-size:17px;
    font-weight:650;
    margin:0;
    white-space:nowrap
}
.section-subtitle {
    display:block;
    font-size:11px;
    color:var(--text-muted);
    font-weight:400;
    margin-top:7px
}
.data-stats {
    display:flex;
    align-items:center;
    gap:10px;
    flex-wrap:wrap;
    margin:0 0 12px;
    font-size:11px;
    color:#62786b
}
.data-stats>span {
    padding:6px 10px;
    border:1px solid #e2eae1;
    border-radius:6px;
    background:#f7faf5
}
.data-limit-note {
    font-size:11px;
    color:#8b978e;
    line-height:1.7;
    margin:0 0 18px
}
.filter-bar {
    margin:0!important;
    padding:0!important;
    background:transparent!important;
    gap:8px!important
}
.search-group {
    flex:1;
    min-width:160px
}
.filter-group {
    display:flex;
    gap:8px;
    flex-shrink:0
}
#globalSearch {
    width:100%;
    min-width:150px;
    box-sizing:border-box;
    background:#f8faf7!important;
    border:1px solid #dce5dc!important;
    padding:10px 12px!important;
    font-weight:400!important;
    color:var(--text-main)!important;
    cursor:text!important
}
.sr-only {
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0,0,0,0);
    white-space:nowrap;
    border:0
}
.filter-bar input[type=hidden] {
    display:none!important
}
select  {
    padding: 10px 34px 10px 14px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    background: #fff;
    font-size: 14px;
    min-width: 180px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    color: #334155;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%2342B983' d='M7 10L2 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
select:hover  {
    border-color: #94a3b8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}
select:focus  {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.12), 0 2px 8px rgba(45, 212, 191, 0.08);
    background: #fafffe;
}
/* 模式切换按钮组 */
.view-controls  {
    display: flex;
    background: #eee;
    padding: 4px;
    border-radius: 10px;
}
.toggle-btn  {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    background: transparent;
    transition: all var(--transition-speed);
}
.toggle-btn.active  {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: var(--primary-dark);
    font-weight: bold;
}
.card  {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    min-height: 450px;
    position: relative;
}
.card-header  {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}
@media (min-width: 1024px)  {
    .card-header  {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}
/* --- 表格显示模式核心控制 --- */
.table-wrapper  {
    position: relative;
    overflow-x: auto;
}
/* 完美显示模式：强制一行，出现左右拉进度条 */
.pretty-mode table  {
    width: max-content;
    min-width: 100%;
}
.pretty-mode td, .pretty-mode th  {
    white-space: nowrap;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 展开全部模式：内容自动换行 */
.full-mode table  {
    width: 100%;
}
.full-mode td  {
    white-space: normal;
    word-break: break-all;
}
table  {
    border-collapse: separate;
    border-spacing: 0;
}
th  {
    background: #f8fafc;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 2px solid #f1f5f9;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 20;
}
td  {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-main);
}
tr:hover  {
    background: #f0fdfa;
}
/* --- 录入表单 & 时间控件 --- */
.form-grid  {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.form-item  {
    display: flex;
    flex-direction: column;
}
.form-item input, .form-item textarea, #sqlCmd  {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    font-family: inherit;
    background-color: white;
    color: var(--text-main);
    padding: 12px 14px;
    transition: all var(--transition-speed) ease;
}
.form-item input:focus, .form-item textarea:focus, #sqlCmd:focus  {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}
#sqlCmd  {
    display: block;
    margin-bottom: 20px;
    min-height: 200px;
    resize: vertical;
    line-height: 1.6;
    background-color: #fcfcfc;
    font-family: 'Consolas', 'Monaco', monospace;
}
.form-item input  {
    height: 45px;
}
.form-item textarea  {
    resize: vertical;
    min-height: 100px;
}
.form-item label  {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}
.form-item-long  {
    grid-column: 1 / -1;
}
input[type="date"]  {
    line-height: 43px;
    appearance: none;
    -webkit-appearance: none;
}
input[type="date"]::-webkit-calendar-picker-indicator  {
    cursor: pointer;
    filter: invert(48%) sepia(79%) saturate(2476%) hue-rotate(142deg) brightness(98%) contrast(92%);
}
/* --- Empty Placeholder --- */
.empty-placeholder  {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    color: var(--text-muted);
    text-align: center;
}
.empty-icon  {
    font-size: 64px;
    margin-bottom: 16px;
    filter: grayscale(1);
    opacity: 0.5;
}
.empty-placeholder h4  {
    margin: 0 0 8px 0;
    color: var(--text-main);
    font-size: 18px;
}
.empty-placeholder p  {
    margin: 0;
    font-size: 14px;
}
/* --- Buttons --- */
.btn-submit  {
    background: var(--primary-dark);
    color: white;
    padding: 12px 40px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}
.btn-submit:active  {
    transform: scale(0.98);
}
.btn-del  {
    background: var(--danger);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}
.btn-filter, .btn-approve, .btn-save-row  {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}
.btn-reset, .btn-cancel-row  {
    background: #e2e8f0;
    color: var(--text-main);
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}
.btn-edit-row  {
    color: var(--primary-dark);
    background: #ccfbf1;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
}
.btn-reject  {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}
.btn-loading  {
    pointer-events: none;
    opacity: 0.7;
    position: relative;
    color: transparent !important;
}
.btn-loading::after  {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}
@keyframes spin  {
    to  {
        transform: rotate(360deg);
    }
}
/* --- Utilities --- */
.hidden  {
    display: none !important;
}
.fade-in  {
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn  {
    from  {
        opacity: 0;
        transform: translateY(10px);
    }
    to  {
        opacity: 1;
        transform: translateY(0);
    }
}
/* --- Toast --- */
.toast  {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 16px 28px;
    border-radius: 12px;
    display: none;
    z-index: 1000;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
    min-width: 320px;
}
.toast-content  {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.toast-msg  {
    font-size: 14px;
    font-weight: 500;
    color: #e2e8f0;
}
.undo-btn  {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-speed);
    font-size: 13px;
    white-space: nowrap;
}
.undo-btn:hover  {
    background: white;
    transform: translateY(-1px);
}
/* --- Filter Bar --- */
.filter-bar  {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: #f1f5f9;
    border-radius: 8px;
    margin-bottom: 20px;
    align-items: center;
}
.filter-bar input, .filter-bar select  {
    padding: 8px 30px 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    min-width: 120px;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.2s ease;
    background-color: #fff;
    cursor: pointer;
}
.filter-bar select:hover  {
    border-color: #94a3b8;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.filter-bar input:focus, .filter-bar select:focus  {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45,212,191,0.1);
}
#globalSearch  {
    background: #fff;
    border: 2px solid var(--primary) !important;
    font-weight: 600;
    color: var(--primary-dark);
}
#globalSearch::placeholder  {
    color: #94a3b8;
    font-weight: 400;
}
/* --- Inline Edit --- */
td[contenteditable="true"]  {
    background-color: #fff;
    outline: 2px solid var(--primary);
    box-shadow: inset 0 0 5px rgba(45, 212, 191, 0.2);
    border-radius: 4px;
    position: relative;
    z-index: 21;
}
.pretty-mode td[contenteditable="true"]  {
    white-space: nowrap !important;
    overflow: auto !important;
    text-overflow: clip !important;
    max-width: 600px;
    min-width: 100px;
    padding-right: 10px;
}
tr:has(td[contenteditable="true"])  {
    background-color: #f0fdfa !important;
    box-shadow: inset 4px 0 0 var(--primary);
}
tr:has(.edit-actions-container)  {
    background-color: #f0fdf4 !important;
}
.edit-actions-container  {
    display: flex;
    gap: 8px;
    justify-content: center;
    white-space: nowrap;
    padding: 0 10px;
}
.btn-save-row, .btn-cancel-row  {
    margin: 0 !important;
    padding: 6px 10px;
    font-size: 12px;
}
/* Sticky Action Column */
#dataDisplay table th:last-child, #dataDisplay table td:last-child  {
    position: sticky !important;
    right: 0;
    background-color: #fff;
    z-index: 40;
    border-left: 1px solid #f1f5f9;
    box-shadow: -4px 0 8px rgba(0,0,0,0.05);
}
#dataDisplay table th:last-child  {
    background-color: #f8fafc;
    z-index: 30;
}
#dataDisplay tr:hover td:last-child  {
    background: #f0fdfa !important;
}
#dataDisplay tr:has(td[contenteditable="true"]) td:last-child  {
    background: #e6fffa !important;
    box-shadow: -6px 0 12px rgba(45, 212, 191, 0.15);
}
