* { box-sizing: border-box; }
body { font-family: Segoe UI, Arial, sans-serif; margin: 0; background: #f4f6f8; color: #222; }
nav.top { background: #1f2d3d; color: #fff; padding: 10px 20px; display: flex; gap: 18px; align-items: center; }
nav.top a { color: #dde5ef; text-decoration: none; font-size: 14px; }
nav.top a:hover { color: #fff; }
nav.top .brand { font-weight: bold; font-size: 16px; margin-right: 20px; }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
h1 { margin-top: 0; font-size: 22px; }
h2 { font-size: 16px; margin: 24px 0 8px; }
.toolbar { margin: 10px 0 16px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Buttons ── */
.btn { background: #2d6cdf; color: #fff; border: 0; padding: 8px 14px; border-radius: 4px; cursor: pointer; text-decoration: none; font-size: 13px; display: inline-block; transition: opacity 0.15s, background 0.15s; }
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: #6c757d; }
.btn.danger { background: #c0392b; }
.btn.ghost { background: transparent; color: #2d6cdf; border: 1px solid #2d6cdf; }
.btn.ghost:hover { background: #eef3fc; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.07); font-size: 13px; border-radius: 6px; overflow: hidden; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid #eceff3; }
th { background: #f7f9fc; font-weight: 600; color: #444; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfd; }
tr.checkedout { background: #fef6f5; }
tr.checkedout:hover td { background: #fdecea; }
tr.created { background: #f2fbf5; }
tr.created:hover td { background: #eaf7ee; }
.empty { text-align: center; color: #999; padding: 20px !important; font-style: italic; }

/* ── Badges ── */
.badge { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge.run { background: #d4edda; color: #155724; }
.badge.stop { background: #f8d7da; color: #721c24; }
.badge.busy { background: #fff3cd; color: #856404; }

/* ── Status Cards ── */
.status-cards { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card { background: #fff; padding: 14px 18px; border-radius: 6px; min-width: 140px; box-shadow: 0 1px 3px rgba(0,0,0,0.07); border-top: 3px solid transparent; transition: box-shadow 0.15s; }
.card:hover { box-shadow: 0 3px 8px rgba(0,0,0,0.12); }
.card .val { font-size: 26px; font-weight: 700; line-height: 1.2; }
.card .lbl { font-size: 12px; color: #777; margin-top: 2px; }
.card.card-blue { border-top-color: #2d6cdf; }
.card.card-blue .val { color: #2d6cdf; }
.card.card-green { border-top-color: #28a745; }
.card.card-green .val { color: #28a745; }
.card.card-purple { border-top-color: #6f42c1; }
.card.card-purple .val { color: #6f42c1; }
.card.card-orange { border-top-color: #fd7e14; }
.card.card-orange .val { color: #fd7e14; }
.card.card-teal { border-top-color: #20c997; }
.card.card-teal .val { color: #20c997; }

/* ── Refresh Dot ── */
.refresh-dot { width: 8px; height: 8px; background: #28a745; border-radius: 50%; display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

/* ── Form ── */
form.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: 190px 1fr; gap: 10px 16px; max-width: 700px; background: #fff; padding: 24px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.07); }
.form-grid input[type=text], .form-grid input[type=password], .form-grid input[type=number], .form-grid input[type=url] { width: 100%; padding: 7px 9px; border: 1px solid #ccd0d4; border-radius: 4px; font-size: 13px; transition: border-color 0.15s; }
.form-grid input:focus { border-color: #2d6cdf; outline: none; box-shadow: 0 0 0 2px rgba(45,108,223,0.15); }
.form-grid label { padding-top: 7px; font-weight: 500; font-size: 13px; color: #444; }
.section-header { font-weight: 700; font-size: 13px; padding-top: 14px !important; border-top: 1px solid #eceff3; grid-column: 1 / span 2; color: #1f2d3d; letter-spacing: 0.02em; }
.form-actions { grid-column: 1 / span 2; margin-top: 8px; display: flex; gap: 10px; }
.form-select { width: 100%; padding: 7px 9px; border: 1px solid #ccd0d4; border-radius: 4px; font-size: 13px; background: #fff; transition: border-color 0.15s; }
.form-select:focus { border-color: #2d6cdf; outline: none; box-shadow: 0 0 0 2px rgba(45,108,223,0.15); }
.field-hint { display: block; font-size: 11px; color: #888; margin-top: 4px; }
.alert-error { background: #fdecea; color: #c0392b; padding: 10px 14px; border-radius: 4px; border-left: 3px solid #c0392b; margin-bottom: 16px; font-size: 13px; }

/* ── Toggle Switch ── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; flex-shrink: 0; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 24px; transition: background 0.2s; }
.slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle-switch input:checked ~ .slider { background: #2d6cdf; }
.toggle-switch input:checked ~ .slider::before { transform: translateX(20px); }
.toggle-switch input:disabled ~ .slider { opacity: 0.55; cursor: not-allowed; }

/* ── Toast ── */
#toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { color: #fff; padding: 10px 16px; border-radius: 4px; font-size: 13px; min-width: 200px; max-width: 360px; opacity: 0; transform: translateX(16px); transition: opacity 0.25s, transform 0.25s; box-shadow: 0 2px 8px rgba(0,0,0,0.25); pointer-events: auto; word-break: break-word; line-height: 1.4; }
.toast.visible { opacity: 1; transform: translateX(0); }
.toast.toast-success { background: #1a7431; border-left: 4px solid #28a745; }
.toast.toast-error { background: #8b1a1a; border-left: 4px solid #dc3545; }
.toast.toast-info { background: #0d5560; border-left: 4px solid #17a2b8; }

/* ── Modal ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); align-items: center; justify-content: center; z-index: 9998; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; padding: 24px; border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,0.3); max-width: 380px; width: 90%; }
.modal-message { margin: 0 0 20px; font-size: 15px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Log Box ── */
.log-box { background: #1e1e1e; color: #d4d4d4; padding: 12px; font-family: Consolas, monospace; font-size: 12px; height: 500px; overflow: auto; border-radius: 4px; white-space: pre-wrap; }

/* ── Nav Right (user + logout) ── */
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-user { color: #dde5ef; text-decoration: none; font-size: 13px; }
.nav-user:hover { color: #fff; }
.nav-logout { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #dde5ef; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; transition: background 0.15s; }
.nav-logout:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* ── Login Page ── */
.login-body { background: #1f2d3d; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 10px; padding: 40px 36px; width: 100%; max-width: 380px; box-shadow: 0 8px 32px rgba(0,0,0,0.35); }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-icon { font-size: 36px; }
.login-brand h1 { font-size: 18px; margin: 8px 0 4px; color: #1f2d3d; }
.login-brand p { font-size: 13px; color: #888; margin: 0; }
.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 13px; font-weight: 500; color: #444; margin-bottom: 5px; }
.login-field input[type=text], .login-field input[type=password] { width: 100%; padding: 9px 11px; border: 1px solid #ccd0d4; border-radius: 4px; font-size: 14px; transition: border-color 0.15s; }
.login-field input:focus { border-color: #2d6cdf; outline: none; box-shadow: 0 0 0 2px rgba(45,108,223,0.15); }
.login-remember { display: flex; align-items: center; gap: 10px; }
.login-remember label { margin: 0; }
.login-btn { width: 100%; padding: 10px; font-size: 14px; margin-top: 8px; justify-content: center; }
