/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 登录容器 */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 8px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

/* 表单样式 */
.login-form {
    margin-top: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-block {
    width: 100%;
}

/* 错误消息 */
.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #fcc;
}

/* 仪表板样式 */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h1 {
    color: #333;
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: #666;
}

.btn-logout {
    background: #dc3545;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-logout:hover {
    background: #c82333;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

.stat-card .value {
    color: #333;
    font-size: 32px;
    font-weight: bold;
}

.stat-card.online .value {
    color: #28a745;
}

.stat-card.offline .value {
    color: #dc3545;
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

table th {
    background: #f8f9fa;
    font-weight: 500;
    color: #333;
}

table tr:hover {
    background: #f8f9fa;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.online {
    background: #d4edda;
    color: #155724;
}

.status-badge.offline {
    background: #f8d7da;
    color: #721c24;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* 链接样式 */
a {
    color: #667eea;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a.btn {
    text-decoration: none;
    display: inline-block;
}

/* 输入框样式 */
.input {
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .login-box {
        padding: 30px 20px;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 12px;
    }
    
    table th,
    table td {
        padding: 8px;
    }
}

/* 发布管理页面 */
.releases-page {
    width: 100%;
    align-self: flex-start;
}

.release-section {
    margin-bottom: 20px;
}

.release-title {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
}

.release-hint,
.release-detail {
    color: #666;
    font-size: 12px;
    font-weight: 400;
}

.release-detail {
    margin-top: 4px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.release-hint {
    margin-top: 10px;
}

.release-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.release-tab {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #333;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    gap: 4px;
    min-width: 130px;
    padding: 10px 14px;
    text-align: left;
}

.release-tab:hover {
    border-color: #667eea;
}

.release-tab:focus-visible,
.release-link-button:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.release-tab-active {
    background: #eef0fd;
    border-color: #667eea;
    font-weight: 500;
}

.release-tab-version {
    color: #666;
    font-size: 12px;
    font-weight: 400;
}

.release-form {
    display: grid;
    gap: 15px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.release-form label,
.release-dialog-field {
    color: #333;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    gap: 6px;
}

.release-form input,
.release-form select,
.release-form textarea,
.release-dialog textarea {
    border: 1px solid #ddd;
    border-radius: 6px;
    font: inherit;
    padding: 10px;
    width: 100%;
}

.release-form-wide {
    grid-column: 1 / -1;
}

.release-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.release-actions .release-hint {
    margin-top: 0;
}

.release-actions progress {
    flex: 1;
    min-width: 120px;
}

.release-message {
    background: white;
    border-left: 4px solid #667eea;
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    margin-bottom: 20px;
    overflow-wrap: anywhere;
    padding: 12px 16px;
}

.release-message-success {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.release-message-error {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.release-message-warning {
    background: #fff3cd;
    border-left-color: #ffc107;
    color: #664d03;
}

.release-status-draft {
    background: #e2e3e5;
    color: #41464b;
}

.release-status-published {
    background: #d4edda;
    color: #155724;
}

.release-status-withdrawn {
    background: #f8d7da;
    color: #721c24;
}

.release-latest {
    background: #eef0fd;
    border-radius: 10px;
    color: #4a55c4;
    font-size: 12px;
    margin-left: 6px;
    padding: 2px 8px;
}

.release-file-name {
    overflow-wrap: anywhere;
}

.release-time {
    min-width: 170px;
}

.release-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 150px;
}

.release-small-button {
    font-size: 12px;
    padding: 6px 10px;
}

.release-button-danger {
    background: #dc3545;
    color: white;
}

.release-button-danger:hover {
    background: #c82333;
}

.release-link-button {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 12px;
    margin-top: 4px;
    padding: 0;
}

.release-info {
    display: grid;
    font-size: 14px;
    gap: 8px 16px;
    grid-template-columns: max-content minmax(0, 1fr);
}

.release-info dt {
    color: #666;
}

.release-info dd {
    color: #333;
    overflow-wrap: anywhere;
}

.release-dialog {
    border: none;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin: auto;
    max-width: 520px;
    padding: 24px;
    width: calc(100% - 32px);
}

.release-dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

.release-dialog-text {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.release-dialog-field[hidden] {
    display: none;
}

.release-dialog-error {
    color: #721c24;
    font-size: 14px;
    margin-top: 12px;
    overflow-wrap: anywhere;
}

.release-dialog-actions {
    justify-content: flex-end;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .release-form {
        grid-template-columns: 1fr;
    }

    .release-tab {
        flex: 1 1 calc(50% - 10px);
        min-width: 0;
    }
}

/* 共享应用布局：所有规则限定在登录后的页面，保持登录外观。 */
body.app-page { display: block; background: #f4f6fa; color: #243247; padding-left: 224px; }
.app-page .dashboard-container { width: 100%; max-width: 1600px; min-width: 0; padding: 28px; margin: 0 auto; }
.app-page .dashboard-header { gap: 16px; flex-wrap: wrap; }
.app-page .dashboard-header h1 { font-size: 26px; }
.app-page .table-container { max-width: 100%; overflow-x: auto; margin-bottom: 20px; }
.app-page .table-container table { min-width: 680px; }
.app-page .stats-grid { grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); }
.app-nav { position: fixed; inset: 0 auto 0 0; width: 224px; background: #15243a; color: #d8e2f2; z-index: 40; display: flex; flex-direction: column; padding: 22px 14px; overflow-y: auto; }
.nav-brand { font-size: 25px; padding: 4px 12px 24px; }
.app-nav a { color: #d8e2f2; text-decoration: none; padding: 11px 12px; border-radius: 6px; }
.app-nav a:hover, .app-nav a[aria-current] { background: #304869; color: white; }
.app-nav .nav-product { padding: 8px 12px 8px 30px; font-size: 14px; }
.nav-group { font-size: 12px; color: #a1b3cc; padding: 20px 12px 6px; }
.nav-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 28px; gap: 12px; }
.nav-footer span { overflow-wrap: anywhere; }
.nav-toggle { display: none; }
.nav-overlay { position: fixed; inset: 0; background: #0006; border: 0; z-index: 35; }
.nav-overlay[hidden] { display: none; }
.status-explanation { line-height: 1.7; color: #52627a; margin: 0 0 22px; }
.status-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-bottom: 20px; }
.status-filters label { display: grid; gap: 6px; max-width: 100%; }
.status-filters input, .status-filters select { padding: 10px; border: 1px solid #ccd4df; border-radius: 6px; max-width: 100%; background: white; }
.pagination { display: flex; gap: 16px; align-items: center; justify-content: center; }
.task-drawer { position: fixed; margin: 0 0 0 auto; inset: 0; width: min(620px,100%); max-width: 100%; height: 100dvh; max-height: 100dvh; border: 0; padding: 24px; overflow-y: auto; }
.task-drawer::backdrop { background: #0005; }
.task-drawer h2 { margin: 20px 0; }
.task-event { border-left: 3px solid #839bc3; padding: 0 0 24px 18px; margin: 18px 0; overflow-wrap: anywhere; line-height: 1.7; }
.task-drawer p, .release-info dd { overflow-wrap: anywhere; }
.status-link { color: #315eac; text-decoration: none; }
.status-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.status-tab { padding: 8px 14px; border: 1px solid #ccd4df; border-radius: 6px; background: white; color: #243247; cursor: pointer; font-size: 14px; }
.status-tab[aria-pressed="true"] { background: #15243a; border-color: #15243a; color: white; }
.status-badge { display: inline-block; padding: 3px 10px; border: 0; border-radius: 12px; font-size: 13px; font-weight: 600; line-height: 1.5; white-space: nowrap; cursor: pointer; }
span.status-badge { cursor: default; margin-bottom: 8px; }
.status-active { background: #dbe8fb; color: #1d4f9c; }
.status-stale { background: #fdf0d2; color: #815a06; }
.status-unconfirmed { background: #fde6cf; color: #93480c; }
.status-success { background: #d9f2e0; color: #1c6b37; }
.status-failed { background: #fbdcdc; color: #a01f24; }
.status-cancelled { background: #e7eaef; color: #4a5667; }
.status-note { display: block; margin-top: 2px; color: #815a06; font-size: 12px; }
#rows tr { cursor: pointer; }
#pageError, #detailError { color: #a82c30; margin-bottom: 12px; }
.app-page a:focus-visible, .app-page button:focus-visible { outline: 3px solid #e5ab32; outline-offset: 3px; }
@media (max-width: 767px) {
    body.app-page { padding-left: 0; }
    .app-page .dashboard-container { padding: 16px; }
    .app-page .dashboard-header { margin-top: 12px; }
    .app-nav { transform: translateX(-100%); visibility: hidden; width: 224px; }
    .nav-open .app-nav { transform: none; visibility: visible; }
    .nav-toggle { display: block; margin: 12px 16px 0; }
    .app-page .table-container { padding: 16px; }
    .app-page .release-dialog { max-width: calc(100% - 24px); padding: 20px; }
    .app-page .release-form { grid-template-columns: minmax(0,1fr); }
    .app-page input, .app-page textarea { min-width: 0; max-width: 100%; }
    .task-drawer { width: 100%; padding: 18px; }
}

.release-accounts-page #accountStatus:not(:empty) {
    margin: 12px 0;
}

@media (max-width: 767px) {
    .app-page .release-accounts-page .accounts-table {
        min-width: 0;
        table-layout: fixed;
    }

    .release-accounts-page .accounts-table th,
    .release-accounts-page .accounts-table td {
        padding: 8px 4px;
        overflow-wrap: anywhere;
    }

    .release-accounts-page .accounts-table .release-row-actions {
        display: grid;
        min-width: 0;
        gap: 4px;
    }

    .release-accounts-page .accounts-table .release-small-button {
        padding-inline: 4px;
    }

    .release-accounts-page .accounts-table select {
        max-width: 100%;
    }
}
