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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a1a;
    background: #f5f5f5;
}

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

h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

h2 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
}

.subtitle {
    color: #666;
    margin-bottom: 24px;
}

.breadcrumb {
    margin-bottom: 16px;
    font-size: 13px;
}

.breadcrumb a {
    color: #0066cc;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* System list */
.system-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.system-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s;
}

.system-card:hover {
    border-color: #0066cc;
}

/* System blocks on index page */
.system-blocks {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.system-block {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 18px 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.system-block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.system-block-header strong {
    font-size: 16px;
}

.system-block-targets {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.target-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 6px;
}

.target-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.target-tag {
    display: inline-block;
    padding: 3px 10px;
    background: #e8e8e8;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #444;
    white-space: nowrap;
}

.target-url {
    font-size: 12px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.target-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px 24px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 16px;
}

.modal-header .btn {
    font-size: 18px;
    padding: 2px 8px;
    line-height: 1;
}

.system-id {
    font-family: monospace;
    font-size: 12px;
    color: #888;
}

/* Quick links */
.quick-links {
    margin-bottom: 24px;
}

.quick-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: #444;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s;
}

.quick-link:hover {
    background: #eee;
    border-color: #ccc;
}

/* Grid layout */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

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

/* Sections */
.section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}

/* Form rows */
.form-row {
    margin-bottom: 12px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row > label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-row textarea {
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 12px;
    resize: vertical;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
}

.custom-value-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.custom-value-input {
    flex: 1;
    min-width: 0;
    width: auto;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.custom-value-input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.15);
}

.custom-role {
    font-style: italic;
}

.btn-add-custom {
    flex-shrink: 0;
    padding: 6px 12px;
}

/* Preset controls */
.preset-controls {
    display: flex;
    gap: 8px;
}

.preset-controls select {
    flex: 1;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    text-align: center;
    line-height: 1.4;
    color: inherit;
}

.btn:hover {
    background: #f0f0f0;
}

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

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-primary {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

.btn-primary:hover {
    background: #0055aa;
}

.btn-accent {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
    margin-top: 8px;
}

.btn-accent:hover {
    background: #0055aa;
}

/* Actions */
.actions {
    display: flex;
    gap: 8px;
}

/* Collapsible */
.toggle-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-icon {
    font-size: 18px;
    color: #888;
}

.hint {
    font-size: 12px;
    color: #888;
    margin-bottom: 12px;
}

/* Copy row */
.copy-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.copy-row textarea,
.copy-row input {
    flex: 1;
}

.copy-btn {
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}

/* Output */
.decoded-output {
    background: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 10px;
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* User cards */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 16px;
}

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

.user-login {
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 14px;
}

.user-actions {
    display: flex;
    gap: 6px;
}

.user-api-link {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.user-api-link .api-url {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: #666;
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.user-api-link a {
    text-decoration: none;
    color: #555;
}

.user-api-link a:hover {
    color: #0066cc;
}

.user-data {
    background: #1e1e1e;
    border-radius: 6px;
    padding: 12px 14px;
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 13px;
    margin: 0;
    overflow-x: auto;
    line-height: 1.5;
}

.json-key {
    color: #9cdcfe;
}

.json-string {
    color: #ce9178;
}

.json-number {
    color: #b5cea8;
}

.json-boolean {
    color: #569cd6;
}

.json-null {
    color: #569cd6;
}

.json-bracket {
    color: #d4d4d4;
}

.json-comma {
    color: #d4d4d4;
}

.user-edit {
    margin-top: 8px;
}

.user-edit-textarea {
    width: 100%;
    box-sizing: border-box;
    font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
    font-size: 13px;
    padding: 12px 14px;
    border: 1px solid #0066cc;
    border-radius: 6px;
    resize: vertical;
    min-height: 160px;
    line-height: 1.5;
    background: #1e1e1e;
    color: #d4d4d4;
}

.user-edit-textarea:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.3);
}

.btn-danger {
    color: #c0392b;
    border-color: #c0392b;
}

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