:root {
    font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    color: #303133;
    background: #f5f7fa;
    font-size: 14px;
    font-synthesis: none;
    --primary: #409eff;
    --primary-hover: #66b1ff;
    --primary-active: #3a8ee6;
    --success: #67c23a;
    --danger: #f56c6c;
    --danger-hover: #f78989;
    --text: #303133;
    --text-regular: #606266;
    --text-secondary: #909399;
    --border: #dcdfe6;
    --border-light: #e4e7ed;
    --border-lighter: #ebeef5;
    --fill-light: #f5f7fa;
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); }
.muted { color: var(--text-secondary); }

.topbar {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(24px, calc((100vw - 1200px) / 2));
    background: #fff;
    color: var(--text);
    border-bottom: 1px solid var(--border-light);
}
.topbar > div { display: flex; align-items: center; gap: 12px; }
.topbar strong { font-size: 18px; font-weight: 500; }
.topbar .muted { color: var(--text-secondary); }
.topbar form { margin: 0; }

.container { width: min(1200px, calc(100% - 48px)); margin: 24px auto 40px; }
.card {
    background: #fff;
    border: 1px solid var(--border-lighter);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .04);
}
h1, h2 { margin-top: 0; font-weight: 500; }
h1 { font-size: 24px; }
h2 { font-size: 18px; line-height: 24px; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.list-heading h2 { display: flex; align-items: center; gap: 8px; margin: 0; }

button, .button {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 7px 15px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    line-height: 18px;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .2s, background-color .2s, color .2s;
}
button:hover, .button:hover { border-color: var(--primary-hover); background: var(--primary-hover); }
button:active, .button:active { border-color: var(--primary-active); background: var(--primary-active); }
button:focus-visible, .button:focus-visible { outline: 2px solid #a0cfff; outline-offset: 2px; }
button.secondary, .button.secondary { border-color: var(--border); background: #fff; color: var(--text-regular); }
button.secondary:hover, .button.secondary:hover { border-color: #c6e2ff; background: #ecf5ff; color: var(--primary); }
button.danger, .button.danger { border-color: var(--danger); background: var(--danger); color: #fff; }
button.danger:hover, .button.danger:hover { border-color: var(--danger-hover); background: var(--danger-hover); }

label { display: flex; flex-direction: column; gap: 6px; color: var(--text-regular); font-size: 14px; }
input, select {
    width: 100%;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 11px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
input::placeholder { color: #a8abb2; }
input:hover, select:hover { border-color: #c0c4cc; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
input[type="checkbox"] { width: 14px; height: 14px; margin: 0; accent-color: var(--primary); box-shadow: none; }
.machine-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 20px; }
.wide { grid-column: 1 / -1; }
.check { flex-direction: row; align-items: center; gap: 8px; }
.form-actions, .dialog-actions { display: flex; justify-content: flex-end; gap: 12px; }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--border-lighter); }
table { width: 100%; border-collapse: collapse; color: var(--text-regular); font-size: 14px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border-lighter); vertical-align: middle; }
th { background: #fafafa; color: var(--text-secondary); font-weight: 500; white-space: nowrap; }
tbody tr { transition: background-color .2s; }
tbody tr:hover { background: #f5f7fa; }
td strong { color: var(--text); font-weight: 500; }
code { color: var(--text-regular); font-family: Consolas, "Courier New", monospace; word-break: break-all; }
.badge { display: inline-flex; align-items: center; min-width: 22px; height: 20px; justify-content: center; border-radius: 10px; padding: 0 7px; background: #ecf5ff; color: var(--primary); font-size: 12px; }
.ok { display: inline-flex; align-items: center; border-radius: 4px; padding: 2px 8px; background: #f0f9eb; color: var(--success); font-size: 12px; }
td > .muted { display: inline-flex; border-radius: 4px; padding: 2px 8px; background: #f4f4f5; font-size: 12px; }
.empty { text-align: center; color: var(--text-secondary); padding: 42px 16px; }
.actions { white-space: nowrap; }
.actions form { display: inline-block; margin: 0 0 0 8px; }
.actions .button, .actions button { min-height: 28px; padding: 4px 11px; font-size: 12px; }

.machine-dialog {
    width: min(860px, calc(100% - 32px));
    max-height: calc(100vh - 64px);
    border: 0;
    border-radius: 4px;
    padding: 0;
    color: var(--text);
    box-shadow: 0 12px 32px 4px rgba(0, 0, 0, .12), 0 8px 20px 0 rgba(0, 0, 0, .08);
}
.machine-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.machine-dialog form { padding: 20px; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.dialog-header h2 { margin: 0; font-size: 18px; }
button.dialog-close { min-height: 24px; width: 24px; padding: 0; border: 0; background: transparent; color: var(--text-secondary); font-size: 24px; line-height: 1; }
button.dialog-close:hover { background: transparent; color: var(--primary); }
.dialog-actions { border-top: 1px solid var(--border-lighter); margin: 24px -20px -20px; padding: 14px 20px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f5f7fa; }
.login-card { width: min(400px, 100%); padding: 32px; background: #fff; border: 1px solid var(--border-lighter); border-radius: 4px; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .06); }
.login-card h1 { margin-bottom: 8px; }
.login-card > .muted { margin: 0 0 24px; }
.login-card form { display: grid; gap: 18px; margin-top: 22px; }
.login-card form button { width: 100%; margin-top: 4px; }
.alert { margin: 16px 0; padding: 10px 14px; border: 1px solid #fde2e2; border-radius: 4px; background: #fef0f0; color: var(--danger); }

@media (max-width: 760px) {
    .topbar { height: auto; min-height: 56px; padding: 12px 16px; gap: 12px; }
    .topbar > div { display: block; }
    .topbar strong { display: block; font-size: 16px; }
    .topbar .muted { font-size: 12px; }
    .container { width: calc(100% - 24px); margin-top: 12px; }
    .card { padding: 14px; }
    .machine-form { grid-template-columns: 1fr; }
    .wide { grid-column: auto; }
    .machine-dialog form { padding: 16px; }
    .dialog-actions { margin: 22px -16px -16px; padding: 12px 16px; }
    th, td { padding: 10px; }
    .login-card { padding: 24px; }
}
