/* ========== 全局样式 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    font-size: 14px;
}
.hidden { display: none !important; }

/* ========== 登录页 ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 50%, #3182ce 100%);
}
.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 48px 40px;
    width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-header {
    text-align: center;
    margin-bottom: 32px;
}
.login-header h1 {
    font-size: 28px;
    color: #1a365d;
    margin-bottom: 8px;
}
.login-header p {
    color: #718096;
    font-size: 14px;
}
.login-form .form-group {
    margin-bottom: 20px;
}
.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-weight: 500;
}
.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}
.login-form input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49,130,206,0.1);
}
.login-tip {
    text-align: center;
    margin-top: 16px;
    font-size: 12px;
    color: #a0aec0;
}

/* ========== 按钮 ========== */
.btn-primary, .btn-secondary, .btn-danger, .btn-text {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.btn-primary {
    background: #3182ce;
    color: #fff;
}
.btn-primary:hover { background: #2c5282; }
.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}
.btn-secondary:hover { background: #cbd5e0; }
.btn-danger {
    background: #e53e3e;
    color: #fff;
}
.btn-danger:hover { background: #c53030; }
.btn-text {
    background: transparent;
    color: #3182ce;
    padding: 4px 8px;
}
.btn-text:hover { background: #ebf8ff; }
.btn-block { width: 100%; padding: 12px; font-size: 16px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ========== 主布局 ========== */
.app {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 220px;
    background: #1a202c;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid #2d3748;
}
.sidebar-logo h2 {
    font-size: 20px;
    color: #fff;
}
.sidebar-menu {
    padding: 12px 0;
}
.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: #a0aec0;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.menu-item:hover {
    background: #2d3748;
    color: #fff;
}
.menu-item.active {
    background: #2d3748;
    color: #fff;
    border-left-color: #3182ce;
}
.menu-icon {
    margin-right: 10px;
    font-size: 16px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.topbar {
    background: #fff;
    padding: 16px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: #2d3748;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #718096;
}
.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ========== 看板统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.stat-card.warning {
    border-left: 4px solid #e53e3e;
}
.stat-label {
    color: #718096;
    font-size: 14px;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 8px;
}
.stat-sub {
    font-size: 12px;
    color: #a0aec0;
}

/* ========== 面板 ========== */
.panel-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.panel {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}
.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
}
.panel-header h3 {
    font-size: 16px;
    color: #2d3748;
}
.panel-body {
    padding: 16px 20px;
}

/* ========== 工具栏 ========== */
.page-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}
.page-toolbar input, .page-toolbar select {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}
.page-toolbar input:focus, .page-toolbar select:focus {
    outline: none;
    border-color: #3182ce;
}

/* ========== 数据表格 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    background: #f7fafc;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
    white-space: nowrap;
}
.data-table td {
    padding: 12px;
    border-bottom: 1px solid #edf2f7;
    color: #2d3748;
}
.data-table tr:hover {
    background: #f7fafc;
}
.data-table .actions {
    display: flex;
    gap: 8px;
}

/* ========== 状态标签 ========== */
.status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.status-active { background: #c6f6d5; color: #22543d; }
.status-expiring { background: #fefcbf; color: #744210; }
.status-expired { background: #fed7d7; color: #742a2a; }
.status-renewed { background: #bee3f8; color: #2a4365; }
.status-in_stock { background: #c6f6d5; color: #22543d; }
.status-sold { background: #e2e8f0; color: #4a5568; }
.status-warning { background: #fed7d7; color: #742a2a; }
.status-normal { background: #c6f6d5; color: #22543d; }

/* ========== 弹窗 ========== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: #fff;
    border-radius: 12px;
    width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 18px;
    color: #2d3748;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #a0aec0;
    line-height: 1;
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #4a5568;
    font-weight: 500;
    font-size: 13px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #3182ce;
}
.form-group textarea {
    resize: vertical;
    min-height: 60px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3748;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    animation: slideDown 0.3s ease;
}
.toast.success { background: #38a169; }
.toast.error { background: #e53e3e; }
.toast.warning { background: #d69e2e; }
@keyframes slideDown {
    from { transform: translate(-50%, -20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

/* ========== 续费记录弹窗 ========== */
.renew-list {
    max-height: 300px;
    overflow-y: auto;
}
.renew-item {
    padding: 12px;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
}
.renew-item:last-child { border-bottom: none; }

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .panel-row { grid-template-columns: 1fr; }
}
