* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.47059;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: #1d1d1f;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* Navigation tabs */
.nav-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: #e8e8ed;
    border-radius: 10px;
    padding: 3px;
    width: fit-content;
}

.nav-tab {
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #1d1d1f;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: transparent;
}

.nav-tab:hover {
    background: rgba(0,0,0,0.04);
}

.nav-tab.active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: #0071e3;
    color: #fff;
}

.btn-primary:hover {
    background: #0077ED;
}

.btn-secondary {
    background: #e8e8ed;
    color: #1d1d1f;
}

.btn-secondary:hover {
    background: #dddde1;
}

.btn-danger {
    background: #ff3b30;
    color: #fff;
}

.btn-danger:hover {
    background: #e8352b;
}

.btn-ghost {
    background: transparent;
    color: #0071e3;
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: rgba(0,113,227,0.06);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 6px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 8px;
    transition: box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
}

.card-meta {
    font-size: 12px;
    color: #86868b;
    display: flex;
    gap: 16px;
    align-items: center;
}

.card-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* Status badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    margin-right: auto;
    margin-left: 15px;
}

.favorite_btn {
    background:none;border:none;cursor:pointer;font-size:16px;padding:0;line-height:1"
}

.badge-online {
    background: #e8f8e8;
    color: #1b8a1b;
}

.badge-offline {
    background: #fce8e6;
    color: #d93025;
}

.badge-checking {
    background: #e8eaed;
    color: #5f6368;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-online .badge-dot { background: #34c759; }
.badge-offline .badge-dot { background: #ff3b30; }
.badge-checking .badge-dot { background: #86868b; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: 16px;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 19px;
    font-weight: 700;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 0 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e8e8ed;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86868b;
    font-size: 16px;
}

.modal-close:hover {
    background: #dddde1;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #86868b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1d1d1f;
    background: #fff;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-hint {
    font-size: 11px;
    color: #86868b;
    margin-top: 4px;
}

/* Toggle */
.toggle-group {
    display: flex;
    gap: 4px;
    background: #e8e8ed;
    border-radius: 8px;
    padding: 2px;
}

.toggle-option {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: transparent;
    color: #1d1d1f;
}

.toggle-option.active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Terminal */
.terminal-container {
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 12px;
}

.terminal-header {
    background: #2d2d2d;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #a0a0a0;
    font-size: 12px;
}

.terminal-dots {
    display: flex;
    gap: 6px;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.terminal-dot-red { background: #ff5f57; }
.terminal-dot-yellow { background: #febc2e; }
.terminal-dot-green { background: #28c840; }

#terminal {
    height: 400px;
}

/* Output */
.output-block {
    background: #f5f5f7;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.output-block pre {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    color: #1d1d1f;
}

/* Batch bar */
.batch-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    margin-top: 16px;
}

.batch-bar-info {
    font-size: 13px;
    font-weight: 500;
    color: #86868b;
}

.batch-bar-actions {
    display: flex;
    gap: 8px;
}

/* Checkbox */
.checkbox {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    accent-color: #0071e3;
    cursor: pointer;
}

/* Logs */
.log-entry {
    padding: 10px 0;
    border-bottom: 1px solid #f5f5f7;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-action {
    font-size: 13px;
    font-weight: 500;
}

.log-time {
    font-size: 11px;
    color: #86868b;
    white-space: nowrap;
}

.log-status-ok {
    color: #34c759;
}

.log-status-error {
    color: #ff3b30;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #86868b;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1d1d1f;
}

.empty-state p {
    font-size: 13px;
    margin-bottom: 20px;
}

/* Loading spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: #0071e3;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-white {
    border-color: rgba(255,255,255,0.3);
    border-top-color: #fff;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1d1d1f;
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    z-index: 200;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c7c7cc;
    border-radius: 3px;
}

/* Select all bar */
.select-all-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    margin-bottom: 8px;
}

.select-all-bar label {
    font-size: 13px;
    color: #86868b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 19px;
    font-weight: 700;
}

/* Import area */
.import-area {
    border: 2px dashed #d2d2d7;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    transition: border-color 0.2s;
}

.import-area:hover {
    border-color: #0071e3;
}

/* File Manager */
.fm-breadcrumb { display:flex; gap:4px; align-items:center; font-size:13px; margin-bottom:12px; flex-wrap:wrap; }
.fm-breadcrumb-item { cursor:pointer; color:#0071e3; background:none; border:none; font:inherit; font-size:13px; padding:2px 4px; border-radius:4px; }
.fm-breadcrumb-item:hover { background:rgba(0,113,227,0.08); }
.fm-breadcrumb-sep { color:#86868b; font-size:11px; }

.fm-toolbar { display:flex; gap:8px; margin-bottom:12px; align-items:center; flex-wrap:wrap; }

.fm-dropzone { border:2px dashed transparent; border-radius:10px; min-height:200px; position:relative; transition:all 0.2s; }
.fm-dropzone.dragover { border-color:#0071e3; background:rgba(0,113,227,0.04); }

.fm-table { width:100%; border-collapse:collapse; font-size:13px; }
.fm-table th { text-align:left; padding:6px 10px; color:#86868b; font-weight:500; border-bottom:1px solid #e8e8ed; font-size:11px; text-transform:uppercase; letter-spacing:0.03em; }
.fm-table td { padding:6px 10px; border-bottom:1px solid #f5f5f7; }
.fm-table tr:hover { background:#f9f9fb; }
.fm-table tr { cursor:default; }

.fm-icon { width:24px; text-align:center; font-size:16px; }
.fm-name { cursor:pointer; font-weight:500; }
.fm-name:hover { color:#0071e3; }
.fm-size { color:#86868b; font-size:12px; white-space:nowrap; }
.fm-date { color:#86868b; font-size:12px; white-space:nowrap; }
.fm-actions { white-space:nowrap; display:flex; gap:2px; }

.fm-log-pre {
    background:#1d1d1f; color:#34c759;
    font-family:'SF Mono','Fira Code',monospace; font-size:12px;
    padding:16px; border-radius:10px;
    max-height:500px; overflow:auto;
    white-space:pre-wrap; word-break:break-all;
    line-height:1.5;
}

.fm-file-pre {
    background:#f5f5f7; color:#1d1d1f;
    font-family:'SF Mono','Fira Code',monospace; font-size:12px;
    padding:16px; border-radius:10px;
    max-height:500px; overflow:auto;
    white-space:pre-wrap; word-break:break-all;
    line-height:1.5;
}

.modal-overlay-stacked { z-index:110; }
.modal-wide { max-width:800px; }

.fm-quick-lines { display:flex; gap:4px; align-items:center; flex-wrap:wrap; }
.fm-quick-lines button { padding:4px 10px; border-radius:6px; font-size:12px; font-weight:500; cursor:pointer; border:1px solid #d2d2d7; background:#fff; color:#1d1d1f; transition:all 0.15s; }
.fm-quick-lines button:hover { border-color:#0071e3; color:#0071e3; }
.fm-quick-lines button.active { background:#0071e3; color:#fff; border-color:#0071e3; }

.fm-upload-overlay {
    position:absolute; inset:0; background:rgba(0,113,227,0.06);
    border:2px dashed #0071e3; border-radius:10px;
    display:flex; align-items:center; justify-content:center;
    font-size:15px; font-weight:600; color:#0071e3;
    pointer-events:none; z-index:5;
}

/* Responsive */
@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .card-actions {
        flex-direction: column;
    }
}
